Code Duplication    Length = 14-14 lines in 2 locations

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

@@ 426-439 (lines=14) @@
423
	 *
424
	 * @return array
425
	 */
426
	public function intercept_refresh_blog_token_request( $response, $args, $url ) {
427
		if ( false === strpos( $url, 'jetpack-refresh-blog-token' ) ) {
428
			return $response;
429
		}
430
431
		return array(
432
			'headers'  => new Requests_Utility_CaseInsensitiveDictionary( array( 'content-type' => 'application/json' ) ),
433
			'body'     => wp_json_encode( array( 'jetpack_secret' => self::BLOG_TOKEN ) ),
434
			'response' => array(
435
				'code'    => 200,
436
				'message' => 'OK',
437
			),
438
		);
439
	}
440
441
	/**
442
	 * Intercept the `jetpack-refresh-blog-token` API request sent to WP.com, and mock the failure response.
@@ 450-463 (lines=14) @@
447
	 *
448
	 * @return array
449
	 */
450
	public function intercept_refresh_blog_token_request_fail( $response, $args, $url ) {
451
		if ( false === strpos( $url, 'jetpack-refresh-blog-token' ) ) {
452
			return $response;
453
		}
454
455
		return array(
456
			'headers'  => new Requests_Utility_CaseInsensitiveDictionary( array( 'content-type' => 'application/json' ) ),
457
			'body'     => wp_json_encode( array( 'jetpack_secret_missing' => true ) ), // Meaningless body.
458
			'response' => array(
459
				'code'    => 200,
460
				'message' => 'OK',
461
			),
462
		);
463
	}
464
465
	/**
466
	 * Intercept the `jetpack-token-health` API request sent to WP.com, and mock the "invalid blog token" response.