Code Duplication    Length = 13-13 lines in 2 locations

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

@@ 252-264 (lines=13) @@
249
	/**
250
	 * Testing the `connection/reconnect` endpoint, successful partial reconnect (blog token).
251
	 */
252
	public function test_connection_reconnect_partial_blog_token_success() {
253
		$this->setup_reconnect_test( 'blog_token' );
254
		add_filter( 'pre_http_request', array( $this, 'intercept_refresh_blog_token_request' ), 10, 3 );
255
256
		$response = $this->server->dispatch( $this->build_reconnect_request() );
257
		$data     = $response->get_data();
258
259
		remove_filter( 'pre_http_request', array( $this, 'intercept_refresh_blog_token_request' ), 10 );
260
		$this->shutdown_reconnect_test( 'blog_token' );
261
262
		$this->assertEquals( 200, $response->get_status() );
263
		$this->assertEquals( 'completed', $data['status'] );
264
	}
265
266
	/**
267
	 * Testing the `connection/reconnect` endpoint, failed partial reconnect (blog token).
@@ 269-281 (lines=13) @@
266
	/**
267
	 * Testing the `connection/reconnect` endpoint, failed partial reconnect (blog token).
268
	 */
269
	public function test_connection_reconnect_partial_blog_token_fail() {
270
		$this->setup_reconnect_test( 'blog_token' );
271
		add_filter( 'pre_http_request', array( $this, 'intercept_refresh_blog_token_request_fail' ), 10, 3 );
272
273
		$response = $this->server->dispatch( $this->build_reconnect_request() );
274
		$data     = $response->get_data();
275
276
		remove_filter( 'pre_http_request', array( $this, 'intercept_refresh_blog_token_request_fail' ), 10 );
277
		$this->shutdown_reconnect_test( 'blog_token' );
278
279
		$this->assertEquals( 500, $response->get_status() );
280
		$this->assertEquals( 'jetpack_secret', $data['code'] );
281
	}
282
283
	/**
284
	 * Testing the `connection/reconnect` endpoint, successful partial reconnect (user token).