[ 'lazyInterface' => ['name' => 'testname'], ], ]; $this->assertEquals($expected, Executor::execute($this->schema, Parser::parse($request))->toArray()); } /** * Setup schema */ protected function setUp() { $query = new ObjectType([ 'name' => 'query', 'fields' => function () { return [ 'lazyInterface' => [ 'type' => $this->getLazyInterfaceType(), 'resolve' => function () { return []; }, ], ]; }, ]); $this->schema = new Schema(['query' => $query, 'types' => [$this->getTestObjectType()]]); } /** * Returns the LazyInterface * * @return InterfaceType */ protected function getLazyInterfaceType() { if (! $this->lazyInterface) { $this->lazyInterface = new InterfaceType([ 'name' => 'LazyInterface', 'fields' => [ 'a' => Type::string(), ], 'resolveType' => function () { return $this->getTestObjectType(); }, ]); } return $this->lazyInterface; } /** * Returns the test ObjectType * @return ObjectType */ protected function getTestObjectType() { if (! $this->testObject) { $this->testObject = new ObjectType([ 'name' => 'TestObject', 'fields' => [ 'name' => [ 'type' => Type::string(), 'resolve' => function () { return 'testname'; }, ], ], 'interfaces' => [$this->getLazyInterfaceType()], ]); } return $this->testObject; } }