GraphQL\Tests\Language\VisitorTest::testAllowsForEditingOnEnter PHP Method

testAllowsForEditingOnEnter() public method

    public function testAllowsForEditingOnEnter()
    {
        $ast = Parser::parse('{ a, b, c { a, b, c } }', ['noLocation' => true]);
        $editedAst = Visitor::visit($ast, ['enter' => function ($node) {
            if ($node instanceof FieldNode && $node->name->value === 'b') {
                return Visitor::removeNode();
            }
        }]);
        $this->assertEquals(Parser::parse('{ a, b, c { a, b, c } }', ['noLocation' => true]), $ast);
        $this->assertEquals(Parser::parse('{ a,    c { a,    c } }', ['noLocation' => true]), $editedAst);
    }