@@ 41-68 (lines=28) @@ | ||
38 | $this->responseMock = m::mock('\\Facebook\\FacebookResponse'); |
|
39 | } |
|
40 | ||
41 | public function testPagePropertiesReturnGraphPageObjects() |
|
42 | { |
|
43 | $dataFromGraph = [ |
|
44 | 'id' => '123', |
|
45 | 'name' => 'Foo Page', |
|
46 | 'best_page' => [ |
|
47 | 'id' => '1', |
|
48 | 'name' => 'Bar Page', |
|
49 | ], |
|
50 | 'global_brand_parent_page' => [ |
|
51 | 'id' => '2', |
|
52 | 'name' => 'Faz Page', |
|
53 | ], |
|
54 | ]; |
|
55 | ||
56 | $this->responseMock |
|
57 | ->shouldReceive('getDecodedBody') |
|
58 | ->once() |
|
59 | ->andReturn($dataFromGraph); |
|
60 | $factory = new GraphNodeFactory($this->responseMock); |
|
61 | $graphNode = $factory->makeGraphPage(); |
|
62 | ||
63 | $bestPage = $graphNode->getBestPage(); |
|
64 | $globalBrandParentPage = $graphNode->getGlobalBrandParentPage(); |
|
65 | ||
66 | $this->assertInstanceOf('\\Facebook\\GraphNodes\\GraphPage', $bestPage); |
|
67 | $this->assertInstanceOf('\\Facebook\\GraphNodes\\GraphPage', $globalBrandParentPage); |
|
68 | } |
|
69 | ||
70 | public function testLocationPropertyWillGetCastAsGraphLocationObject() |
|
71 | { |
@@ 124-151 (lines=28) @@ | ||
121 | $this->assertEquals('1984', $birthday->format('Y')); |
|
122 | } |
|
123 | ||
124 | public function testPagePropertiesWillGetCastAsGraphPageObjects() |
|
125 | { |
|
126 | $dataFromGraph = [ |
|
127 | 'id' => '123', |
|
128 | 'name' => 'Foo User', |
|
129 | 'hometown' => [ |
|
130 | 'id' => '1', |
|
131 | 'name' => 'Foo Place', |
|
132 | ], |
|
133 | 'location' => [ |
|
134 | 'id' => '2', |
|
135 | 'name' => 'Bar Place', |
|
136 | ], |
|
137 | ]; |
|
138 | ||
139 | $this->responseMock |
|
140 | ->shouldReceive('getDecodedBody') |
|
141 | ->once() |
|
142 | ->andReturn($dataFromGraph); |
|
143 | $factory = new GraphNodeFactory($this->responseMock); |
|
144 | $graphNode = $factory->makeGraphUser(); |
|
145 | ||
146 | $hometown = $graphNode->getHometown(); |
|
147 | $location = $graphNode->getLocation(); |
|
148 | ||
149 | $this->assertInstanceOf('\\Facebook\\GraphNodes\\GraphPage', $hometown); |
|
150 | $this->assertInstanceOf('\\Facebook\\GraphNodes\\GraphPage', $location); |
|
151 | } |
|
152 | ||
153 | public function testUserPropertiesWillGetCastAsGraphUserObjects() |
|
154 | { |