public function testConnectionDefinitions() { $nodeType = new ObjectType(['name' => 'test']); $config = ['nodeType' => $nodeType]; $this->assertEquals(Connection::connectionDefinitions($config), Relay::connectionDefinitions($config)); }
/** * We define a connection between a faction and its ships. * * connectionType implements the following type system shorthand: * type ShipConnection { * edges: [ShipEdge] * pageInfo: PageInfo! * } * * connectionType has an edges field - a list of edgeTypes that implement the * following type system shorthand: * type ShipEdge { * cursor: String! * node: Ship * } */ protected static function getShipConnection() { if (self::$shipConnection === null) { $shipType = self::getShipType(); $shipConnection = Relay::connectionDefinitions(['nodeType' => $shipType]); self::$shipConnection = $shipConnection; } return self::$shipConnection; }