Code Duplication    Length = 8-8 lines in 6 locations

projects/plugins/jetpack/_inc/lib/debugger/class-jetpack-cxn-tests.php 6 locations

@@ 219-226 (lines=8) @@
216
	protected function test__blog_token_if_exists() {
217
		$name = __FUNCTION__;
218
219
		if ( ! $this->helper_is_jetpack_connected() ) {
220
			return self::skipped_test(
221
				array(
222
					'name'              => $name,
223
					'short_description' => __( 'Jetpack is not connected. No blog token to check.', 'jetpack' ),
224
				)
225
			);
226
		}
227
		$blog_token = $this->helper_get_blog_token();
228
229
		if ( $blog_token ) {
@@ 246-253 (lines=8) @@
243
	protected function test__check_if_connected() {
244
		$name = __FUNCTION__;
245
246
		if ( ! $this->helper_get_blog_token() ) {
247
			return self::skipped_test(
248
				array(
249
					'name'              => $name,
250
					'short_description' => __( 'Blog token is missing.', 'jetpack' ),
251
				)
252
			);
253
		}
254
255
		if ( $this->helper_is_jetpack_connected() ) {
256
			$result = self::passing_test(
@@ 293-300 (lines=8) @@
290
	 */
291
	protected function test__master_user_exists_on_site() {
292
		$name = __FUNCTION__;
293
		if ( ! $this->helper_is_jetpack_connected() ) {
294
			return self::skipped_test(
295
				array(
296
					'name'              => $name,
297
					'short_description' => __( 'Jetpack is not connected. No master user to check.', 'jetpack' ),
298
				)
299
			);
300
		}
301
		if ( ! ( new Connection_Manager() )->get_connection_owner_id() && ( new Status() )->is_no_user_testing_mode() ) {
302
			return self::skipped_test(
303
				array(
@@ 331-338 (lines=8) @@
328
	 */
329
	protected function test__master_user_can_manage_options() {
330
		$name = __FUNCTION__;
331
		if ( ! $this->helper_is_jetpack_connected() ) {
332
			return self::skipped_test(
333
				array(
334
					'name'              => $name,
335
					'short_description' => __( 'Jetpack is not connected.', 'jetpack' ),
336
				)
337
			);
338
		}
339
		if ( ! ( new Connection_Manager() )->get_connection_owner_id() && ( new Status() )->is_no_user_testing_mode() ) {
340
			return self::skipped_test(
341
				array(
@@ 443-450 (lines=8) @@
440
	 */
441
	protected function test__identity_crisis() {
442
		$name = __FUNCTION__;
443
		if ( ! $this->helper_is_jetpack_connected() ) {
444
			return self::skipped_test(
445
				array(
446
					'name'              => $name,
447
					'short_description' => __( 'Jetpack is not connected.', 'jetpack' ),
448
				)
449
			);
450
		}
451
		$identity_crisis = Jetpack::check_identity_crisis();
452
453
		if ( ! $identity_crisis ) {
@@ 618-625 (lines=8) @@
615
			);
616
		}
617
618
		if ( 404 === wp_remote_retrieve_response_code( $response ) ) {
619
			return self::skipped_test(
620
				array(
621
					'name'              => $name,
622
					'short_description' => __( 'The WordPress.com API returned a 404 error.', 'jetpack' ),
623
				)
624
			);
625
		}
626
627
		$result       = json_decode( $body );
628
		$is_connected = ! empty( $result->connected );