Tests: Correct sidebar names for Twenty Twenty.

See #48110.

git-svn-id: https://develop.svn.wordpress.org/trunk@46282 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2019-09-23 22:03:53 +00:00
parent 03fdd659bf
commit bb41a65acd
2 changed files with 10 additions and 10 deletions

View File

@ -1777,8 +1777,8 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase {
$old_sidebars_widgets = get_option( 'sidebars_widgets' ); $old_sidebars_widgets = get_option( 'sidebars_widgets' );
$new_sidebars_widgets = $old_sidebars_widgets; $new_sidebars_widgets = $old_sidebars_widgets;
$this->assertGreaterThan( 2, count( $new_sidebars_widgets['sidebar-1'] ) ); $this->assertGreaterThan( 2, count( $new_sidebars_widgets['footer-one'] ) );
$new_sidebar_1 = array_reverse( $new_sidebars_widgets['sidebar-1'] ); $new_sidebar_1 = array_reverse( $new_sidebars_widgets['footer-one'] );
$post_id = $this->factory()->post->create( $post_id = $this->factory()->post->create(
array( array(
@ -1787,7 +1787,7 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase {
'post_name' => wp_generate_uuid4(), 'post_name' => wp_generate_uuid4(),
'post_content' => wp_json_encode( 'post_content' => wp_json_encode(
array( array(
'sidebars_widgets[sidebar-1]' => array( 'sidebars_widgets[footer-one]' => array(
'value' => $new_sidebar_1, 'value' => $new_sidebar_1,
), ),
) )
@ -1804,7 +1804,7 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase {
// Ensure that the value has actually been written to the DB. // Ensure that the value has actually been written to the DB.
$updated_sidebars_widgets = get_option( 'sidebars_widgets' ); $updated_sidebars_widgets = get_option( 'sidebars_widgets' );
$this->assertEquals( $new_sidebar_1, $updated_sidebars_widgets['sidebar-1'] ); $this->assertEquals( $new_sidebar_1, $updated_sidebars_widgets['footer-one'] );
} }
/** /**

View File

@ -33,8 +33,8 @@ class Tests_WP_Customize_Widgets extends WP_UnitTestCase {
unset( $GLOBALS['_wp_sidebars_widgets'] ); // clear out cache set by wp_get_sidebars_widgets() unset( $GLOBALS['_wp_sidebars_widgets'] ); // clear out cache set by wp_get_sidebars_widgets()
$sidebars_widgets = wp_get_sidebars_widgets(); $sidebars_widgets = wp_get_sidebars_widgets();
$this->assertEqualSets( array( 'wp_inactive_widgets', 'footer-one', 'footer-two' ), array_keys( wp_get_sidebars_widgets() ) ); $this->assertEqualSets( array( 'wp_inactive_widgets', 'footer-one', 'footer-two' ), array_keys( wp_get_sidebars_widgets() ) );
$this->assertContains( 'search-2', $sidebars_widgets['sidebar-1'] ); $this->assertContains( 'search-2', $sidebars_widgets['footer-one'] );
$this->assertContains( 'categories-2', $sidebars_widgets['sidebar-1'] ); $this->assertContains( 'categories-2', $sidebars_widgets['footer-two'] );
$this->assertArrayHasKey( 2, get_option( 'widget_search' ) ); $this->assertArrayHasKey( 2, get_option( 'widget_search' ) );
$widget_categories = get_option( 'widget_categories' ); $widget_categories = get_option( 'widget_categories' );
$this->assertArrayHasKey( 2, $widget_categories ); $this->assertArrayHasKey( 2, $widget_categories );
@ -101,7 +101,7 @@ class Tests_WP_Customize_Widgets extends WP_UnitTestCase {
* @ticket 36660 * @ticket 36660
*/ */
function test_customize_register_with_deleted_sidebars() { function test_customize_register_with_deleted_sidebars() {
$sidebar_id = 'sidebar-1'; $sidebar_id = 'footer-one';
delete_option( 'sidebars_widgets' ); delete_option( 'sidebars_widgets' );
register_sidebar( array( 'id' => $sidebar_id ) ); register_sidebar( array( 'id' => $sidebar_id ) );
$this->manager->widgets->customize_register(); $this->manager->widgets->customize_register();
@ -311,11 +311,11 @@ class Tests_WP_Customize_Widgets extends WP_UnitTestCase {
'sanitize_callback' => array( $this->manager->widgets, 'sanitize_sidebar_widgets' ), 'sanitize_callback' => array( $this->manager->widgets, 'sanitize_sidebar_widgets' ),
'sanitize_js_callback' => array( $this->manager->widgets, 'sanitize_sidebar_widgets_js_instance' ), 'sanitize_js_callback' => array( $this->manager->widgets, 'sanitize_sidebar_widgets_js_instance' ),
); );
$args = $this->manager->widgets->get_setting_args( 'sidebars_widgets[sidebar-1]' ); $args = $this->manager->widgets->get_setting_args( 'sidebars_widgets[footer-one]' );
foreach ( $default_args as $key => $default_value ) { foreach ( $default_args as $key => $default_value ) {
$this->assertEquals( $default_value, $args[ $key ] ); $this->assertEquals( $default_value, $args[ $key ] );
} }
$this->assertEquals( 'SIDEBARS_WIDGETS[SIDEBAR-1]', $args['uppercase_id_set_by_filter'] ); $this->assertEquals( 'SIDEBARS_WIDGETS[FOOTER-ONE]', $args['uppercase_id_set_by_filter'] );
$override_args = array( $override_args = array(
'type' => 'theme_mod', 'type' => 'theme_mod',
@ -653,7 +653,7 @@ class Tests_WP_Customize_Widgets extends WP_UnitTestCase {
$this->assertFalse( $this->manager->widgets->render_widget_partial( $partial, array() ) ); $this->assertFalse( $this->manager->widgets->render_widget_partial( $partial, array() ) );
$this->assertFalse( $this->manager->widgets->render_widget_partial( $partial, array( 'sidebar_id' => 'non-existing' ) ) ); $this->assertFalse( $this->manager->widgets->render_widget_partial( $partial, array( 'sidebar_id' => 'non-existing' ) ) );
$output = $this->manager->widgets->render_widget_partial( $partial, array( 'sidebar_id' => 'sidebar-1' ) ); $output = $this->manager->widgets->render_widget_partial( $partial, array( 'sidebar_id' => 'footer-one' ) );
$this->assertEquals( 1, substr_count( $output, 'data-customize-partial-id' ) ); $this->assertEquals( 1, substr_count( $output, 'data-customize-partial-id' ) );
$this->assertEquals( 1, substr_count( $output, 'data-customize-partial-type="widget"' ) ); $this->assertEquals( 1, substr_count( $output, 'data-customize-partial-type="widget"' ) );