|
@@ 230-241 (lines=12) @@
|
| 227 |
|
* |
| 228 |
|
* @covers Automattic\Jetpack\Connection\Manager::is_user_connected |
| 229 |
|
*/ |
| 230 |
|
public function test_is_user_connected_with_default_user_id_logged_in() { |
| 231 |
|
$this->mock_function( 'get_current_user_id', 1 ); |
| 232 |
|
$access_token = (object) array( |
| 233 |
|
'secret' => 'abcd1234', |
| 234 |
|
'external_user_id' => 1, |
| 235 |
|
); |
| 236 |
|
$this->manager->expects( $this->once() ) |
| 237 |
|
->method( 'get_access_token' ) |
| 238 |
|
->will( $this->returnValue( $access_token ) ); |
| 239 |
|
|
| 240 |
|
$this->assertTrue( $this->manager->is_user_connected() ); |
| 241 |
|
} |
| 242 |
|
|
| 243 |
|
/** |
| 244 |
|
* Test the `is_user_connected` functionality. |
|
@@ 248-259 (lines=12) @@
|
| 245 |
|
* |
| 246 |
|
* @covers Automattic\Jetpack\Connection\Manager::is_user_connected |
| 247 |
|
*/ |
| 248 |
|
public function test_is_user_connected_with_user_id_logged_in() { |
| 249 |
|
$this->mock_function( 'absint', 1 ); |
| 250 |
|
$access_token = (object) array( |
| 251 |
|
'secret' => 'abcd1234', |
| 252 |
|
'external_user_id' => 1, |
| 253 |
|
); |
| 254 |
|
$this->manager->expects( $this->once() ) |
| 255 |
|
->method( 'get_access_token' ) |
| 256 |
|
->will( $this->returnValue( $access_token ) ); |
| 257 |
|
|
| 258 |
|
$this->assertTrue( $this->manager->is_user_connected( 1 ) ); |
| 259 |
|
} |
| 260 |
|
|
| 261 |
|
/** |
| 262 |
|
* Mock a global function and make it return a certain value. |