/** * @test */ public function itCanRetrieveConnectionInstanceFromRegistrar() { $this->typeRegistrar->register('user', UserType::class); $this->typeRegistrar->register('pageInfo', PageInfoType::class); $connectionField = $this->registrar->instance('user'); $connectionType = $connectionField['type']; $this->assertInstanceof(ObjectType::class, $connectionType); $this->assertEquals('UserConnection', $connectionType->name); $this->assertContains('pageInfo', array_keys($connectionType->config['fields'])); $this->assertContains('edges', array_keys($connectionType->config['fields'])); $edge = $this->edgeRegistrar->instance('user'); $this->assertInstanceOf(ObjectType::class, $edge); $this->assertEquals('UserEdge', $edge->name); }
/** * Set local instance of edge registrar. * * @param EdgeRegistrar $registrar */ public function setEdgeRegistrar(EdgeRegistrar $registrar) { $this->edgeRegistrar = $registrar->setSchema($this); }