1
0
Fork 0

Decided to move visibility files apart

Other tests were failing because I modifed the global_symbols.php file
pull/682/head
Gabriel Noé González 2018-11-11 00:56:07 +01:00
parent 8d4fe1ef9f
commit 9a75adfe07
4 changed files with 78 additions and 38 deletions

View File

@ -41,20 +41,6 @@ class TestClass implements TestInterface
*/ */
public $testProperty; public $testProperty;
/**
* Reprehenderit magna velit mollit ipsum do.
*
* @var TestClass
*/
private $privateProperty;
/**
* Reprehenderit magna velit mollit ipsum do.
*
* @var TestClass
*/
protected $protectedProperty;
/** /**
* Do magna consequat veniam minim proident eiusmod incididunt aute proident. * Do magna consequat veniam minim proident eiusmod incididunt aute proident.
*/ */
@ -73,16 +59,6 @@ class TestClass implements TestInterface
{ {
$this->testProperty = $testParameter; $this->testProperty = $testParameter;
} }
private function privateTestMethod()
{
return $this->privateProperty;
}
protected function protectedTestMethod()
{
return $this->protectedProperty;
}
} }
trait TestTrait trait TestTrait

View File

@ -0,0 +1,76 @@
<?php
/**
*
* Deserunt enim minim sunt sint ea nisi. Deserunt excepteur tempor id nostrud
* laboris commodo ad commodo velit mollit qui non officia id. Nulla duis veniam
* veniam officia deserunt et non dolore mollit ea quis eiusmod sit non. Occaecat
* consequat sunt culpa exercitation pariatur id reprehenderit nisi incididunt Lorem
* sint. Officia culpa pariatur laborum nostrud cupidatat consequat mollit.
*/
class TestClass
{
/**
* Anim labore veniam consectetur laboris minim quis aute aute esse nulla ad.
*
* @var int
*/
const TEST_CLASS_CONST = 123;
/**
* Lorem excepteur officia sit anim velit veniam enim.
*
* @var TestClass[]
*/
public static $staticTestProperty;
/**
* Reprehenderit magna velit mollit ipsum do.
*
* @var TestClass
*/
public $testProperty;
/**
* Reprehenderit magna velit mollit ipsum do.
*
* @var TestClass
*/
private $privateProperty;
/**
* Reprehenderit magna velit mollit ipsum do.
*
* @var TestClass
*/
protected $protectedProperty;
/**
* Do magna consequat veniam minim proident eiusmod incididunt aute proident.
*/
public static function staticTestMethod()
{
echo self::TEST_CLASS_CONST;
}
/**
* Non culpa nostrud mollit esse sunt laboris in irure ullamco cupidatat amet.
*
* @param TestClass $testParameter Lorem sunt velit incididunt mollit
* @return TestClass
*/
public function testMethod($testParameter): TestInterface
{
$this->testProperty = $testParameter;
}
private function privateTestMethod()
{
return $this->privateProperty;
}
protected function protectedTestMethod()
{
return $this->protectedProperty;
}
}

View File

@ -827,23 +827,12 @@ class CompletionTest extends TestCase
'\TestClass', // Type of the property '\TestClass', // Type of the property
'Reprehenderit magna velit mollit ipsum do.' 'Reprehenderit magna velit mollit ipsum do.'
), ),
new CompletionItem(
'protectedProperty',
CompletionItemKind::PROPERTY,
'\TestClass', // Type of the property
'Reprehenderit magna velit mollit ipsum do.'
),
new CompletionItem( new CompletionItem(
'testMethod', 'testMethod',
CompletionItemKind::METHOD, CompletionItemKind::METHOD,
'\TestClass', // Return type of the method '\TestClass', // Return type of the method
'Non culpa nostrud mollit esse sunt laboris in irure ullamco cupidatat amet.' 'Non culpa nostrud mollit esse sunt laboris in irure ullamco cupidatat amet.'
), ),
new CompletionItem(
'protectedTestMethod',
CompletionItemKind::METHOD,
'mixed' // Return type of the method
),
new CompletionItem( new CompletionItem(
'foo', 'foo',
CompletionItemKind::PROPERTY, CompletionItemKind::PROPERTY,

View File

@ -58,8 +58,7 @@ class CompletionWithVisibilityTest extends TestCase
$definitionResolver = new DefinitionResolver($projectIndex); $definitionResolver = new DefinitionResolver($projectIndex);
$contentRetriever = new FileSystemContentRetriever; $contentRetriever = new FileSystemContentRetriever;
$this->loader = new PhpDocumentLoader($contentRetriever, $projectIndex, $definitionResolver); $this->loader = new PhpDocumentLoader($contentRetriever, $projectIndex, $definitionResolver);
$this->loader->load(pathToUri($this->fixturesPath . '/global_symbols.php'))->wait(); $this->loader->load(pathToUri($this->fixturesPath . '/visibility_class.php'))->wait();
$this->loader->load(pathToUri($this->fixturesPath . '/symbols.php'))->wait();
$this->textDocument = new TextDocument($this->loader, $definitionResolver, $client, $projectIndex); $this->textDocument = new TextDocument($this->loader, $definitionResolver, $client, $projectIndex);
} }
@ -122,7 +121,7 @@ class CompletionWithVisibilityTest extends TestCase
public function testVisibilityInsideClassMethod() public function testVisibilityInsideClassMethod()
{ {
$items = $this->getCompletion('/global_symbols.php', 73, 15); $items = $this->getCompletion('/visibility_class.php', 64, 15);
// can see all properties and methods // can see all properties and methods
$this->assertCompletionsListSubset(new CompletionList([ $this->assertCompletionsListSubset(new CompletionList([
new CompletionItem( new CompletionItem(