Skip to content

Commit 0021f42

Browse files
author
SilinMykola
committed
1105 fixes after a CR
1 parent 26b4206 commit 0021f42

File tree

5 files changed

+27
-63
lines changed

5 files changed

+27
-63
lines changed

src/com/magento/idea/magento2plugin/actions/context/xml/NewGraphQLSchemaAction.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import com.intellij.psi.PsiDirectory;
1010
import com.intellij.psi.PsiFile;
1111
import com.magento.idea.magento2plugin.actions.context.AbstractContextAction;
12-
import com.magento.idea.magento2plugin.magento.files.GraphQLSchema;
12+
import com.magento.idea.magento2plugin.magento.files.SchemaGraphQLsFile;
1313
import com.magento.idea.magento2plugin.magento.packages.ComponentType;
1414
import com.magento.idea.magento2plugin.magento.packages.Package;
1515
import com.magento.idea.magento2plugin.util.magento.GetMagentoModuleUtil;
@@ -25,7 +25,7 @@ public class NewGraphQLSchemaAction extends AbstractContextAction {
2525
* New schema.graphqls file action constructor.
2626
*/
2727
public NewGraphQLSchemaAction() {
28-
super(ACTION_NAME, ACTION_DESCRIPTION, GraphQLSchema.getInstance());
28+
super(ACTION_NAME, ACTION_DESCRIPTION, SchemaGraphQLsFile.getInstance());
2929
}
3030

3131
@Override

src/com/magento/idea/magento2plugin/actions/generation/generator/GraphQLSchemaGenerator.java

-49
This file was deleted.

src/com/magento/idea/magento2plugin/actions/generation/generator/util/FindOrCreateGraphQLSchema.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
import com.intellij.psi.PsiDirectory;
1010
import com.intellij.psi.PsiFile;
1111
import com.magento.idea.magento2plugin.indexes.ModuleIndex;
12-
import com.magento.idea.magento2plugin.magento.files.GraphQLSchema;
1312
import com.magento.idea.magento2plugin.magento.files.ModuleFileInterface;
13+
import com.magento.idea.magento2plugin.magento.files.SchemaGraphQLsFile;
1414
import com.magento.idea.magento2plugin.magento.packages.Areas;
1515
import com.magento.idea.magento2plugin.magento.packages.Package;
1616
import com.magento.idea.magento2plugin.util.magento.FileBasedIndexUtil;
@@ -44,7 +44,7 @@ public PsiFile execute(final String actionName, final String moduleName) {
4444
new FileFromTemplateGenerator(project);
4545
parentDirectory = directoryGenerator
4646
.findOrCreateSubdirectory(parentDirectory, Package.moduleBaseAreaDir);
47-
final GraphQLSchema graphQlSchemaFile = GraphQLSchema.getInstance();
47+
final SchemaGraphQLsFile graphQlSchemaFile = SchemaGraphQLsFile.getInstance();
4848
PsiFile graphQlSchema = FileBasedIndexUtil.findModuleConfigFile(
4949
graphQlSchemaFile.getFileName(),
5050
Areas.getAreaByString(Areas.base.name()),

src/com/magento/idea/magento2plugin/magento/files/GraphQLSchema.java src/com/magento/idea/magento2plugin/magento/files/SchemaGraphQLsFile.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66
package com.magento.idea.magento2plugin.magento.files;
77

88
import com.intellij.lang.Language;
9-
import com.jetbrains.php.lang.PhpLanguage;
9+
import com.intellij.lang.jsgraphql.GraphQLLanguage;
1010

11-
public class GraphQLSchema implements ModuleFileInterface {
11+
public class SchemaGraphQLsFile implements ModuleFileInterface {
1212

1313
public static final String FILE_NAME = "schema.graphqls";
1414

1515
public static final String TEMPLATE = "Magento GraphQL Schema";
16-
private static final GraphQLSchema INSTANCE = new GraphQLSchema();
16+
private static final SchemaGraphQLsFile INSTANCE = new SchemaGraphQLsFile();
1717

18-
public static GraphQLSchema getInstance() {
18+
public static SchemaGraphQLsFile getInstance() {
1919
return INSTANCE;
2020
}
2121

@@ -31,6 +31,6 @@ public String getTemplate() {
3131

3232
@Override
3333
public Language getLanguage() {
34-
return PhpLanguage.INSTANCE;
34+
return GraphQLLanguage.INSTANCE;
3535
}
3636
}

tests/com/magento/idea/magento2plugin/inspections/graphqls/SchemaResolverInspectionTest.java

+18-5
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
* Copyright © Magento, Inc. All rights reserved.
33
* See COPYING.txt for license details.
44
*/
5+
56
package com.magento.idea.magento2plugin.inspections.graphqls;
67

7-
import com.magento.idea.magento2plugin.magento.files.GraphQLSchema;
8+
import com.magento.idea.magento2plugin.magento.files.SchemaGraphQLsFile;
89

910
public class SchemaResolverInspectionTest extends InspectionGraphqlsFixtureTestCase {
1011

@@ -22,24 +23,36 @@ protected boolean isWriteActionRequired() {
2223
return false;
2324
}
2425

26+
/**
27+
* Inspection with valid schema resolver.
28+
*/
2529
public void testWithValidSchemaResolverInterface() throws Exception {
26-
myFixture.configureByFile(getFixturePath(GraphQLSchema.FILE_NAME));
30+
myFixture.configureByFile(getFixturePath(SchemaGraphQLsFile.FILE_NAME));
2731
assertHasNoHighlighting(errorMessage);
2832
}
2933

34+
/**
35+
* Inspection with invalid schema resolver.
36+
*/
3037
public void testWithInvalidSchemaResolverInterface() throws Exception {
31-
myFixture.configureByFile(getFixturePath(GraphQLSchema.FILE_NAME));
38+
myFixture.configureByFile(getFixturePath(SchemaGraphQLsFile.FILE_NAME));
3239
assertHasHighlighting(errorMessage);
3340
}
3441

42+
/**
43+
* Inspection with valid batch resolver.
44+
*/
3545
public void testWithValidBatchResolverInterface() throws Exception {
36-
myFixture.configureByFile(getFixturePath(GraphQLSchema.FILE_NAME));
46+
myFixture.configureByFile(getFixturePath(SchemaGraphQLsFile.FILE_NAME));
3747

3848
assertHasNoHighlighting(errorMessage);
3949
}
4050

51+
/**
52+
* Inspection with valid batch service contract resolver.
53+
*/
4154
public void testWithValidBatchServiceContractResolverInterface() throws Exception {
42-
myFixture.configureByFile(getFixturePath(GraphQLSchema.FILE_NAME));
55+
myFixture.configureByFile(getFixturePath(SchemaGraphQLsFile.FILE_NAME));
4356

4457
assertHasNoHighlighting(errorMessage);
4558
}

0 commit comments

Comments
 (0)