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