Skip to content

Commit c7c8693

Browse files
977: Code refactoring
1 parent 51d110d commit c7c8693

File tree

2 files changed

+52
-11
lines changed

2 files changed

+52
-11
lines changed

tests/com/magento/idea/magento2plugin/completion/xml/BackendModelXmlCompletionRegistrarTest.java

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,45 @@ public class BackendModelXmlCompletionRegistrarTest extends CompletionXmlFixture
1717
"Magento\\Backend\\Model\\Source\\YesNo"
1818
};
1919

20+
/**
21+
* Test system.xml file element completion.
22+
*/
2023
public void testSystemXmlElementProvideCompletion() {
2124
final String filePath = this.getFixturePath(ModuleSystemXmlFile.FILE_NAME);
2225
myFixture.configureByFile(filePath);
2326

2427
assertCompletionContains(filePath, SYSTEM_XML_BACKEND_MODEL_LOOKUP_STRING_CHECK);
2528
}
2629

30+
/**
31+
* Test system.xml file element completion won't show.
32+
*/
2733
public void testSystemXmlElementCompletionWontShow() {
2834
final String filePath = this.getFixturePath(
29-
ModuleSystemXmlFile.FILE_NAME
35+
ModuleSystemXmlFile.FILE_NAME
3036
);
3137
myFixture.copyFileToProject(filePath);
3238

3339
assertCompletionNotShowing(filePath);
3440
}
3541

42+
/**
43+
* Test system.xml backend model attribute match with the file.
44+
*/
3645
public void testSystemXmlBackendModelAttributeMatchWithFile() {
3746
final String filePath = this.getFixturePath(
38-
ModuleSystemXmlFile.FILE_NAME
47+
ModuleSystemXmlFile.FILE_NAME
3948
);
4049

4150
assertFileContainsCompletions(filePath, SYSTEM_XML_BACKEND_MODEL_LOOKUP_STRING_CHECK);
4251
}
4352

53+
/**
54+
* Test system.xml backend model attribute doesn't match with the file.
55+
*/
4456
public void testSystemXmlBackendModelAttributeDontMatchWithFile() {
4557
final String filePath = this.getFixturePath(
46-
"other-file-than-system.xml"
58+
"other-file-than-system.xml"
4759
);
4860

4961
assertFileNotContainsCompletions(
@@ -52,35 +64,47 @@ public void testSystemXmlBackendModelAttributeDontMatchWithFile() {
5264
);
5365
}
5466

67+
/**
68+
* Test config.xml file element completion.
69+
*/
5570
public void testConfigXmlElementProvideCompletion() {
5671
final String filePath = this.getFixturePath(
57-
ModuleConfigXml.FILE_NAME
72+
ModuleConfigXml.FILE_NAME
5873
);
5974
myFixture.copyFileToProject(filePath);
6075

6176
assertCompletionContains(filePath, CONFIG_XML_BACKEND_MODEL_LOOKUP_STRING_CHECK);
6277
}
6378

79+
/**
80+
* Test config.xml file element completion won't show.
81+
*/
6482
public void testConfigXmlElementCompletionWontShow() {
6583
final String filePath = this.getFixturePath(
66-
ModuleConfigXml.FILE_NAME
84+
ModuleConfigXml.FILE_NAME
6785
);
6886
myFixture.copyFileToProject(filePath);
6987

7088
assertCompletionNotShowing(filePath);
7189
}
7290

91+
/**
92+
* Test config.xml backend model attribute match with the file.
93+
*/
7394
public void testConfigXmlBackendModelAttributeMatchWithFile() {
7495
final String filePath = this.getFixturePath(
75-
ModuleConfigXml.FILE_NAME
96+
ModuleConfigXml.FILE_NAME
7697
);
7798

7899
assertFileContainsCompletions(filePath, CONFIG_XML_BACKEND_MODEL_LOOKUP_STRING_CHECK);
79100
}
80101

102+
/**
103+
* Test config.xml backend model attribute doesn't match with the file.
104+
*/
81105
public void testConfigXmlBackendModelAttributeDontMatchWithFile() {
82106
final String filePath = this.getFixturePath(
83-
"other-file-than-config.xml"
107+
"other-file-than-config.xml"
84108
);
85109

86110
assertFileNotContainsCompletions(

tests/com/magento/idea/magento2plugin/completion/xml/SourceModelXmlCompletionRegistrarTest.java

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,58 +7,75 @@
77

88
import com.magento.idea.magento2plugin.magento.files.ModuleSystemXmlFile;
99
import com.magento.idea.magento2plugin.magento.files.ModuleWidgetXml;
10-
import java.io.IOException;
1110

1211
public class SourceModelXmlCompletionRegistrarTest extends CompletionXmlFixtureTestCase {
1312

1413
private static final String[] LOOKUP_STRINGS_CHECK = {
1514
"Magento\\Backend\\Model\\Source\\YesNo"
1615
};
1716

17+
/**
18+
* Test source model xml element completion.
19+
*/
1820
public void testSourceModelXmlElementMustProvideCompletion() {
1921
final String filePath = this.getFixturePath(ModuleSystemXmlFile.FILE_NAME);
2022
myFixture.copyFileToProject(filePath);
2123

2224
assertCompletionContains(filePath, LOOKUP_STRINGS_CHECK);
2325
}
2426

27+
/**
28+
* Test source model xml element completion match with the file false positive.
29+
*/
2530
public void testSourceModelXmlElementMatchWithFilePositiveCase() {
2631
final String filePath = this.getFixturePath(ModuleSystemXmlFile.FILE_NAME);
2732
myFixture.copyFileToProject(filePath);
2833

2934
assertFileContainsCompletions(filePath, LOOKUP_STRINGS_CHECK);
3035
}
3136

37+
/**
38+
* Test source model xml element completion match with the file negative case.
39+
*/
3240
public void testSourceModelXmlElementMatchWithFileNegativeCase() {
3341
final String filePath = this.getFixturePath("not-system.xml");
3442
myFixture.copyFileToProject(filePath);
3543

3644
assertFileNotContainsCompletions(
37-
filePath,
45+
filePath,
3846
LOOKUP_STRINGS_CHECK
3947
);
4048
}
4149

50+
/**
51+
* Test source model attribute must provide completion.
52+
*/
4253
public void testSourceModelXmlAttributeMustProvideCompletion() {
4354
final String filePath = this.getFixturePath(ModuleWidgetXml.FILE_NAME);
4455
myFixture.copyFileToProject(filePath);
4556

4657
assertCompletionContains(filePath, LOOKUP_STRINGS_CHECK);
4758
}
4859

60+
/**
61+
* Test source model attribute match with the file positive case.
62+
*/
4963
public void testSourceModelXmlAttributeMatchWithFilePositiveCase() {
5064
final String filePath = this.getFixturePath(ModuleWidgetXml.FILE_NAME);
5165
myFixture.copyFileToProject(filePath);
5266

5367
assertFileContainsCompletions(filePath, LOOKUP_STRINGS_CHECK);
5468
}
5569

56-
public void testSourceModelXmlAttributeMatchWithFileNegativeCase() throws IOException {
70+
/**
71+
* Test source model attribute match with the file negative case.
72+
*/
73+
public void testSourceModelXmlAttributeMatchWithFileNegativeCase() {
5774
final String filePath = this.getFixturePath("not-widget.xml");
5875
myFixture.copyFileToProject(filePath);
5976

6077
assertFileNotContainsCompletions(
61-
filePath,
78+
filePath,
6279
LOOKUP_STRINGS_CHECK
6380
);
6481
}

0 commit comments

Comments
 (0)