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 88import com .intellij .psi .PsiReference ;
99import com .intellij .psi .impl .source .xml .XmlAttributeValueImpl ;
1010import com .magento .idea .magento2plugin .BaseProjectTestCase ;
11+ import com .magento .idea .magento2plugin .reference .xml .PolyVariantReferenceBase ;
1112import java .io .File ;
1213
1314abstract public class ReferencePhpFixtureTestCase extends BaseProjectTestCase {
@@ -26,13 +27,23 @@ protected String getFixturePath(String fileName) {
2627 }
2728
2829 protected void assertHasReferenceToXmlAttributeValue (String attributeValue ) {
30+ String referenceNotFound = "Failed that documents contains reference to XML attribute with value `%s`" ;
31+
2932 PsiElement element = getElementFromCaret ();
3033 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 ));
3647 }
3748
3849 private PsiElement getElementFromCaret () {
You can’t perform that action at this time.
0 commit comments