GraphQL\Tests\Executor\DirectivesTest::testWorksOnInlineFragment PHP Method

testWorksOnInlineFragment() public method

    public function testWorksOnInlineFragment()
    {
        // if false omits inline fragment
        $q = '
        query Q {
          a
          ... on TestType @include(if: false) {
            b
          }
        }
        ';
        $this->assertEquals(['data' => ['a' => 'a']], $this->executeTestQuery($q));
        // if true includes inline fragment
        $q = '
        query Q {
          a
          ... on TestType @include(if: true) {
            b
          }
        }
        ';
        $this->assertEquals(['data' => ['a' => 'a', 'b' => 'b']], $this->executeTestQuery($q));
        // unless false includes inline fragment
        $q = '
        query Q {
          a
          ... on TestType @skip(if: false) {
            b
          }
        }
        ';
        $this->assertEquals(['data' => ['a' => 'a', 'b' => 'b']], $this->executeTestQuery($q));
        // unless true includes inline fragment
        $q = '
        query Q {
          a
          ... on TestType @skip(if: true) {
            b
          }
        }
        ';
        $this->assertEquals(['data' => ['a' => 'a']], $this->executeTestQuery($q));
    }