|
2 | 2 |
|
3 | 3 | import com.intellij.psi.PsiElement;
|
4 | 4 | import com.intellij.util.containers.ContainerUtil;
|
| 5 | +import com.jetbrains.php.PhpIndex; |
5 | 6 | import com.jetbrains.php.lang.PhpFileType;
|
6 | 7 | import com.jetbrains.php.lang.psi.PhpPsiElementFactory;
|
7 | 8 | import com.jetbrains.php.lang.psi.elements.*;
|
@@ -307,4 +308,20 @@ public void testThatPhpThatStringValueCanBeResolvedViaChainResolve() {
|
307 | 308 | assertContainsElements(PhpElementsUtil.StringResolver.findStringValues(PhpPsiElementFactory.createPhpPsiFromText(getProject(), ParameterList.class, "<?php $var = 'test.html'; foo($var);").getFirstPsiChild()), "test.html");
|
308 | 309 | assertContainsElements(PhpElementsUtil.StringResolver.findStringValues(PhpPsiElementFactory.createPhpPsiFromText(getProject(), TernaryExpression.class, "<?php $var = 'test.html'; $x = true == true ? $var : 'test2.html';")), "test.html", "test2.html");
|
309 | 310 | }
|
| 311 | + |
| 312 | + public void testGetImplementedMethodsForRecursiveClassHierarchy() { |
| 313 | + myFixture.addFileToProject("First.php", "<?php class First extends Second { public function method() {} }"); |
| 314 | + myFixture.addFileToProject("Second.php", "<?php class Second extends First { public function method() {} }"); |
| 315 | + |
| 316 | + var firstClass = PhpIndex.getInstance(getProject()).getClassByName("First"); |
| 317 | + var secondClass = PhpIndex.getInstance(getProject()).getClassByName("Second"); |
| 318 | + |
| 319 | + var actualResult = PhpElementsUtil.getImplementedMethods( |
| 320 | + secondClass.findOwnMethodByName("method") |
| 321 | + ); |
| 322 | + |
| 323 | + assertSize(2, actualResult); |
| 324 | + assertEquals(secondClass.findOwnMethodByName("method"), actualResult[0]); |
| 325 | + assertEquals(firstClass.findOwnMethodByName("method"), actualResult[1]); |
| 326 | + } |
310 | 327 | }
|
0 commit comments