project = new Project(new LanguageClient(new MockProtocolStream())); } public function testGetDocumentCreatesNewDocument() { $document = $this->project->getDocument('file:///document1.php'); $this->assertNotNull($document); $this->assertInstanceOf(PhpDocument::class, $document); } public function testGetDocumentCreatesDocumentOnce() { $document1 = $this->project->getDocument('file:///document1.php'); $document2 = $this->project->getDocument('file:///document1.php'); $this->assertSame($document1, $document2); } public function testFindSymbols() { $this->project->getDocument('file:///document1.php')->updateContent("project->getDocument('file:///document2.php')->updateContent("project->findSymbols('ba'); $this->assertEquals([ [ 'name' => 'bar', 'kind' => SymbolKind::FUNCTION, 'location' => [ 'uri' => 'file:///document1.php', 'range' => [ 'start' => [ 'line' => 2, 'character' => 0 ], 'end' => [ 'line' => 2, 'character' => 17 ] ] ], 'containerName' => null ], [ 'name' => 'baz', 'kind' => SymbolKind::FUNCTION, 'location' => [ 'uri' => 'file:///document2.php', 'range' => [ 'start' => [ 'line' => 1, 'character' => 0 ], 'end' => [ 'line' => 1, 'character' => 17 ] ] ], 'containerName' => null ] ], json_decode(json_encode($symbols), true)); } }