loader = new PhpDocumentLoader($contentRetriever, $projectIndex, $definitionResolver); $this->loader->load(pathToUri(__DIR__ . '/../../../fixtures/global_symbols.php'))->wait(); $this->loader->load(pathToUri(__DIR__ . '/../../../fixtures/symbols.php'))->wait(); $this->textDocument = new Server\TextDocument($this->loader, $definitionResolver, $client, $projectIndex); } public function testMethodClosed() { $completionUri = pathToUri(__DIR__ . '/../../../fixtures/signature/methodClosed.php'); $this->loader->open($completionUri, file_get_contents($completionUri)); $result = $this->textDocument->signatureHelp( new TextDocumentIdentifier($completionUri), new Position(9, 22) )->wait(); $this->assertEquals(new SignatureHelp( [ new SignatureInformation( 'method(string $param = "")', null, [ new ParameterInformation('string $param = ""') ] ) ] ), $result); } public function testMethodClosedReference() { $completionUri = pathToUri(__DIR__ . '/../../../fixtures/signature/methodClosed.php'); $this->loader->open($completionUri, file_get_contents($completionUri)); $result = $this->textDocument->signatureHelp( new TextDocumentIdentifier($completionUri), new Position(14, 11) )->wait(); $this->assertEquals(new SignatureHelp( [ new SignatureInformation( 'method(string $param = "")', null, [ new ParameterInformation('string $param = ""') ] ) ] ), $result); } public function testMethodNotClosed() { $completionUri = pathToUri(__DIR__ . '/../../../fixtures/signature/methodNotClosed.php'); $this->loader->open($completionUri, file_get_contents($completionUri)); $result = $this->textDocument->signatureHelp( new TextDocumentIdentifier($completionUri), new Position(9, 22) )->wait(); $this->assertEquals(new SignatureHelp( [ new SignatureInformation( 'method(string $param = "")', null, [ new ParameterInformation('string $param = ""') ] ) ] ), $result); } public function testMethodNotClosedReference() { $completionUri = pathToUri(__DIR__ . '/../../../fixtures/signature/methodNotClosed.php'); $this->loader->open($completionUri, file_get_contents($completionUri)); $result = $this->textDocument->signatureHelp( new TextDocumentIdentifier($completionUri), new Position(14, 14) )->wait(); $this->assertEquals(new SignatureHelp( [ new SignatureInformation( 'method(string $param = "")', null, [ new ParameterInformation('string $param = ""') ] ) ] ), $result); } public function testFuncClosed() { $completionUri = pathToUri(__DIR__ . '/../../../fixtures/signature/funcClosed.php'); $this->loader->open($completionUri, file_get_contents($completionUri)); $result = $this->textDocument->signatureHelp( new TextDocumentIdentifier($completionUri), new Position(6, 10) )->wait(); $this->assertEquals(new SignatureHelp( [ new SignatureInformation( 'helpFunc1(int $count = 0)', null, [ new ParameterInformation('int $count = 0') ] ) ] ), $result); } public function testFuncNotClosed() { $completionUri = pathToUri(__DIR__ . '/../../../fixtures/signature/funcNotClosed.php'); $this->loader->open($completionUri, file_get_contents($completionUri)); $result = $this->textDocument->signatureHelp( new TextDocumentIdentifier($completionUri), new Position(6, 10) )->wait(); $this->assertEquals(new SignatureHelp( [ new SignatureInformation( 'helpFunc2(int $count = 0)', null, [ new ParameterInformation('int $count = 0') ] ) ] ), $result); } public function testStaticClosed() { $completionUri = pathToUri(__DIR__ . '/../../../fixtures/signature/staticClosed.php'); $this->loader->open($completionUri, file_get_contents($completionUri)); $result = $this->textDocument->signatureHelp( new TextDocumentIdentifier($completionUri), new Position(9, 19) )->wait(); $this->assertEquals(new SignatureHelp( [ new SignatureInformation( 'method(string $param = "")', null, [ new ParameterInformation('string $param = ""') ] ) ] ), $result); } public function testStaticNotClosed() { $completionUri = pathToUri(__DIR__ . '/../../../fixtures/signature/staticNotClosed.php'); $this->loader->open($completionUri, file_get_contents($completionUri)); $result = $this->textDocument->signatureHelp( new TextDocumentIdentifier($completionUri), new Position(9, 19) )->wait(); $this->assertEquals(new SignatureHelp( [ new SignatureInformation( 'method(string $param = "")', null, [ new ParameterInformation('string $param = ""') ] ) ] ), $result); } }