Skip to content

Commit 2d3f64f

Browse files
author
Vitaliy Boyko
committed
Fixed test
1 parent b222522 commit 2d3f64f

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

tests/com/magento/idea/magento2plugin/reference/php/ReferencePhpFixtureTestCase.java

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.intellij.psi.PsiReference;
99
import com.intellij.psi.impl.source.xml.XmlAttributeValueImpl;
1010
import com.magento.idea.magento2plugin.BaseProjectTestCase;
11+
import com.magento.idea.magento2plugin.reference.xml.PolyVariantReferenceBase;
1112
import java.io.File;
1213

1314
abstract 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() {

0 commit comments

Comments
 (0)