File tree Expand file tree Collapse file tree 3 files changed +65
-0
lines changed
testData/inspections/php/GraphQlResolverInspection
withInvalidResolverInterface
withValidResolverInterface
tests/com/magento/idea/magento2plugin/inspections/php Expand file tree Collapse file tree 3 files changed +65
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+ namespace Magento \Test ;
7
+ use Magento \Framework \GraphQl \Query \InvalidInterface ;
8
+ class <error descr="Class must implements \Magento\Framework\GraphQl\Query\ResolverInterface">InvalidResolverTest</error> implements InvalidInterface
9
+ {
10
+ }
11
+ ?>
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+ namespace Magento \Test ;
7
+ class ValidResolverTest implements \Magento \Framework \GraphQl \Query \ResolverInterface
8
+ {
9
+ }
10
+ ?>
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright © Magento, Inc. All rights reserved.
3
+ * See COPYING.txt for license details.
4
+ */
5
+ package com .magento .idea .magento2plugin .inspections .php ;
6
+
7
+ import com .intellij .testFramework .fixtures .BasePlatformTestCase ;
8
+ import java .io .File ;
9
+
10
+ public class GraphQlResolverInspectionTest extends BasePlatformTestCase {
11
+
12
+ @ Override
13
+ public void setUp () throws Exception {
14
+ super .setUp ();
15
+ myFixture .enableInspections (GraphQlResolverInspection .class );
16
+ }
17
+
18
+ @ Override
19
+ protected String getTestDataPath () {
20
+ return new File ("testData/inspections/php/"
21
+ + getClass ().getSimpleName ().replace ("Test" , "" )).getAbsolutePath ();
22
+ }
23
+
24
+ @ Override
25
+ protected boolean isWriteActionRequired () {
26
+ return false ;
27
+ }
28
+
29
+ public void testWithInvalidResolverInterface () throws Exception {
30
+ myFixture .addFileToProject (getTestDataPath () + "/" + "schema.graphqls" , "type Query {" +
31
+ "InvalidResolverTest: InvalidResolver @resolver(class: \" \\ \\ Magento\\ \\ Test\\ \\ InvalidResolverTest\" )" +
32
+ "}" );
33
+ myFixture .configureByFile (getTestName (true ) + "/" + "InvalidResolverTest.php" );
34
+ myFixture .checkHighlighting ();
35
+ }
36
+
37
+ public void testWithValidResolverInterface () throws Exception {
38
+ myFixture .addFileToProject (getTestDataPath () + "/" + "schema.graphqls" , "type mutation {" +
39
+ " ValidResolverTest(): ValidResolver @resolver(class: \" \\ \\ Magento\\ \\ Test\\ \\ ValidResolverTest\" )" +
40
+ "}" );
41
+ myFixture .configureByFile (getTestName (true ) + "/" + "ValidResolverTest.php" );
42
+ myFixture .checkHighlighting ();
43
+ }
44
+ }
You can’t perform that action at this time.
0 commit comments