diff --git src/wp-includes/functions.php src/wp-includes/functions.php
index ffb09f22d6..b08191ebbb 100644
|
|
|
function _config_wp_siteurl( $url = '' ) { |
| 3303 | 3303 | * @access private |
| 3304 | 3304 | */ |
| 3305 | 3305 | function _delete_option_fresh_site() { |
| 3306 | | update_option( 'fresh_site', 0 ); |
| | 3306 | update_option( 'fresh_site', '0' ); |
| 3307 | 3307 | } |
| 3308 | 3308 | |
| 3309 | 3309 | /** |
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 { |
| 170 | 170 | $this->assertInstanceOf( 'WPDieException', $exception ); |
| 171 | 171 | $this->assertContains( 'Invalid changeset UUID', $exception->getMessage() ); |
| 172 | 172 | |
| 173 | | update_option( 'fresh_site', 0 ); |
| | 173 | update_option( 'fresh_site', '0' ); |
| 174 | 174 | $wp_customize = new WP_Customize_Manager(); |
| 175 | 175 | $wp_customize->setup_theme(); |
| 176 | 176 | $this->assertFalse( has_action( 'after_setup_theme', array( $wp_customize, 'import_theme_starter_content' ) ) ); |
| 177 | 177 | |
| 178 | 178 | // Make sure that starter content import gets queued on a fresh site. |
| 179 | | update_option( 'fresh_site', 1 ); |
| | 179 | update_option( 'fresh_site', '1' ); |
| 180 | 180 | $wp_customize->setup_theme(); |
| 181 | 181 | $this->assertEquals( 100, has_action( 'after_setup_theme', array( $wp_customize, 'import_theme_starter_content' ) ) ); |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | /** |
| | 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 | /** |
| 185 | 204 | * Test WP_Customize_Manager::setup_theme() for frontend. |
| 186 | 205 | * |
| 187 | 206 | * @covers WP_Customize_Manager::setup_theme() |