|
@@ 166-177 (lines=12) @@
|
| 163 |
|
/** |
| 164 |
|
* @covers Automattic\Jetpack\Connection\Manager::is_user_connected |
| 165 |
|
*/ |
| 166 |
|
public function test_is_user_connected_with_default_user_id_logged_in() { |
| 167 |
|
$this->mock_function( 'get_current_user_id', 1 ); |
| 168 |
|
$access_token = (object) [ |
| 169 |
|
'secret' => 'abcd1234', |
| 170 |
|
'external_user_id' => 1, |
| 171 |
|
]; |
| 172 |
|
$this->manager->expects( $this->once() ) |
| 173 |
|
->method( 'get_access_token' ) |
| 174 |
|
->will( $this->returnValue( $access_token ) ); |
| 175 |
|
|
| 176 |
|
$this->assertTrue( $this->manager->is_user_connected() ); |
| 177 |
|
} |
| 178 |
|
|
| 179 |
|
/** |
| 180 |
|
* @covers Automattic\Jetpack\Connection\Manager::is_user_connected |
|
@@ 182-193 (lines=12) @@
|
| 179 |
|
/** |
| 180 |
|
* @covers Automattic\Jetpack\Connection\Manager::is_user_connected |
| 181 |
|
*/ |
| 182 |
|
public function test_is_user_connected_with_user_id_logged_in() { |
| 183 |
|
$this->mock_function( 'absint', 1 ); |
| 184 |
|
$access_token = (object) [ |
| 185 |
|
'secret' => 'abcd1234', |
| 186 |
|
'external_user_id' => 1, |
| 187 |
|
]; |
| 188 |
|
$this->manager->expects( $this->once() ) |
| 189 |
|
->method( 'get_access_token' ) |
| 190 |
|
->will( $this->returnValue( $access_token ) ); |
| 191 |
|
|
| 192 |
|
$this->assertTrue( $this->manager->is_user_connected( 1 ) ); |
| 193 |
|
} |
| 194 |
|
|
| 195 |
|
/** |
| 196 |
|
* Mock a global function and make it return a certain value. |