@@ 65-85 (lines=21) @@ | ||
62 | $this->assertInstanceOf('DateTime', $updatedTime); |
|
63 | } |
|
64 | ||
65 | public function testFromGetsCastAsGraphUser() |
|
66 | { |
|
67 | $dataFromGraph = [ |
|
68 | 'id' => '123', |
|
69 | 'from' => [ |
|
70 | 'id' => '1337', |
|
71 | 'name' => 'Foo McBar', |
|
72 | ], |
|
73 | ]; |
|
74 | ||
75 | $this->responseMock |
|
76 | ->shouldReceive('getDecodedBody') |
|
77 | ->once() |
|
78 | ->andReturn($dataFromGraph); |
|
79 | $factory = new GraphNodeFactory($this->responseMock); |
|
80 | $graphNode = $factory->makeGraphAlbum(); |
|
81 | ||
82 | $from = $graphNode->getFrom(); |
|
83 | ||
84 | $this->assertInstanceOf('\\Facebook\\GraphNodes\\GraphUser', $from); |
|
85 | } |
|
86 | ||
87 | public function testPlacePropertyWillGetCastAsGraphPageObject() |
|
88 | { |
|
@@ 87-108 (lines=22) @@ | ||
84 | $this->assertInstanceOf('\\Facebook\\GraphNodes\\GraphUser', $from); |
|
85 | } |
|
86 | ||
87 | public function testPlacePropertyWillGetCastAsGraphPageObject() |
|
88 | { |
|
89 | $dataFromGraph = [ |
|
90 | 'id' => '123', |
|
91 | 'name' => 'Foo Album', |
|
92 | 'place' => [ |
|
93 | 'id' => '1', |
|
94 | 'name' => 'For Bar Place', |
|
95 | ] |
|
96 | ]; |
|
97 | ||
98 | $this->responseMock |
|
99 | ->shouldReceive('getDecodedBody') |
|
100 | ->once() |
|
101 | ->andReturn($dataFromGraph); |
|
102 | $factory = new GraphNodeFactory($this->responseMock); |
|
103 | $graphNode = $factory->makeGraphAlbum(); |
|
104 | ||
105 | $place = $graphNode->getPlace(); |
|
106 | ||
107 | $this->assertInstanceOf('\\Facebook\\GraphNodes\\GraphPage', $place); |
|
108 | } |
|
109 | } |
|
110 |
@@ 153-174 (lines=22) @@ | ||
150 | $this->assertInstanceOf('\\Facebook\\GraphNodes\\GraphPage', $location); |
|
151 | } |
|
152 | ||
153 | public function testUserPropertiesWillGetCastAsGraphUserObjects() |
|
154 | { |
|
155 | $dataFromGraph = [ |
|
156 | 'id' => '123', |
|
157 | 'name' => 'Foo User', |
|
158 | 'significant_other' => [ |
|
159 | 'id' => '1337', |
|
160 | 'name' => 'Bar User', |
|
161 | ], |
|
162 | ]; |
|
163 | ||
164 | $this->responseMock |
|
165 | ->shouldReceive('getDecodedBody') |
|
166 | ->once() |
|
167 | ->andReturn($dataFromGraph); |
|
168 | $factory = new GraphNodeFactory($this->responseMock); |
|
169 | $graphNode = $factory->makeGraphUser(); |
|
170 | ||
171 | $significantOther = $graphNode->getSignificantOther(); |
|
172 | ||
173 | $this->assertInstanceOf('\\Facebook\\GraphNodes\\GraphUser', $significantOther); |
|
174 | } |
|
175 | ||
176 | public function testPicturePropertiesWillGetCastAsGraphPictureObjects() |
|
177 | { |