- Timestamp:
- 11/30/2017 11:09:33 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/multisite/wpInstallDefaults.php
r40296 r42343 2 2 3 3 if ( is_multisite() ) : 4 /**5 * Saving network settings without altering starter content ( first page, post, and comment ) shouldn't affect6 * the way it is added to new sites.7 *8 * @group ms-site9 * @group multisite10 */11 class Tests_Multisite_Install_Defaults extends WP_UnitTestCase {12 4 /** 13 * @ticket 40036 5 * Saving network settings without altering starter content ( first page, post, and comment ) shouldn't affect 6 * the way it is added to new sites. 7 * 8 * @group ms-site 9 * @group multisite 14 10 */ 15 public function test_option_should_not_be_empty_by_default() { 16 $blog_id = $this->factory->blog->create(); 11 class Tests_Multisite_Install_Defaults extends WP_UnitTestCase { 12 /** 13 * @ticket 40036 14 */ 15 public function test_option_should_not_be_empty_by_default() { 16 $blog_id = $this->factory->blog->create(); 17 17 18 switch_to_blog( $blog_id );18 switch_to_blog( $blog_id ); 19 19 20 $first_page= get_page_by_path( '/sample-page' );21 $first_comment = get_comments();20 $first_page = get_page_by_path( '/sample-page' ); 21 $first_comment = get_comments(); 22 22 23 restore_current_blog();24 wpmu_delete_blog( $blog_id, true );23 restore_current_blog(); 24 wpmu_delete_blog( $blog_id, true ); 25 25 26 $this->assertNotEmpty( $first_page->post_content ); 27 $this->assertNotEmpty( $first_comment[0]->comment_content ); 26 $this->assertNotEmpty( $first_page->post_content ); 27 $this->assertNotEmpty( $first_comment[0]->comment_content ); 28 } 29 30 /** 31 * @ticket 40036 32 */ 33 public function test_empty_option_should_fall_back_to_default() { 34 /* 35 * Update first_page / first_comment options, 36 * just like what happens when the network settings page is saved 37 */ 38 update_site_option( 'first_page', '' ); 39 update_site_option( 'first_comment', '' ); 40 41 $blog_id = $this->factory->blog->create(); 42 43 switch_to_blog( $blog_id ); 44 45 $first_page = get_page_by_path( '/sample-page' ); 46 $first_comment = get_comments(); 47 48 restore_current_blog(); 49 wpmu_delete_blog( $blog_id, true ); 50 51 $this->assertNotEmpty( $first_page->post_content ); 52 $this->assertNotEmpty( $first_comment[0]->comment_content ); 53 } 54 55 /** 56 * @ticket 40036 57 */ 58 public function test_non_default_option_values() { 59 /* 60 * Update first_page / first_comment options, 61 * just like what happens when the network settings page is saved 62 */ 63 update_site_option( 'first_page', 'Some page content' ); 64 update_site_option( 'first_comment', 'Some comment content' ); 65 66 $blog_id = $this->factory->blog->create(); 67 68 switch_to_blog( $blog_id ); 69 70 $first_page = get_page_by_path( '/sample-page' ); 71 $first_comment = get_comments(); 72 73 restore_current_blog(); 74 wpmu_delete_blog( $blog_id, true ); 75 76 $this->assertEquals( 'Some page content', $first_page->post_content ); 77 $this->assertEquals( 'Some comment content', $first_comment[0]->comment_content ); 78 } 28 79 } 29 80 30 /**31 * @ticket 4003632 */33 public function test_empty_option_should_fall_back_to_default() {34 /*35 * Update first_page / first_comment options,36 * just like what happens when the network settings page is saved37 */38 update_site_option( 'first_page', '' );39 update_site_option( 'first_comment', '' );40 41 $blog_id = $this->factory->blog->create();42 43 switch_to_blog( $blog_id );44 45 $first_page = get_page_by_path( '/sample-page' );46 $first_comment = get_comments();47 48 restore_current_blog();49 wpmu_delete_blog( $blog_id, true );50 51 $this->assertNotEmpty( $first_page->post_content );52 $this->assertNotEmpty( $first_comment[0]->comment_content );53 }54 55 /**56 * @ticket 4003657 */58 public function test_non_default_option_values() {59 /*60 * Update first_page / first_comment options,61 * just like what happens when the network settings page is saved62 */63 update_site_option( 'first_page', 'Some page content' );64 update_site_option( 'first_comment', 'Some comment content' );65 66 $blog_id = $this->factory->blog->create();67 68 switch_to_blog( $blog_id );69 70 $first_page = get_page_by_path( '/sample-page' );71 $first_comment = get_comments();72 73 restore_current_blog();74 wpmu_delete_blog( $blog_id, true );75 76 $this->assertEquals( 'Some page content', $first_page->post_content );77 $this->assertEquals( 'Some comment content', $first_comment[0]->comment_content );78 }79 }80 81 81 endif;
Note: See TracChangeset
for help on using the changeset viewer.