Add test for nested method call
parent
f20a62f21c
commit
d764b7d6cc
|
@ -34,3 +34,6 @@ use function test_function;
|
||||||
if ($abc instanceof TestInterface) {
|
if ($abc instanceof TestInterface) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Nested expression
|
||||||
|
$obj->testProperty->testMethod();
|
||||||
|
|
|
@ -34,3 +34,6 @@ use function TestNamespace\test_function;
|
||||||
if ($abc instanceof TestInterface) {
|
if ($abc instanceof TestInterface) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Nested expressions
|
||||||
|
$obj->testProperty->testMethod();
|
||||||
|
|
|
@ -118,7 +118,8 @@ abstract class ServerTestCase extends TestCase
|
||||||
],
|
],
|
||||||
'TestNamespace\\TestClass::testProperty' => [
|
'TestNamespace\\TestClass::testProperty' => [
|
||||||
0 => new Location($symbolsUri, new Range(new Position(59, 8), new Position(59, 27))), // $this->testProperty = $testParameter;
|
0 => new Location($symbolsUri, new Range(new Position(59, 8), new Position(59, 27))), // $this->testProperty = $testParameter;
|
||||||
1 => new Location($referencesUri, new Range(new Position( 6, 5), new Position( 6, 23)))
|
1 => new Location($referencesUri, new Range(new Position( 6, 5), new Position( 6, 23))), // echo $obj->testProperty;
|
||||||
|
2 => new Location($referencesUri, new Range(new Position(38, 0), new Position(38, 18))) // $obj->testProperty->testMethod();
|
||||||
],
|
],
|
||||||
'TestNamespace\\TestClass::staticTestProperty' => [
|
'TestNamespace\\TestClass::staticTestProperty' => [
|
||||||
0 => new Location($referencesUri, new Range(new Position( 8, 5), new Position( 8, 35)))
|
0 => new Location($referencesUri, new Range(new Position( 8, 5), new Position( 8, 35)))
|
||||||
|
@ -127,7 +128,8 @@ abstract class ServerTestCase extends TestCase
|
||||||
0 => new Location($referencesUri, new Range(new Position( 7, 0), new Position( 7, 29)))
|
0 => new Location($referencesUri, new Range(new Position( 7, 0), new Position( 7, 29)))
|
||||||
],
|
],
|
||||||
'TestNamespace\\TestClass::testMethod()' => [
|
'TestNamespace\\TestClass::testMethod()' => [
|
||||||
0 => new Location($referencesUri, new Range(new Position( 5, 0), new Position( 5, 18)))
|
0 => new Location($referencesUri, new Range(new Position( 5, 0), new Position( 5, 18))), // $obj->testMethod();
|
||||||
|
1 => new Location($referencesUri, new Range(new Position(38, 0), new Position(38, 32))) // $obj->testProperty->testMethod();
|
||||||
],
|
],
|
||||||
'TestNamespace\\test_function()' => [
|
'TestNamespace\\test_function()' => [
|
||||||
0 => new Location($referencesUri, new Range(new Position(10, 0), new Position(10, 13))),
|
0 => new Location($referencesUri, new Range(new Position(10, 0), new Position(10, 13))),
|
||||||
|
@ -158,7 +160,8 @@ abstract class ServerTestCase extends TestCase
|
||||||
],
|
],
|
||||||
'TestClass::testProperty' => [
|
'TestClass::testProperty' => [
|
||||||
0 => new Location($globalSymbolsUri, new Range(new Position(59, 8), new Position(59, 27))), // $this->testProperty = $testParameter;
|
0 => new Location($globalSymbolsUri, new Range(new Position(59, 8), new Position(59, 27))), // $this->testProperty = $testParameter;
|
||||||
1 => new Location($globalReferencesUri, new Range(new Position( 6, 5), new Position( 6, 23)))
|
1 => new Location($globalReferencesUri, new Range(new Position( 6, 5), new Position( 6, 23))), // echo $obj->testProperty;
|
||||||
|
2 => new Location($globalReferencesUri, new Range(new Position(38, 0), new Position(38, 18))) // $obj->testProperty->testMethod();
|
||||||
],
|
],
|
||||||
'TestClass::staticTestProperty' => [
|
'TestClass::staticTestProperty' => [
|
||||||
0 => new Location($globalReferencesUri, new Range(new Position( 8, 5), new Position( 8, 35)))
|
0 => new Location($globalReferencesUri, new Range(new Position( 8, 5), new Position( 8, 35)))
|
||||||
|
@ -167,7 +170,8 @@ abstract class ServerTestCase extends TestCase
|
||||||
0 => new Location($globalReferencesUri, new Range(new Position( 7, 0), new Position( 7, 29)))
|
0 => new Location($globalReferencesUri, new Range(new Position( 7, 0), new Position( 7, 29)))
|
||||||
],
|
],
|
||||||
'TestClass::testMethod()' => [
|
'TestClass::testMethod()' => [
|
||||||
0 => new Location($globalReferencesUri, new Range(new Position( 5, 0), new Position( 5, 18)))
|
0 => new Location($globalReferencesUri, new Range(new Position( 5, 0), new Position( 5, 18))), // $obj->testMethod();
|
||||||
|
1 => new Location($globalReferencesUri, new Range(new Position(38, 0), new Position(38, 32))) // $obj->testProperty->testMethod();
|
||||||
],
|
],
|
||||||
'test_function()' => [
|
'test_function()' => [
|
||||||
0 => new Location($globalReferencesUri, new Range(new Position(10, 0), new Position(10, 13))),
|
0 => new Location($globalReferencesUri, new Range(new Position(10, 0), new Position(10, 13))),
|
||||||
|
|
|
@ -292,4 +292,16 @@ class GlobalTest extends ServerTestCase
|
||||||
)->wait();
|
)->wait();
|
||||||
$this->assertEquals($this->getDefinitionLocation('TestInterface'), $result);
|
$this->assertEquals($this->getDefinitionLocation('TestInterface'), $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testDefinitionForNestedMethodCall()
|
||||||
|
{
|
||||||
|
// $obj->testProperty->testMethod();
|
||||||
|
// Get definition for testMethod
|
||||||
|
$reference = $this->getReferenceLocations('TestClass::testMethod()')[1];
|
||||||
|
$result = $this->textDocument->definition(
|
||||||
|
new TextDocumentIdentifier($reference->uri),
|
||||||
|
$reference->range->end
|
||||||
|
)->wait();
|
||||||
|
$this->assertEquals($this->getDefinitionLocation('TestClass::testMethod()'), $result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue