@@ 76-113 (lines=38) @@ | ||
73 | ], $graphData); |
|
74 | } |
|
75 | ||
76 | public function testAListFromGraphWillBeCastAsAGraphEdge() |
|
77 | { |
|
78 | $data = json_encode([ |
|
79 | 'data' => [ |
|
80 | [ |
|
81 | 'id' => '123', |
|
82 | 'name' => 'Foo McBar', |
|
83 | 'link' => 'http://facebook/foo', |
|
84 | ], |
|
85 | [ |
|
86 | 'id' => '1337', |
|
87 | 'name' => 'Bar McBaz', |
|
88 | 'link' => 'http://facebook/bar', |
|
89 | ], |
|
90 | ], |
|
91 | 'paging' => [ |
|
92 | 'next' => 'http://facebook/next', |
|
93 | 'previous' => 'http://facebook/prev', |
|
94 | ], |
|
95 | ]); |
|
96 | $res = new FacebookResponse($this->request, $data); |
|
97 | ||
98 | $factory = new GraphObjectFactory($res); |
|
99 | $graphList = $factory->makeGraphList(); |
|
100 | $graphData = $graphList->asArray(); |
|
101 | ||
102 | $this->assertInstanceOf('\Facebook\GraphNodes\GraphList', $graphList); |
|
103 | $this->assertEquals([ |
|
104 | 'id' => '123', |
|
105 | 'name' => 'Foo McBar', |
|
106 | 'link' => 'http://facebook/foo', |
|
107 | ], $graphData[0]); |
|
108 | $this->assertEquals([ |
|
109 | 'id' => '1337', |
|
110 | 'name' => 'Bar McBaz', |
|
111 | 'link' => 'http://facebook/bar', |
|
112 | ], $graphData[1]); |
|
113 | } |
|
114 | } |
|
115 |
@@ 166-203 (lines=38) @@ | ||
163 | $this->assertNotInstanceOf('\Facebook\Tests\Fixtures\MyFooGraphNode', $unknownObject); |
|
164 | } |
|
165 | ||
166 | public function testAListFromGraphWillBeCastAsAGraphEdge() |
|
167 | { |
|
168 | $data = json_encode([ |
|
169 | 'data' => [ |
|
170 | [ |
|
171 | 'id' => '123', |
|
172 | 'name' => 'Foo McBar', |
|
173 | 'link' => 'http://facebook/foo', |
|
174 | ], |
|
175 | [ |
|
176 | 'id' => '1337', |
|
177 | 'name' => 'Bar McBaz', |
|
178 | 'link' => 'http://facebook/bar', |
|
179 | ], |
|
180 | ], |
|
181 | 'paging' => [ |
|
182 | 'next' => 'http://facebook/next', |
|
183 | 'previous' => 'http://facebook/prev', |
|
184 | ], |
|
185 | ]); |
|
186 | $res = new FacebookResponse($this->request, $data); |
|
187 | ||
188 | $factory = new GraphNodeFactory($res); |
|
189 | $graphEdge = $factory->makeGraphEdge(); |
|
190 | $graphData = $graphEdge->asArray(); |
|
191 | ||
192 | $this->assertInstanceOf('\Facebook\GraphNodes\GraphEdge', $graphEdge); |
|
193 | $this->assertEquals([ |
|
194 | 'id' => '123', |
|
195 | 'name' => 'Foo McBar', |
|
196 | 'link' => 'http://facebook/foo', |
|
197 | ], $graphData[0]); |
|
198 | $this->assertEquals([ |
|
199 | 'id' => '1337', |
|
200 | 'name' => 'Bar McBaz', |
|
201 | 'link' => 'http://facebook/bar', |
|
202 | ], $graphData[1]); |
|
203 | } |
|
204 | ||
205 | public function testAGraphNodeWillBeCastAsAGraphNode() |
|
206 | { |