Пример #1
0
 /**
  * @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);
 }
Пример #2
0
 /**
  * Set local instance of edge registrar.
  *
  * @param ConnectionRegistrar $registrar
  */
 public function setConnectionRegistrar(ConnectionRegistrar $registrar)
 {
     $this->connectionRegistrar = $registrar->setSchema($this);
 }