Code Duplication    Length = 14-14 lines in 2 locations

packages/connection/tests/php/test-rest-endpoints.php 2 locations

@@ 373-386 (lines=14) @@
370
	 *
371
	 * @return array
372
	 */
373
	public function intercept_refresh_blog_token_request( $response, $args, $url ) {
374
		if ( false === strpos( $url, 'jetpack-refresh-blog-token' ) ) {
375
			return $response;
376
		}
377
378
		return array(
379
			'headers'  => new Requests_Utility_CaseInsensitiveDictionary( array( 'content-type' => 'application/json' ) ),
380
			'body'     => wp_json_encode( array( 'jetpack_secret' => self::BLOG_TOKEN ) ),
381
			'response' => array(
382
				'code'    => 200,
383
				'message' => 'OK',
384
			),
385
		);
386
	}
387
388
	/**
389
	 * Intercept the `jetpack-refresh-blog-token` API request sent to WP.com, and mock the failure response.
@@ 397-410 (lines=14) @@
394
	 *
395
	 * @return array
396
	 */
397
	public function intercept_refresh_blog_token_request_fail( $response, $args, $url ) {
398
		if ( false === strpos( $url, 'jetpack-refresh-blog-token' ) ) {
399
			return $response;
400
		}
401
402
		return array(
403
			'headers'  => new Requests_Utility_CaseInsensitiveDictionary( array( 'content-type' => 'application/json' ) ),
404
			'body'     => wp_json_encode( array( 'jetpack_secret_missing' => true ) ), // Meaningless body.
405
			'response' => array(
406
				'code'    => 200,
407
				'message' => 'OK',
408
			),
409
		);
410
	}
411
412
	/**
413
	 * Intercept the `Jetpack_Options` call to get `blog_id`, and set a random value.