From acb9f0eb47424b2008fcee54af10a2c71426f415 Mon Sep 17 00:00:00 2001 From: Felix Becker Date: Tue, 18 Oct 2016 19:25:22 +0200 Subject: [PATCH] Remove custom setUp() --- .../TextDocument/DocumentSymbolTest.php | 32 ++++++++----------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/tests/Server/TextDocument/DocumentSymbolTest.php b/tests/Server/TextDocument/DocumentSymbolTest.php index a633f24..979e8ab 100644 --- a/tests/Server/TextDocument/DocumentSymbolTest.php +++ b/tests/Server/TextDocument/DocumentSymbolTest.php @@ -7,32 +7,26 @@ use LanguageServer\Tests\Server\TextDocument\TextDocumentTestCase; use LanguageServer\Tests\MockProtocolStream; use LanguageServer\{Server, LanguageClient, Project}; use LanguageServer\Protocol\{TextDocumentIdentifier, SymbolInformation, SymbolKind, Position, Location, Range}; +use function LanguageServer\pathToUri; class DocumentSymbolTest extends TextDocumentTestCase { - public function setUp() - { - $client = new LanguageClient(new MockProtocolStream()); - $project = new Project($client); - $this->textDocument = new Server\TextDocument($project, $client); - $project->openDocument('symbols', file_get_contents(__DIR__ . '/../../../fixtures/symbols.php')); - } - public function test() { // Request symbols - $result = $this->textDocument->documentSymbol(new TextDocumentIdentifier('symbols')); + $uri = pathToUri(realpath(__DIR__ . '/../../../fixtures/symbols.php')); + $result = $this->textDocument->documentSymbol(new TextDocumentIdentifier($uri)); $this->assertEquals([ - new SymbolInformation('TEST_CONST', SymbolKind::CONSTANT, new Location('symbols', new Range(new Position( 4, 6), new Position( 4, 22))), 'TestNamespace'), - new SymbolInformation('TestClass', SymbolKind::CLASS_, new Location('symbols', new Range(new Position( 6, 0), new Position(21, 1))), 'TestNamespace'), - new SymbolInformation('TEST_CLASS_CONST', SymbolKind::CONSTANT, new Location('symbols', new Range(new Position( 8, 10), new Position( 8, 32))), 'TestNamespace\\TestClass'), - new SymbolInformation('staticTestProperty', SymbolKind::FIELD, new Location('symbols', new Range(new Position( 9, 18), new Position( 9, 37))), 'TestNamespace\\TestClass'), - new SymbolInformation('testProperty', SymbolKind::FIELD, new Location('symbols', new Range(new Position(10, 11), new Position(10, 24))), 'TestNamespace\\TestClass'), - new SymbolInformation('staticTestMethod', SymbolKind::METHOD, new Location('symbols', new Range(new Position(12, 4), new Position(15, 5))), 'TestNamespace\\TestClass'), - new SymbolInformation('testMethod', SymbolKind::METHOD, new Location('symbols', new Range(new Position(17, 4), new Position(20, 5))), 'TestNamespace\\TestClass'), - new SymbolInformation('TestTrait', SymbolKind::CLASS_, new Location('symbols', new Range(new Position(23, 0), new Position(26, 1))), 'TestNamespace'), - new SymbolInformation('TestInterface', SymbolKind::INTERFACE, new Location('symbols', new Range(new Position(28, 0), new Position(31, 1))), 'TestNamespace'), - new SymbolInformation('test_function', SymbolKind::FUNCTION, new Location('symbols', new Range(new Position(33, 0), new Position(36, 1))), 'TestNamespace') + new SymbolInformation('TEST_CONST', SymbolKind::CONSTANT, new Location($uri, new Range(new Position( 4, 6), new Position( 4, 22))), 'TestNamespace'), + new SymbolInformation('TestClass', SymbolKind::CLASS_, new Location($uri, new Range(new Position( 6, 0), new Position(21, 1))), 'TestNamespace'), + new SymbolInformation('TEST_CLASS_CONST', SymbolKind::CONSTANT, new Location($uri, new Range(new Position( 8, 10), new Position( 8, 32))), 'TestNamespace\\TestClass'), + new SymbolInformation('staticTestProperty', SymbolKind::FIELD, new Location($uri, new Range(new Position( 9, 18), new Position( 9, 37))), 'TestNamespace\\TestClass'), + new SymbolInformation('testProperty', SymbolKind::FIELD, new Location($uri, new Range(new Position(10, 11), new Position(10, 24))), 'TestNamespace\\TestClass'), + new SymbolInformation('staticTestMethod', SymbolKind::METHOD, new Location($uri, new Range(new Position(12, 4), new Position(15, 5))), 'TestNamespace\\TestClass'), + new SymbolInformation('testMethod', SymbolKind::METHOD, new Location($uri, new Range(new Position(17, 4), new Position(20, 5))), 'TestNamespace\\TestClass'), + new SymbolInformation('TestTrait', SymbolKind::CLASS_, new Location($uri, new Range(new Position(23, 0), new Position(26, 1))), 'TestNamespace'), + new SymbolInformation('TestInterface', SymbolKind::INTERFACE, new Location($uri, new Range(new Position(28, 0), new Position(31, 1))), 'TestNamespace'), + new SymbolInformation('test_function', SymbolKind::FUNCTION, new Location($uri, new Range(new Position(33, 0), new Position(36, 1))), 'TestNamespace') ], $result); } }