Skip to content

Commit 8c8b1c8

Browse files
author
Vitaliy
authored
Merge pull request #139 from magento/plugin-104-cover-mftf-data-entity-test-coverage
Added test coverage MFTF Entity name autocomplete and reference, fixed bugs
2 parents 31a1b6f + 3dc8345 commit 8c8b1c8

File tree

80 files changed

+1347
-186
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+1347
-186
lines changed

resources/META-INF/plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585

8686
<projectService serviceImplementation="com.magento.idea.magento2plugin.project.Settings"/>
8787

88-
<completion.contributor language="XML" implementationClass="com.magento.idea.magento2plugin.completion.xml.XmlCompletionContributor" />
88+
<completion.contributor language="XML" implementationClass="com.magento.idea.magento2plugin.completion.xml.XmlCompletionContributor" id="xml" />
8989

9090
<psi.referenceContributor language="XML" implementation="com.magento.idea.magento2plugin.reference.xml.XmlReferenceContributor"/>
9191
<psi.referenceContributor language="PHP" implementation="com.magento.idea.magento2plugin.reference.php.PhpReferenceContributor"/>

src/com/magento/idea/magento2plugin/completion/xml/XmlCompletionContributor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ public XmlCompletionContributor() {
209209
// mftf selector completion contributor
210210
extend(CompletionType.BASIC,
211211
psiElement(XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN)
212-
.inside(XmlPatterns.xmlAttribute())
212+
.inside(XmlPatterns.xmlAttribute()
213+
.withName(MftfActionGroup.SELECTOR_ATTRIBUTE))
213214
.inFile(xmlFile().withName(string().endsWith("Test.xml"))),
214215
new SelectorCompletionProvider()
215216
);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
package com.magento.idea.magento2plugin.magento.files;
6+
7+
public class MftfActionGroup {
8+
9+
public static String SELECTOR_ATTRIBUTE = "selector";
10+
public static String ENTITY_ATTRIBUTE = "entity";
11+
public static String CREATE_DATA_TAG = "createData";
12+
public static String UPDATE_DATA_TAG = "updateData";
13+
public static String USER_INPUT_TAG = "userInput";
14+
}

src/com/magento/idea/magento2plugin/reference/xml/XmlReferenceContributor.java

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.intellij.psi.PsiReferenceContributor;
99
import com.intellij.psi.PsiReferenceRegistrar;
1010
import com.intellij.psi.xml.XmlTokenType;
11+
import com.magento.idea.magento2plugin.magento.files.MftfActionGroup;
1112
import com.magento.idea.magento2plugin.php.util.PhpRegex;
1213
import com.magento.idea.magento2plugin.reference.provider.*;
1314
import com.magento.idea.magento2plugin.reference.provider.mftf.*;
@@ -157,22 +158,28 @@ public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar)
157158
)
158159
);
159160

160-
// <someXmlTag someAttribute="{{someValue}}" />
161+
// <someXmlTag userInput="{{someValue}}" />
161162
registrar.registerReferenceProvider(
162-
XmlPatterns.xmlAttributeValue().withValue(string().matches(".*\\{\\{[^\\}]+\\}\\}.*")),
163+
XmlPatterns.xmlAttributeValue().withValue(
164+
string().matches(".*\\{\\{[^\\}]+\\}\\}.*")
165+
).withParent(XmlPatterns.xmlAttribute().withName(
166+
MftfActionGroup.USER_INPUT_TAG
167+
)),
163168
new CompositeReferenceProvider(
164-
new DataReferenceProvider(),
165-
new PageReferenceProvider(),
166-
new SectionReferenceProvider()
169+
new DataReferenceProvider()
167170
)
168171
);
169172

170173
// <createData entity="SimpleProduct" />
174+
// <updateData entity="SimpleProduct" />
171175
registrar.registerReferenceProvider(
172-
XmlPatterns.xmlAttributeValue().withParent(XmlPatterns.xmlAttribute().withName(string().oneOf("entity", "value", "userInput", "url"))),
176+
XmlPatterns.xmlAttributeValue().withParent(XmlPatterns.xmlAttribute()
177+
.withName(MftfActionGroup.ENTITY_ATTRIBUTE)
178+
.withParent(XmlPatterns.xmlTag().withName(
179+
string().oneOf(MftfActionGroup.CREATE_DATA_TAG, MftfActionGroup.UPDATE_DATA_TAG)
180+
))),
173181
new CompositeReferenceProvider(
174-
new DataReferenceProvider(),
175-
new SectionReferenceProvider()
182+
new DataReferenceProvider()
176183
)
177184
);
178185

testData/completion/common/classes.php

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)