Make WordPress Core

Ticket #41039: 41039.1.diff

File 41039.1.diff, 2.2 KB (added by westonruter, 9 years ago)
  • src/wp-includes/functions.php

    diff --git src/wp-includes/functions.php src/wp-includes/functions.php
    index ffb09f22d6..b08191ebbb 100644
    function _config_wp_siteurl( $url = '' ) { 
    33033303 * @access private
    33043304 */
    33053305function _delete_option_fresh_site() {
    3306         update_option( 'fresh_site', 0 );
     3306        update_option( 'fresh_site', '0' );
    33073307}
    33083308
    33093309/**
  • tests/phpunit/tests/customize/manager.php

    diff --git tests/phpunit/tests/customize/manager.php tests/phpunit/tests/customize/manager.php
    index b38ddbd1f3..0954faa21d 100644
    class Tests_WP_Customize_Manager extends WP_UnitTestCase { 
    170170                $this->assertInstanceOf( 'WPDieException', $exception );
    171171                $this->assertContains( 'Invalid changeset UUID', $exception->getMessage() );
    172172
    173                 update_option( 'fresh_site', 0 );
     173                update_option( 'fresh_site', '0' );
    174174                $wp_customize = new WP_Customize_Manager();
    175175                $wp_customize->setup_theme();
    176176                $this->assertFalse( has_action( 'after_setup_theme', array( $wp_customize, 'import_theme_starter_content' ) ) );
    177177
    178178                // Make sure that starter content import gets queued on a fresh site.
    179                 update_option( 'fresh_site', 1 );
     179                update_option( 'fresh_site', '1' );
    180180                $wp_customize->setup_theme();
    181181                $this->assertEquals( 100, has_action( 'after_setup_theme', array( $wp_customize, 'import_theme_starter_content' ) ) );
    182182        }
    183183
    184184        /**
     185         * Test that clearing a fresh site is a no-op if the site is already fresh.
     186         *
     187         * @ticket 38991
     188         */
     189        function test_fresh_site_flag_clearing() {
     190                global $wp_customize, $wpdb;
     191
     192                // Make sure fresh site flag is cleared when publishing a changeset.
     193                update_option( 'fresh_site', '1' );
     194                do_action( 'customize_save_after', $wp_customize );
     195                $this->assertEquals( '0', get_option( 'fresh_site' ) );
     196
     197                // Make sure no DB write is done when publishing and a site is already non-fresh.
     198                $query_count = $wpdb->num_queries;
     199                do_action( 'customize_save_after', $wp_customize );
     200                $this->assertEquals( $query_count, $wpdb->num_queries );
     201        }
     202
     203        /**
    185204         * Test WP_Customize_Manager::setup_theme() for frontend.
    186205         *
    187206         * @covers WP_Customize_Manager::setup_theme()