Code Duplication    Length = 27-27 lines in 2 locations

projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-callables.php 2 locations

@@ 488-514 (lines=27) @@
485
		$this->assertEquals( $original_site_url, $this->server_replica_storage->get_callable( 'site_url' ) );
486
	}
487
488
	function test_sync_limited_set_of_callables_if_cron() {
489
		$all_callables = array_keys( Defaults::get_callable_whitelist() );
490
		$always_updated = Callables::ALWAYS_SEND_UPDATES_TO_THESE_OPTIONS;
491
492
		foreach ( $always_updated as $key => $option ) {
493
			if ( array_key_exists( $option, Callables::OPTION_NAMES_TO_CALLABLE_NAMES ) ) {
494
				$always_updated[ $key ] = Callables::OPTION_NAMES_TO_CALLABLE_NAMES[ $option ];
495
			}
496
497
		}
498
499
		// non-admin
500
		set_current_screen( 'front' );
501
		Settings::set_doing_cron( true );
502
503
		$this->sender->do_sync();
504
505
		foreach ( $all_callables as $callable ) {
506
			if ( in_array( $callable, $always_updated, true ) ) {
507
				$this->assertNotNull( $this->server_replica_storage->get_callable( $callable ) );
508
			} else {
509
				$this->assertEquals( null, $this->server_replica_storage->get_callable( $callable ) );
510
			}
511
		}
512
513
		Settings::set_doing_cron( false );
514
	}
515
516
	function test_sync_limited_set_of_callables_if_wp_cli() {
517
		$all_callables = array_keys( Defaults::get_callable_whitelist() );
@@ 516-542 (lines=27) @@
513
		Settings::set_doing_cron( false );
514
	}
515
516
	function test_sync_limited_set_of_callables_if_wp_cli() {
517
		$all_callables = array_keys( Defaults::get_callable_whitelist() );
518
		$always_updated = Callables::ALWAYS_SEND_UPDATES_TO_THESE_OPTIONS;
519
520
		foreach ( $always_updated as $key => $option ) {
521
			if ( array_key_exists( $option, Callables::OPTION_NAMES_TO_CALLABLE_NAMES ) ) {
522
				$always_updated[ $key ] = Callables::OPTION_NAMES_TO_CALLABLE_NAMES[ $option ];
523
			}
524
525
		}
526
527
		// non-admin
528
		set_current_screen( 'front' );
529
		Constants::set_constant( 'WP_CLI', true );
530
531
		$this->sender->do_sync();
532
533
		foreach ( $all_callables as $callable ) {
534
			if ( in_array( $callable, $always_updated, true ) ) {
535
				$this->assertNotNull( $this->server_replica_storage->get_callable( $callable ) );
536
			} else {
537
				$this->assertEquals( null, $this->server_replica_storage->get_callable( $callable ) );
538
			}
539
		}
540
541
		Constants::set_constant( 'WP_CLI', false );
542
	}
543
544
	function test_site_icon_url_returns_false_when_no_site_icon() {
545
		delete_option( 'jetpack_site_icon_url' );