GraphQL\Tests\Language\VisitorTest::testAllowsForEditingOnLeave PHP Метод

testAllowsForEditingOnLeave() публичный Метод

    public function testAllowsForEditingOnLeave()
    {
        $ast = Parser::parse('{ a, b, c { a, b, c } }', ['noLocation' => true]);
        $editedAst = Visitor::visit($ast, ['leave' => 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);
    }