forked from magento/magento2-phpstorm-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPluginDeclarationInspectionTest.java
129 lines (114 loc) · 4.69 KB
/
PluginDeclarationInspectionTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
package com.magento.idea.magento2plugin.inspections.xml;
import com.magento.idea.magento2plugin.magento.files.ModuleDiXml;
import com.magento.idea.magento2plugin.magento.packages.Areas;
import com.magento.idea.magento2plugin.magento.packages.File;
import com.magento.idea.magento2plugin.magento.packages.Package;
@SuppressWarnings({"PMD.JUnitTestsShouldIncludeAssert"})
public class PluginDeclarationInspectionTest extends InspectionXmlFixtureTestCase {
@Override
public void setUp() throws Exception {
super.setUp();
myFixture.enableInspections(PluginDeclarationInspection.class);
}
private String getAreaPath(final String area) {
return Package.moduleBaseAreaDir
+ File.separator
+ Areas.getAreaByString(area)
+ File.separator
+ ModuleDiXml.FILE_NAME;
}
/**
* Tests the plugin name duplication warning won't show in the di.xml file
*/
public void testPluginNameDuplicationWarningWontShow() {
myFixture.configureByFile(getFixturePath(ModuleDiXml.FILE_NAME));
myFixture.testHighlighting(true, false, false);
}
/**
* Tests warning for disabling of non-existing plugin.
*/
public void testDisabledNonExistingPlugin() {
myFixture.configureByFile(getFixturePath(ModuleDiXml.FILE_NAME));
myFixture.testHighlighting(true, false, false);
}
/**
* Tests whenever the duplication warning shows when the plugin name already
* defined in the same di.xml file
*/
public void testPluginNameUsedInSameFile() {
myFixture.configureByFile(getFixturePath(ModuleDiXml.FILE_NAME));
myFixture.testHighlighting(true, false, false);
}
/**
* Tests whenever the duplication warning occurs for a
* plugin name declared in the frontend area
* that is already defined in the frontend module
* area (Vendor/Module/etc/frontend/di.xml)
*/
public void testPluginNameAlreadyUsedInFrontendArea() {
myFixture.configureByFile(getFixturePath(getAreaPath("frontend")));
myFixture.testHighlighting(true, false, false);
}
/**
* Tests whenever the duplication warning occurs for
* a plugin name declared in the adminhtml area
* that is already defined in the adminhtml module area
* (Vendor/Module/etc/adminhtml/di.xml)
*/
public void testPluginNameAlreadyUsedInAdminhtmlArea() {
myFixture.configureByFile(getFixturePath(getAreaPath("adminhtml")));
myFixture.testHighlighting(true, false, false);
}
/**
* Tests whenever the duplication warning occurs for a plugin name
* that is already defined in the global module area (Vendor/Module/etc/di.xml)
*/
public void testPluginNameAlreadyUsedInGlobalArea() {
myFixture.configureByFile(getFixturePath(ModuleDiXml.FILE_NAME));
myFixture.testHighlighting(true, false, false);
}
/**
* Tests whenever the duplication warning occurs for
* a plugin name declared in the webapi_rest area
* that is already defined in the webapi_rest module
* area (Vendor/Module/etc/webapi_rest/di.xml)
*/
public void testPluginNameAlreadyUsedInWebApiRestArea() {
myFixture.configureByFile(getFixturePath(this.getAreaPath("webapi_rest")));
myFixture.testHighlighting(true, false, false);
}
/**
* Tests whenever the duplication warning occurs for
* a plugin name declared in the webapi_soap area
* that is already defined in the webapi_soap
* module area (Vendor/Module/etc/webapi_soap/di.xml)
*/
public void testPluginNameAlreadyUsedInWebApiSoapArea() {
myFixture.configureByFile(getFixturePath(getAreaPath("webapi_soap")));
myFixture.testHighlighting(true, false, false);
}
/**
* Tests whenever the duplication warning occurs for
* a plugin name declared in the graphql area
* that is already defined in the graphql module
* area (Vendor/Module/etc/graphql/di.xml)
*/
public void testPluginNameAlreadyUsedInGraphqlArea() {
myFixture.configureByFile(getFixturePath(getAreaPath("graphql")));
myFixture.testHighlighting(true, false, false);
}
/**
* Tests whenever the duplication warning occurs for
* a plugin name declared in the crontab area
* that is already defined in the crontab module
* area (Vendor/Module/etc/crontab/di.xml)
*/
public void testPluginNameAlreadyUsedInCrontabArea() {
myFixture.configureByFile(getFixturePath(getAreaPath("crontab")));
myFixture.testHighlighting(true, false, false);
}
}