Skip to content

Commit 2b92a49

Browse files
977: Code refactoring
1 parent 8a8c391 commit 2b92a49

File tree

3 files changed

+32
-31
lines changed

3 files changed

+32
-31
lines changed

src/com/magento/idea/magento2plugin/util/magento/GetMagentoModuleUtil.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616
import com.jetbrains.php.lang.psi.elements.impl.ClassConstImpl;
1717
import com.magento.idea.magento2plugin.magento.files.RegistrationPhp;
1818
import com.magento.idea.magento2plugin.magento.packages.ComponentType;
19-
import java.util.Collection;
20-
2119
import com.magento.idea.magento2plugin.magento.packages.Package;
20+
import java.util.Collection;
2221
import org.jetbrains.annotations.NotNull;
2322
import org.jetbrains.annotations.Nullable;
2423

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

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,30 @@
22
* Copyright © Magento, Inc. All rights reserved.
33
* See COPYING.txt for license details.
44
*/
5+
56
package com.magento.idea.magento2plugin.completion.xml;
67

78
import com.magento.idea.magento2plugin.magento.files.ModuleConfigXml;
89
import com.magento.idea.magento2plugin.magento.files.ModuleSystemXmlFile;
910

1011
public class BackendModelXmlCompletionRegistrarTest extends CompletionXmlFixtureTestCase {
1112

12-
private static final String[] systemXmlBackendModelLookupStringCheck = new String[]{
13+
private static final String[] SYSTEM_XML_BACKEND_MODEL_LOOKUP_STRING_CHECK = {
1314
"Magento\\Backend\\Model\\Source\\Roles"
1415
};
15-
private static final String[] configXmlBackendModelLookupStringCheck = new String[]{
16+
private static final String[] CONFIG_XML_BACKEND_MODEL_LOOKUP_STRING_CHECK = {
1617
"Magento\\Backend\\Model\\Source\\YesNo"
1718
};
1819

1920
public void testSystemXmlElementProvideCompletion() {
20-
String filePath = this.getFixturePath(ModuleSystemXmlFile.FILE_NAME);
21+
final String filePath = this.getFixturePath(ModuleSystemXmlFile.FILE_NAME);
2122
myFixture.configureByFile(filePath);
2223

23-
assertCompletionContains(filePath, systemXmlBackendModelLookupStringCheck);
24+
assertCompletionContains(filePath, SYSTEM_XML_BACKEND_MODEL_LOOKUP_STRING_CHECK);
2425
}
2526

2627
public void testSystemXmlElementCompletionWontShow() {
27-
String filePath = this.getFixturePath(
28+
final String filePath = this.getFixturePath(
2829
ModuleSystemXmlFile.FILE_NAME
2930
);
3031
myFixture.copyFileToProject(filePath);
@@ -33,35 +34,35 @@ public void testSystemXmlElementCompletionWontShow() {
3334
}
3435

3536
public void testSystemXmlBackendModelAttributeMatchWithFile() {
36-
String filePath = this.getFixturePath(
37+
final String filePath = this.getFixturePath(
3738
ModuleSystemXmlFile.FILE_NAME
3839
);
3940

40-
assertFileContainsCompletions(filePath, systemXmlBackendModelLookupStringCheck);
41+
assertFileContainsCompletions(filePath, SYSTEM_XML_BACKEND_MODEL_LOOKUP_STRING_CHECK);
4142
}
4243

4344
public void testSystemXmlBackendModelAttributeDontMatchWithFile() {
44-
String filePath = this.getFixturePath(
45+
final String filePath = this.getFixturePath(
4546
"other-file-than-system.xml"
4647
);
4748

4849
assertFileNotContainsCompletions(
4950
filePath,
50-
systemXmlBackendModelLookupStringCheck
51+
SYSTEM_XML_BACKEND_MODEL_LOOKUP_STRING_CHECK
5152
);
5253
}
5354

5455
public void testConfigXmlElementProvideCompletion() {
55-
String filePath = this.getFixturePath(
56+
final String filePath = this.getFixturePath(
5657
ModuleConfigXml.FILE_NAME
5758
);
5859
myFixture.copyFileToProject(filePath);
5960

60-
assertCompletionContains(filePath, configXmlBackendModelLookupStringCheck);
61+
assertCompletionContains(filePath, CONFIG_XML_BACKEND_MODEL_LOOKUP_STRING_CHECK);
6162
}
6263

6364
public void testConfigXmlElementCompletionWontShow() {
64-
String filePath = this.getFixturePath(
65+
final String filePath = this.getFixturePath(
6566
ModuleConfigXml.FILE_NAME
6667
);
6768
myFixture.copyFileToProject(filePath);
@@ -70,21 +71,21 @@ public void testConfigXmlElementCompletionWontShow() {
7071
}
7172

7273
public void testConfigXmlBackendModelAttributeMatchWithFile() {
73-
String filePath = this.getFixturePath(
74+
final String filePath = this.getFixturePath(
7475
ModuleConfigXml.FILE_NAME
7576
);
7677

77-
assertFileContainsCompletions(filePath, configXmlBackendModelLookupStringCheck);
78+
assertFileContainsCompletions(filePath, CONFIG_XML_BACKEND_MODEL_LOOKUP_STRING_CHECK);
7879
}
7980

8081
public void testConfigXmlBackendModelAttributeDontMatchWithFile() {
81-
String filePath = this.getFixturePath(
82+
final String filePath = this.getFixturePath(
8283
"other-file-than-config.xml"
8384
);
8485

8586
assertFileNotContainsCompletions(
8687
filePath,
87-
configXmlBackendModelLookupStringCheck
88+
CONFIG_XML_BACKEND_MODEL_LOOKUP_STRING_CHECK
8889
);
8990
}
9091
}

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

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Copyright © Magento, Inc. All rights reserved.
33
* See COPYING.txt for license details.
44
*/
5+
56
package com.magento.idea.magento2plugin.completion.xml;
67

78
import com.magento.idea.magento2plugin.magento.files.ModuleSystemXmlFile;
@@ -10,55 +11,55 @@
1011

1112
public class SourceModelXmlCompletionRegistrarTest extends CompletionXmlFixtureTestCase {
1213

13-
private static final String[] lookupStringsCheck = new String[]{
14+
private static final String[] LOOKUP_STRINGS_CHECK = {
1415
"Magento\\Backend\\Model\\Source\\YesNo"
1516
};
1617

1718
public void testSourceModelXmlElementMustProvideCompletion() {
18-
String filePath = this.getFixturePath(ModuleSystemXmlFile.FILE_NAME);
19+
final String filePath = this.getFixturePath(ModuleSystemXmlFile.FILE_NAME);
1920
myFixture.copyFileToProject(filePath);
2021

21-
assertCompletionContains(filePath, lookupStringsCheck);
22+
assertCompletionContains(filePath, LOOKUP_STRINGS_CHECK);
2223
}
2324

2425
public void testSourceModelXmlElementMatchWithFilePositiveCase() {
25-
String filePath = this.getFixturePath(ModuleSystemXmlFile.FILE_NAME);
26+
final String filePath = this.getFixturePath(ModuleSystemXmlFile.FILE_NAME);
2627
myFixture.copyFileToProject(filePath);
2728

28-
assertFileContainsCompletions(filePath, lookupStringsCheck);
29+
assertFileContainsCompletions(filePath, LOOKUP_STRINGS_CHECK);
2930
}
3031

3132
public void testSourceModelXmlElementMatchWithFileNegativeCase() {
32-
String filePath = this.getFixturePath("not-system.xml");
33+
final String filePath = this.getFixturePath("not-system.xml");
3334
myFixture.copyFileToProject(filePath);
3435

3536
assertFileNotContainsCompletions(
3637
filePath,
37-
lookupStringsCheck
38+
LOOKUP_STRINGS_CHECK
3839
);
3940
}
4041

4142
public void testSourceModelXmlAttributeMustProvideCompletion() {
42-
String filePath = this.getFixturePath(ModuleWidgetXml.FILE_NAME);
43+
final String filePath = this.getFixturePath(ModuleWidgetXml.FILE_NAME);
4344
myFixture.copyFileToProject(filePath);
4445

45-
assertCompletionContains(filePath, lookupStringsCheck);
46+
assertCompletionContains(filePath, LOOKUP_STRINGS_CHECK);
4647
}
4748

4849
public void testSourceModelXmlAttributeMatchWithFilePositiveCase() {
49-
String filePath = this.getFixturePath(ModuleWidgetXml.FILE_NAME);
50+
final String filePath = this.getFixturePath(ModuleWidgetXml.FILE_NAME);
5051
myFixture.copyFileToProject(filePath);
5152

52-
assertFileContainsCompletions(filePath, lookupStringsCheck);
53+
assertFileContainsCompletions(filePath, LOOKUP_STRINGS_CHECK);
5354
}
5455

5556
public void testSourceModelXmlAttributeMatchWithFileNegativeCase() throws IOException {
56-
String filePath = this.getFixturePath("not-widget.xml");
57+
final String filePath = this.getFixturePath("not-widget.xml");
5758
myFixture.copyFileToProject(filePath);
5859

5960
assertFileNotContainsCompletions(
6061
filePath,
61-
lookupStringsCheck
62+
LOOKUP_STRINGS_CHECK
6263
);
6364
}
6465
}

0 commit comments

Comments
 (0)