Skip to content

Commit 56a4104

Browse files
Feedback changes
1 parent 674b10a commit 56a4104

File tree

2 files changed

+31
-14
lines changed

2 files changed

+31
-14
lines changed

tests/com/magento/idea/magento2plugin/inspections/php/GraphQlResolverInspectionTest.java

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,32 @@
44
*/
55
package com.magento.idea.magento2plugin.inspections.php;
66

7-
import com.intellij.testFramework.fixtures.BasePlatformTestCase;
8-
import java.io.File;
9-
10-
public class GraphQlResolverInspectionTest extends BasePlatformTestCase {
7+
public class GraphQlResolverInspectionTest extends InspectionPhpFixtureTestCase {
118

129
@Override
1310
public void setUp() throws Exception {
1411
super.setUp();
1512
myFixture.enableInspections(GraphQlResolverInspection.class);
1613
}
1714

18-
@Override
19-
protected String getTestDataPath() {
20-
return new File("testData/inspections/php/"
21-
+ getClass().getSimpleName().replace("Test", "")).getAbsolutePath();
22-
}
23-
2415
@Override
2516
protected boolean isWriteActionRequired() {
2617
return false;
2718
}
2819

2920
public void testWithInvalidResolverInterface() throws Exception {
30-
myFixture.addFileToProject(getTestDataPath() + "/withInvalidResolverInterface/" + "schema.graphqls", "type Query {" +
21+
myFixture.addFileToProject("schema.graphqls", "type Query {" +
3122
"InvalidResolverTest: InvalidResolver @resolver(class: \"\\\\Magento\\\\Test\\\\InvalidResolverTest\")" +
3223
"}");
33-
myFixture.configureByFile(getTestName(true) + "/" + "InvalidResolverTest.php");
24+
myFixture.configureByFile(getFixturePath("InvalidResolverTest.php"));
3425
myFixture.checkHighlighting();
3526
}
3627

3728
public void testWithValidResolverInterface() throws Exception {
38-
myFixture.addFileToProject(getTestDataPath() + "/withValidResolverInterface/" + "schema.graphqls", "type mutation {" +
29+
myFixture.addFileToProject("schema.graphqls", "type mutation {" +
3930
" ValidResolverTest(): ValidResolver @resolver(class: \"\\\\Magento\\\\Test\\\\ValidResolverTest\")" +
4031
"}");
41-
myFixture.configureByFile(getTestName(true) + "/" + "ValidResolverTest.php");
32+
myFixture.configureByFile(getFixturePath("ValidResolverTest.php"));
4233
myFixture.checkHighlighting();
4334
}
4435
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.magento.idea.magento2plugin.inspections.php;
2+
3+
import com.magento.idea.magento2plugin.BaseProjectTestCase;
4+
5+
import java.io.File;
6+
7+
abstract public class InspectionPhpFixtureTestCase extends BaseProjectTestCase {
8+
9+
private static final String testDataFolderPath = "testData" + File.separator + "inspections" + File.separator;
10+
private static final String fixturesFolderPath = "php" + File.separator;
11+
12+
@Override
13+
protected void setUp() throws Exception {
14+
super.setUp();
15+
myFixture.setTestDataPath(testDataFolderPath);
16+
}
17+
18+
@Override
19+
protected boolean isWriteActionRequired() {
20+
return false;
21+
}
22+
23+
protected String getFixturePath(String fileName) {
24+
return prepareFixturePath(fileName, fixturesFolderPath);
25+
}
26+
}

0 commit comments

Comments
 (0)