| @@ 573-592 (lines=20) @@ | ||
| 570 | * |
|
| 571 | * @return array |
|
| 572 | */ |
|
| 573 | public function intercept_auth_token_request( $response, $args, $url ) { |
|
| 574 | if ( false === strpos( $url, '/jetpack.token/' ) ) { |
|
| 575 | return $response; |
|
| 576 | } |
|
| 577 | ||
| 578 | return array( |
|
| 579 | 'headers' => new Requests_Utility_CaseInsensitiveDictionary( array( 'content-type' => 'application/json' ) ), |
|
| 580 | 'body' => wp_json_encode( |
|
| 581 | array( |
|
| 582 | 'access_token' => 'mock.token', |
|
| 583 | 'token_type' => 'X_JETPACK', |
|
| 584 | 'scope' => ( new Manager() )->sign_role( 'administrator' ), |
|
| 585 | ) |
|
| 586 | ), |
|
| 587 | 'response' => array( |
|
| 588 | 'code' => 200, |
|
| 589 | 'message' => 'OK', |
|
| 590 | ), |
|
| 591 | ); |
|
| 592 | } |
|
| 593 | ||
| 594 | /** |
|
| 595 | * Intercept the `Jetpack_Options` call and mock the values. |
|
| @@ 186-205 (lines=20) @@ | ||
| 183 | * |
|
| 184 | * @return array |
|
| 185 | */ |
|
| 186 | public function intercept_auth_token_request( $response, $args, $url ) { |
|
| 187 | if ( false === strpos( $url, '/jetpack.token/' ) ) { |
|
| 188 | return $response; |
|
| 189 | } |
|
| 190 | ||
| 191 | return array( |
|
| 192 | 'headers' => new Requests_Utility_CaseInsensitiveDictionary( array( 'content-type' => 'application/json' ) ), |
|
| 193 | 'body' => wp_json_encode( |
|
| 194 | array( |
|
| 195 | 'access_token' => 'mock.token', |
|
| 196 | 'token_type' => 'X_JETPACK', |
|
| 197 | 'scope' => ( new Manager() )->sign_role( 'administrator' ), |
|
| 198 | ) |
|
| 199 | ), |
|
| 200 | 'response' => array( |
|
| 201 | 'code' => 200, |
|
| 202 | 'message' => 'OK', |
|
| 203 | ), |
|
| 204 | ); |
|
| 205 | } |
|
| 206 | ||
| 207 | /** |
|
| 208 | * Intercept the `Jetpack_Options` call and mock the values. |
|