Youshido\Tests\Library\Type\InputObjectTypeTest::testListInsideInputObject PHP Метод

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

    public function testListInsideInputObject()
    {
        $processor = new Processor(new Schema(['query' => new ObjectType(['name' => 'RootQueryType', 'fields' => ['empty' => ['type' => new StringType(), 'resolve' => function () {
        }]]]), 'mutation' => new ObjectType(['name' => 'RootMutation', 'fields' => ['createList' => ['type' => new StringType(), 'args' => ['topArgument' => new InputObjectType(['name' => 'topArgument', 'fields' => ['postObject' => new ListType(new InputObjectType(['name' => 'postObject', 'fields' => ['title' => new NonNullType(new StringType())]]))]])], 'resolve' => function () {
            return 'success message';
        }]]])]));
        $processor->processPayload('mutation { createList(topArgument: { postObject:[ { title: null } ] })}');
        $this->assertEquals(['data' => ['createList' => null], 'errors' => [['message' => 'Not valid type for argument "topArgument" in query "createList"', 'locations' => [['line' => 1, 'column' => 23]]]]], $processor->getResponseData());
        $processor->getExecutionContext()->clearErrors();
        $processor->processPayload('mutation { createList(topArgument:{
                                        postObject:[{title: "not empty"}] })}');
        $this->assertEquals(['data' => ['createList' => 'success message']], $processor->getResponseData());
    }