|
@@ 109-120 (lines=12) @@
|
| 106 |
|
/** |
| 107 |
|
* @covers Automattic\Jetpack\Connection\Manager::is_user_connected |
| 108 |
|
*/ |
| 109 |
|
public function test_is_user_connected_with_default_user_id_logged_in() { |
| 110 |
|
$this->mock_function( 'get_current_user_id', 1 ); |
| 111 |
|
$access_token = (object) [ |
| 112 |
|
'secret' => 'abcd1234', |
| 113 |
|
'external_user_id' => 1, |
| 114 |
|
]; |
| 115 |
|
$this->manager->expects( $this->once() ) |
| 116 |
|
->method( 'get_access_token' ) |
| 117 |
|
->will( $this->returnValue( $access_token ) ); |
| 118 |
|
|
| 119 |
|
$this->assertTrue( $this->manager->is_user_connected() ); |
| 120 |
|
} |
| 121 |
|
|
| 122 |
|
/** |
| 123 |
|
* @covers Automattic\Jetpack\Connection\Manager::is_user_connected |
|
@@ 125-136 (lines=12) @@
|
| 122 |
|
/** |
| 123 |
|
* @covers Automattic\Jetpack\Connection\Manager::is_user_connected |
| 124 |
|
*/ |
| 125 |
|
public function test_is_user_connected_with_user_id_logged_in() { |
| 126 |
|
$this->mock_function( 'absint', 1 ); |
| 127 |
|
$access_token = (object) [ |
| 128 |
|
'secret' => 'abcd1234', |
| 129 |
|
'external_user_id' => 1, |
| 130 |
|
]; |
| 131 |
|
$this->manager->expects( $this->once() ) |
| 132 |
|
->method( 'get_access_token' ) |
| 133 |
|
->will( $this->returnValue( $access_token ) ); |
| 134 |
|
|
| 135 |
|
$this->assertTrue( $this->manager->is_user_connected( 1 ) ); |
| 136 |
|
} |
| 137 |
|
|
| 138 |
|
/** |
| 139 |
|
* Mock a global function and make it return a certain value. |