|
@@ 85-96 (lines=12) @@
|
| 82 |
|
/** |
| 83 |
|
* @covers Automattic\Jetpack\Connection\Manager::is_user_connected |
| 84 |
|
*/ |
| 85 |
|
public function test_is_user_connected_with_default_user_id_logged_in() { |
| 86 |
|
$this->mock_function( 'get_current_user_id', 1 ); |
| 87 |
|
$access_token = (object) [ |
| 88 |
|
'secret' => 'abcd1234', |
| 89 |
|
'external_user_id' => 1, |
| 90 |
|
]; |
| 91 |
|
$this->manager->expects( $this->once() ) |
| 92 |
|
->method( 'get_access_token' ) |
| 93 |
|
->will( $this->returnValue( $access_token ) ); |
| 94 |
|
|
| 95 |
|
$this->assertTrue( $this->manager->is_user_connected() ); |
| 96 |
|
} |
| 97 |
|
|
| 98 |
|
/** |
| 99 |
|
* @covers Automattic\Jetpack\Connection\Manager::is_user_connected |
|
@@ 101-112 (lines=12) @@
|
| 98 |
|
/** |
| 99 |
|
* @covers Automattic\Jetpack\Connection\Manager::is_user_connected |
| 100 |
|
*/ |
| 101 |
|
public function test_is_user_connected_with_user_id_logged_in() { |
| 102 |
|
$this->mock_function( 'absint', 1 ); |
| 103 |
|
$access_token = (object) [ |
| 104 |
|
'secret' => 'abcd1234', |
| 105 |
|
'external_user_id' => 1, |
| 106 |
|
]; |
| 107 |
|
$this->manager->expects( $this->once() ) |
| 108 |
|
->method( 'get_access_token' ) |
| 109 |
|
->will( $this->returnValue( $access_token ) ); |
| 110 |
|
|
| 111 |
|
$this->assertTrue( $this->manager->is_user_connected( 1 ) ); |
| 112 |
|
} |
| 113 |
|
|
| 114 |
|
/** |
| 115 |
|
* Mock a global function and make it return a certain value. |