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