@@ 178-189 (lines=12) @@ | ||
175 | /** |
|
176 | * @covers Automattic\Jetpack\Connection\Manager::is_user_connected |
|
177 | */ |
|
178 | public function test_is_user_connected_with_default_user_id_logged_in() { |
|
179 | $this->mock_function( 'get_current_user_id', 1 ); |
|
180 | $access_token = (object) [ |
|
181 | 'secret' => 'abcd1234', |
|
182 | 'external_user_id' => 1, |
|
183 | ]; |
|
184 | $this->manager->expects( $this->once() ) |
|
185 | ->method( 'get_access_token' ) |
|
186 | ->will( $this->returnValue( $access_token ) ); |
|
187 | ||
188 | $this->assertTrue( $this->manager->is_user_connected() ); |
|
189 | } |
|
190 | ||
191 | /** |
|
192 | * @covers Automattic\Jetpack\Connection\Manager::is_user_connected |
|
@@ 194-205 (lines=12) @@ | ||
191 | /** |
|
192 | * @covers Automattic\Jetpack\Connection\Manager::is_user_connected |
|
193 | */ |
|
194 | public function test_is_user_connected_with_user_id_logged_in() { |
|
195 | $this->mock_function( 'absint', 1 ); |
|
196 | $access_token = (object) [ |
|
197 | 'secret' => 'abcd1234', |
|
198 | 'external_user_id' => 1, |
|
199 | ]; |
|
200 | $this->manager->expects( $this->once() ) |
|
201 | ->method( 'get_access_token' ) |
|
202 | ->will( $this->returnValue( $access_token ) ); |
|
203 | ||
204 | $this->assertTrue( $this->manager->is_user_connected( 1 ) ); |
|
205 | } |
|
206 | ||
207 | /** |
|
208 | * Mock a global function and make it return a certain value. |