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