Code Duplication    Length = 27-27 lines in 2 locations

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

@@ 510-536 (lines=27) @@
507
		$this->assertEquals( $original_site_url, $this->server_replica_storage->get_callable( 'site_url' ) );
508
	}
509
510
	function test_sync_limited_set_of_callables_if_cron() {
511
		$all_callables = array_keys( Defaults::get_callable_whitelist() );
512
		$always_updated = Callables::ALWAYS_SEND_UPDATES_TO_THESE_OPTIONS;
513
514
		foreach ( $always_updated as $key => $option ) {
515
			if ( array_key_exists( $option, Callables::OPTION_NAMES_TO_CALLABLE_NAMES ) ) {
516
				$always_updated[ $key ] = Callables::OPTION_NAMES_TO_CALLABLE_NAMES[ $option ];
517
			}
518
519
		}
520
521
		// non-admin
522
		set_current_screen( 'front' );
523
		Settings::set_doing_cron( true );
524
525
		$this->sender->do_sync();
526
527
		foreach ( $all_callables as $callable ) {
528
			if ( in_array( $callable, $always_updated, true ) ) {
529
				$this->assertNotNull( $this->server_replica_storage->get_callable( $callable ) );
530
			} else {
531
				$this->assertEquals( null, $this->server_replica_storage->get_callable( $callable ) );
532
			}
533
		}
534
535
		Settings::set_doing_cron( false );
536
	}
537
538
	function test_sync_limited_set_of_callables_if_wp_cli() {
539
		$all_callables = array_keys( Defaults::get_callable_whitelist() );
@@ 538-564 (lines=27) @@
535
		Settings::set_doing_cron( false );
536
	}
537
538
	function test_sync_limited_set_of_callables_if_wp_cli() {
539
		$all_callables = array_keys( Defaults::get_callable_whitelist() );
540
		$always_updated = Callables::ALWAYS_SEND_UPDATES_TO_THESE_OPTIONS;
541
542
		foreach ( $always_updated as $key => $option ) {
543
			if ( array_key_exists( $option, Callables::OPTION_NAMES_TO_CALLABLE_NAMES ) ) {
544
				$always_updated[ $key ] = Callables::OPTION_NAMES_TO_CALLABLE_NAMES[ $option ];
545
			}
546
547
		}
548
549
		// non-admin
550
		set_current_screen( 'front' );
551
		Constants::set_constant( 'WP_CLI', true );
552
553
		$this->sender->do_sync();
554
555
		foreach ( $all_callables as $callable ) {
556
			if ( in_array( $callable, $always_updated, true ) ) {
557
				$this->assertNotNull( $this->server_replica_storage->get_callable( $callable ) );
558
			} else {
559
				$this->assertEquals( null, $this->server_replica_storage->get_callable( $callable ) );
560
			}
561
		}
562
563
		Constants::set_constant( 'WP_CLI', false );
564
	}
565
566
	function test_site_icon_url_returns_false_when_no_site_icon() {
567
		delete_option( 'jetpack_site_icon_url' );