new ObjectType( [ 'name' => 'Query', 'fields' => [ 'sayHi' => [ 'type' => Type::nonNull(Type::string()), 'args' => [ 'name' => [ 'type' => Type::nonNull(Type::string()), ], ], 'resolve' => static function ($rootValue, $args) use ($promiseAdapter) { return $promiseAdapter->createFulfilled(sprintf('Hi %s!', $args['name'])); }, ], ], ] ), ] ); $promise = GraphQL::promiseToExecute($promiseAdapter, $schema, '{ sayHi(name: "John") }'); $result = $promiseAdapter->wait($promise); self::assertSame(['data' => ['sayHi' => 'Hi John!']], $result->toArray()); } }