@@ 216-235 (lines=20) @@ | ||
213 | ], $graphData[1]); |
|
214 | } |
|
215 | ||
216 | public function testAGraphNodeWillBeCastAsAGraphNode() |
|
217 | { |
|
218 | $data = json_encode([ |
|
219 | 'id' => '123', |
|
220 | 'name' => 'Foo McBar', |
|
221 | 'link' => 'http://facebook/foo', |
|
222 | ]); |
|
223 | $res = new Response($this->request, $data); |
|
224 | ||
225 | $factory = new GraphNodeFactory($res); |
|
226 | $graphNode = $factory->makeGraphNode(); |
|
227 | $graphData = $graphNode->asArray(); |
|
228 | ||
229 | $this->assertInstanceOf(GraphNode::class, $graphNode); |
|
230 | $this->assertEquals([ |
|
231 | 'id' => '123', |
|
232 | 'name' => 'Foo McBar', |
|
233 | 'link' => 'http://facebook/foo', |
|
234 | ], $graphData); |
|
235 | } |
|
236 | ||
237 | public function testAGraphNodeWithARootDataKeyWillBeCastAsAGraphNode() |
|
238 | { |
|
@@ 237-259 (lines=23) @@ | ||
234 | ], $graphData); |
|
235 | } |
|
236 | ||
237 | public function testAGraphNodeWithARootDataKeyWillBeCastAsAGraphNode() |
|
238 | { |
|
239 | $data = json_encode([ |
|
240 | 'data' => [ |
|
241 | 'id' => '123', |
|
242 | 'name' => 'Foo McBar', |
|
243 | 'link' => 'http://facebook/foo', |
|
244 | ], |
|
245 | ]); |
|
246 | ||
247 | $res = new Response($this->request, $data); |
|
248 | ||
249 | $factory = new GraphNodeFactory($res); |
|
250 | $graphNode = $factory->makeGraphNode(); |
|
251 | $graphData = $graphNode->asArray(); |
|
252 | ||
253 | $this->assertInstanceOf(GraphNode::class, $graphNode); |
|
254 | $this->assertEquals([ |
|
255 | 'id' => '123', |
|
256 | 'name' => 'Foo McBar', |
|
257 | 'link' => 'http://facebook/foo', |
|
258 | ], $graphData); |
|
259 | } |
|
260 | ||
261 | public function testAGraphEdgeWillBeCastRecursively() |
|
262 | { |
@@ 57-76 (lines=20) @@ | ||
54 | ); |
|
55 | } |
|
56 | ||
57 | public function testAGraphNodeWillBeCastAsAGraphNode() |
|
58 | { |
|
59 | $data = json_encode([ |
|
60 | 'id' => '123', |
|
61 | 'name' => 'Foo McBar', |
|
62 | 'link' => 'http://facebook/foo', |
|
63 | ]); |
|
64 | $res = new Response($this->request, $data); |
|
65 | ||
66 | $factory = new GraphObjectFactory($res); |
|
67 | $graphObject = $factory->makeGraphObject(); |
|
68 | $graphData = $graphObject->asArray(); |
|
69 | ||
70 | $this->assertInstanceOf(GraphObject::class, $graphObject); |
|
71 | $this->assertEquals([ |
|
72 | 'id' => '123', |
|
73 | 'name' => 'Foo McBar', |
|
74 | 'link' => 'http://facebook/foo', |
|
75 | ], $graphData); |
|
76 | } |
|
77 | ||
78 | public function testAListFromGraphWillBeCastAsAGraphEdge() |
|
79 | { |