1
0
Fork 0
php-language-server/tests/Server/TextDocument/References/NamespacedTest.php

32 lines
1.0 KiB
PHP
Raw Normal View History

<?php
2018-11-27 16:51:40 +00:00
declare(strict_types=1);
namespace LanguageServer\Tests\Server\TextDocument\References;
use LanguageServerProtocol\{TextDocumentIdentifier, Position, ReferenceContext, Location, Range};
use function LanguageServer\pathToUri;
class NamespacedTest extends GlobalTest
{
protected function getReferenceLocations(string $fqn): array
{
return parent::getReferenceLocations('TestNamespace\\' . $fqn);
}
protected function getDefinitionLocation(string $fqn): Location
{
return parent::getDefinitionLocation('TestNamespace\\' . $fqn);
}
public function testReferencesForNamespaces()
{
// namespace TestNamespace;
// Get references for TestNamespace
$definition = parent::getDefinitionLocation('TestNamespace');
2018-11-27 16:51:40 +00:00
$result = $this->textDocument
->references(new ReferenceContext(), new TextDocumentIdentifier($definition->uri), $definition->range->end)
->wait();
$this->assertEquals(parent::getReferenceLocations('TestNamespace'), $result);
}
}