File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed
tests/com/magento/idea/magento2plugin/reference/php Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change 8
8
import com .intellij .psi .PsiReference ;
9
9
import com .intellij .psi .impl .source .xml .XmlAttributeValueImpl ;
10
10
import com .magento .idea .magento2plugin .BaseProjectTestCase ;
11
+ import com .magento .idea .magento2plugin .reference .xml .PolyVariantReferenceBase ;
11
12
import java .io .File ;
12
13
13
14
abstract public class ReferencePhpFixtureTestCase extends BaseProjectTestCase {
@@ -26,13 +27,23 @@ protected String getFixturePath(String fileName) {
26
27
}
27
28
28
29
protected void assertHasReferenceToXmlAttributeValue (String attributeValue ) {
30
+ String referenceNotFound = "Failed that documents contains reference to XML attribute with value `%s`" ;
31
+
29
32
PsiElement element = getElementFromCaret ();
30
33
PsiReference [] references = element .getReferences ();
31
- assertEquals (
32
- attributeValue ,
33
- ((XmlAttributeValueImpl ) references [references .length - 1 ].resolve ())
34
- .getValue ()
35
- );
34
+ for (PsiReference reference : references ) {
35
+ if (!(reference instanceof PolyVariantReferenceBase )) {
36
+ continue ;
37
+ }
38
+ assertEquals (
39
+ attributeValue ,
40
+ ((XmlAttributeValueImpl ) reference .resolve ())
41
+ .getValue ()
42
+ );
43
+ return ;
44
+ }
45
+
46
+ fail (String .format (referenceNotFound , attributeValue ));
36
47
}
37
48
38
49
private PsiElement getElementFromCaret () {
You can’t perform that action at this time.
0 commit comments