@@ 241-252 (lines=12) @@ | ||
238 | * |
|
239 | * @covers Automattic\Jetpack\Connection\Manager::is_user_connected |
|
240 | */ |
|
241 | public function test_is_user_connected_with_default_user_id_logged_in() { |
|
242 | $this->mock_function( 'get_current_user_id', 1 ); |
|
243 | $access_token = (object) array( |
|
244 | 'secret' => 'abcd1234', |
|
245 | 'external_user_id' => 1, |
|
246 | ); |
|
247 | $this->manager->expects( $this->once() ) |
|
248 | ->method( 'get_access_token' ) |
|
249 | ->will( $this->returnValue( $access_token ) ); |
|
250 | ||
251 | $this->assertTrue( $this->manager->is_user_connected() ); |
|
252 | } |
|
253 | ||
254 | /** |
|
255 | * Test the `is_user_connected` functionality. |
|
@@ 259-270 (lines=12) @@ | ||
256 | * |
|
257 | * @covers Automattic\Jetpack\Connection\Manager::is_user_connected |
|
258 | */ |
|
259 | public function test_is_user_connected_with_user_id_logged_in() { |
|
260 | $this->mock_function( 'absint', 1 ); |
|
261 | $access_token = (object) array( |
|
262 | 'secret' => 'abcd1234', |
|
263 | 'external_user_id' => 1, |
|
264 | ); |
|
265 | $this->manager->expects( $this->once() ) |
|
266 | ->method( 'get_access_token' ) |
|
267 | ->will( $this->returnValue( $access_token ) ); |
|
268 | ||
269 | $this->assertTrue( $this->manager->is_user_connected( 1 ) ); |
|
270 | } |
|
271 | ||
272 | /** |
|
273 | * Unit test for the "Delete all tokens" functionality. |