/**
  * @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);
 }
 /**
  * @test
  */
 public function itThrowsExceptionWhenUnregisteredTypeIsRequested()
 {
     $this->registrar->register('user', UserType::class);
     $this->setExpectedException(GraphQLTypeInstanceNotFound::class);
     $this->registrar->instance('foo');
 }
 /**
  * Set local instance of type registrar.
  *
  * @param TypeRegistrar $registrar
  */
 public function setTypeRegistrar(TypeRegistrar $registrar)
 {
     $this->typeRegistrar = $registrar->setSchema($this);
 }