Code Duplication    Length = 14-14 lines in 2 locations

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

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