|
@@ 79-89 (lines=11) @@
|
| 76 |
|
* |
| 77 |
|
* @covers Automattic\Jetpack\Connection\Manager::is_active |
| 78 |
|
*/ |
| 79 |
|
public function test_is_active_when_connected() { |
| 80 |
|
$access_token = (object) array( |
| 81 |
|
'secret' => 'abcd1234', |
| 82 |
|
'external_user_id' => 1, |
| 83 |
|
); |
| 84 |
|
$this->tokens->expects( $this->once() ) |
| 85 |
|
->method( 'get_access_token' ) |
| 86 |
|
->will( $this->returnValue( $access_token ) ); |
| 87 |
|
|
| 88 |
|
$this->assertTrue( $this->manager->is_active() ); |
| 89 |
|
} |
| 90 |
|
|
| 91 |
|
/** |
| 92 |
|
* Test the `is_active` functionality when not connected. |
|
@@ 207-219 (lines=13) @@
|
| 204 |
|
* |
| 205 |
|
* @covers Automattic\Jetpack\Connection\Manager::is_user_connected |
| 206 |
|
*/ |
| 207 |
|
public function test_is_user_connected_with_default_user_id_logged_in() { |
| 208 |
|
wp_set_current_user( $this->user_id ); |
| 209 |
|
|
| 210 |
|
$access_token = (object) array( |
| 211 |
|
'secret' => 'abcd1234', |
| 212 |
|
'external_user_id' => 1, |
| 213 |
|
); |
| 214 |
|
$this->tokens->expects( $this->once() ) |
| 215 |
|
->method( 'get_access_token' ) |
| 216 |
|
->will( $this->returnValue( $access_token ) ); |
| 217 |
|
|
| 218 |
|
$this->assertTrue( $this->manager->is_user_connected() ); |
| 219 |
|
} |
| 220 |
|
|
| 221 |
|
/** |
| 222 |
|
* Test the `is_user_connected` functionality. |
|
@@ 226-236 (lines=11) @@
|
| 223 |
|
* |
| 224 |
|
* @covers Automattic\Jetpack\Connection\Manager::is_user_connected |
| 225 |
|
*/ |
| 226 |
|
public function test_is_user_connected_with_user_id_logged_in() { |
| 227 |
|
$access_token = (object) array( |
| 228 |
|
'secret' => 'abcd1234', |
| 229 |
|
'external_user_id' => 1, |
| 230 |
|
); |
| 231 |
|
$this->tokens->expects( $this->once() ) |
| 232 |
|
->method( 'get_access_token' ) |
| 233 |
|
->will( $this->returnValue( $access_token ) ); |
| 234 |
|
|
| 235 |
|
$this->assertTrue( $this->manager->is_user_connected( $this->user_id ) ); |
| 236 |
|
} |
| 237 |
|
|
| 238 |
|
/** |
| 239 |
|
* Unit test for the "Delete all tokens" functionality. |