File tree Expand file tree Collapse file tree 4 files changed +82
-0
lines changed
testData/inspections/php/GraphQlResolverInspection
withInvalidResolverInterface
withValidResolverInterface
tests/com/magento/idea/magento2plugin/inspections/php Expand file tree Collapse file tree 4 files changed +82
-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+ public class GraphQlResolverInspectionTest extends InspectionPhpFixtureTestCase {
8+
9+ @ Override
10+ public void setUp () throws Exception {
11+ super .setUp ();
12+ myFixture .enableInspections (GraphQlResolverInspection .class );
13+ }
14+
15+ @ Override
16+ protected boolean isWriteActionRequired () {
17+ return false ;
18+ }
19+
20+ public void testWithInvalidResolverInterface () throws Exception {
21+ myFixture .addFileToProject ("schema.graphqls" , "type Query {" +
22+ "InvalidResolverTest: InvalidResolver @resolver(class: \" \\ \\ Magento\\ \\ Test\\ \\ InvalidResolverTest\" )" +
23+ "}" );
24+ myFixture .configureByFile (getFixturePath ("InvalidResolverTest.php" ));
25+ myFixture .checkHighlighting ();
26+ }
27+
28+ public void testWithValidResolverInterface () throws Exception {
29+ myFixture .addFileToProject ("schema.graphqls" , "type mutation {" +
30+ " ValidResolverTest(): ValidResolver @resolver(class: \" \\ \\ Magento\\ \\ Test\\ \\ ValidResolverTest\" )" +
31+ "}" );
32+ myFixture .configureByFile (getFixturePath ("ValidResolverTest.php" ));
33+ myFixture .checkHighlighting ();
34+ }
35+ }
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments