File tree 3 files changed +34
-3
lines changed
src/com/magento/idea/magento2plugin/inspections/xml
testData/inspections/xml/ModuleDeclarationInModuleXmlInspection/setupVersionNotErrorMessageInEditableModule/app/code/Test/TestModule/etc
tests/com/magento/idea/magento2plugin/inspections/xml
3 files changed +34
-3
lines changed Original file line number Diff line number Diff line change 28
28
29
29
public class ModuleDeclarationInModuleXmlInspection extends XmlSuppressableInspectionTool {
30
30
31
- private static final String MODULE_NAME = "name" ;
32
-
33
31
@ NotNull
34
32
@ Override
35
33
public PsiElementVisitor buildVisitor (
@@ -58,7 +56,7 @@ public void visitXmlAttributeValue(final XmlAttributeValue value) {
58
56
}
59
57
60
58
final String attributeName = XmlAttributeValuePattern .getLocalName (value );
61
- if (attributeName != null && attributeName .equals (MODULE_NAME )) {
59
+ if (attributeName != null && attributeName .equals (ModuleXml . MODULE_ATTR_NAME )) {
62
60
final String expectedName
63
61
= GetEditableModuleNameByRootFileUtil .execute (etcDirectory );
64
62
final String actualName = value .getValue ();
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" ?>
2
+ <!--
3
+ /**
4
+ * Copyright © Magento, Inc. All rights reserved.
5
+ * See COPYING.txt for license details.
6
+ */
7
+ -->
8
+ <config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
9
+ xsi : noNamespaceSchemaLocation =" urn:magento:framework:Module/etc/module.xsd" >
10
+ <module name =" Test_TestModule" setup_version =" 1.0.0" />
11
+ </config >
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ public class ModuleDeclarationInModuleXmlInspectionTest
13
13
private static final String MESSAGE_ID =
14
14
"inspection.moduleDeclaration.warning.wrongModuleName" ;
15
15
private static final String WRONG_MODULE_NAME = "Wrong_ModuleName" ;
16
+ private static final String SETUP_VERSION_ATTRIBUTE_VALUE = "1.0.0" ;
16
17
17
18
@ Override
18
19
public void setUp () throws Exception {
@@ -46,6 +47,27 @@ public void testWrongDeclarationInEditableModule() {
46
47
assertHasHighlighting (errorMessage );
47
48
}
48
49
50
+ /**
51
+ * Inspection do not highlight wrong module name warning for setup version attribute.
52
+ */
53
+ public void testSetupVersionNotErrorMessageInEditableModule () {
54
+ final Settings settings = Settings .getInstance (myFixture .getProject ());
55
+ settings .magentoPath =
56
+ "/src/xml/ModuleDeclarationInModuleXmlInspection/"
57
+ + "setupVersionNotErrorMessageInEditableModule" ;
58
+ myFixture .configureByFile (
59
+ getFixturePath ("app/code/Test/TestModule/etc/" + ModuleXml .FILE_NAME )
60
+ );
61
+
62
+ final String errorMessage = inspectionBundle .message (
63
+ MESSAGE_ID ,
64
+ SETUP_VERSION_ATTRIBUTE_VALUE ,
65
+ "Test_TestModule"
66
+ );
67
+
68
+ assertHasNoHighlighting (errorMessage );
69
+ }
70
+
49
71
/**
50
72
* Inspection skips sub tags.
51
73
*/
You can’t perform that action at this time.
0 commit comments