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

37 lines
1.1 KiB
PHP
Raw Normal View History

<?php
2019-06-18 08:59:40 +00:00
declare(strict_types=1);
namespace LanguageServer\Tests\Server\TextDocument\References;
2019-06-18 08:59:40 +00:00
use Amp\Loop;
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()
{
2019-06-18 08:59:40 +00:00
Loop::run(function () {
// namespace TestNamespace;
// Get references for TestNamespace
$definition = parent::getDefinitionLocation('TestNamespace');
$result = yield $this->textDocument->references(
new ReferenceContext,
new TextDocumentIdentifier($definition->uri),
$definition->range->end
);
$this->assertEquals(parent::getReferenceLocations('TestNamespace'), $result);
});
}
}