diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php index 58504e140a139..a9992071f0167 100644 --- a/src/wp-includes/post.php +++ b/src/wp-includes/post.php @@ -69,6 +69,11 @@ function create_initial_post_types() { ) ); + // Enhance page editor for block themes by rendering template and content blocks. + if ( wp_is_block_theme() && current_theme_supports( 'block-templates' ) ) { + add_post_type_support( 'page', 'editor', array( 'default-mode' => 'template-locked' ) ); + } + register_post_type( 'attachment', array( diff --git a/tests/phpunit/tests/option/networkOption.php b/tests/phpunit/tests/option/networkOption.php index a4247d4926cec..7771154ef86ca 100644 --- a/tests/phpunit/tests/option/networkOption.php +++ b/tests/phpunit/tests/option/networkOption.php @@ -381,14 +381,18 @@ public function test_delete_network_option_does_not_use_network_notoptions_cache * @covers ::get_network_option */ public function test_get_network_option_does_not_use_single_site_notoptions_cache_for_networks() { + $network_notoptions_cache_before = wp_cache_get( '1:notoptions', 'site-options' ); + $single_site_notoptions_cache_before = wp_cache_get( 'notoptions', 'options' ); + get_network_option( 1, 'ticket_61730_notoption' ); - $network_notoptions_cache = wp_cache_get( '1:notoptions', 'site-options' ); - $single_site_notoptions_cache = wp_cache_get( 'notoptions', 'options' ); + $network_notoptions_cache_after = wp_cache_get( '1:notoptions', 'site-options' ); + $single_site_notoptions_cache_after = wp_cache_get( 'notoptions', 'options' ); - $this->assertEmpty( $single_site_notoptions_cache, 'Single site notoptions cache should not be set for multisite installs.' ); - $this->assertIsArray( $network_notoptions_cache, 'Multisite notoptions cache should be set.' ); - $this->assertArrayHasKey( 'ticket_61730_notoption', $network_notoptions_cache, 'The option should be in the notoptions cache.' ); + $this->assertSame( $single_site_notoptions_cache_before, $single_site_notoptions_cache_after, 'Single site notoptions cache should not change for multisite installs.' ); + $this->assertNotSame( $network_notoptions_cache_before, $network_notoptions_cache_after, 'Multisite notoptions cache should change.' ); + $this->assertIsArray( $network_notoptions_cache_after, 'Multisite notoptions cache should be set.' ); + $this->assertArrayHasKey( 'ticket_61730_notoption', $network_notoptions_cache_after, 'The option should be in the notoptions cache.' ); } /** @@ -402,14 +406,18 @@ public function test_get_network_option_does_not_use_single_site_notoptions_cach * @covers ::delete_network_option */ public function test_delete_network_option_does_not_use_single_site_notoptions_cache_for_networks() { + $network_notoptions_cache_before = wp_cache_get( '1:notoptions', 'site-options' ); + $single_site_notoptions_cache_before = wp_cache_get( 'notoptions', 'options' ); + add_network_option( 1, 'ticket_61730_notoption', 'value' ); delete_network_option( 1, 'ticket_61730_notoption' ); - $network_notoptions_cache = wp_cache_get( '1:notoptions', 'site-options' ); - $single_site_notoptions_cache = wp_cache_get( 'notoptions', 'options' ); + $network_notoptions_cache_after = wp_cache_get( '1:notoptions', 'site-options' ); + $single_site_notoptions_cache_after = wp_cache_get( 'notoptions', 'options' ); - $this->assertEmpty( $single_site_notoptions_cache, 'Single site notoptions cache should not be set for multisite installs.' ); - $this->assertIsArray( $network_notoptions_cache, 'Multisite notoptions cache should be set.' ); - $this->assertArrayHasKey( 'ticket_61730_notoption', $network_notoptions_cache, 'The option should be in the notoptions cache.' ); + $this->assertSame( $single_site_notoptions_cache_before, $single_site_notoptions_cache_after, 'Single site notoptions cache should not change for multisite installs.' ); + $this->assertNotSame( $network_notoptions_cache_before, $network_notoptions_cache_after, 'Multisite notoptions cache should change.' ); + $this->assertIsArray( $network_notoptions_cache_after, 'Multisite notoptions cache should be set.' ); + $this->assertArrayHasKey( 'ticket_61730_notoption', $network_notoptions_cache_after, 'The option should be in the notoptions cache.' ); } }