Changeset 42343 for trunk/tests/phpunit/tests/customize/control.php
- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/customize/control.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/customize/control.php
r38906 r42343 42 42 function test_check_capabilities() { 43 43 do_action( 'customize_register', $this->wp_customize ); 44 $control = new WP_Customize_Control( $this->wp_customize, 'blogname', array( 45 'settings' => array( 'blogname' ), 46 ) ); 44 $control = new WP_Customize_Control( 45 $this->wp_customize, 'blogname', array( 46 'settings' => array( 'blogname' ), 47 ) 48 ); 47 49 $this->assertTrue( $control->check_capabilities() ); 48 50 49 $control = new WP_Customize_Control( $this->wp_customize, 'blogname', array( 50 'settings' => array( 'blogname', 'non_existing' ), 51 ) ); 51 $control = new WP_Customize_Control( 52 $this->wp_customize, 'blogname', array( 53 'settings' => array( 'blogname', 'non_existing' ), 54 ) 55 ); 52 56 $this->assertFalse( $control->check_capabilities() ); 53 57 54 $this->wp_customize->add_setting( 'top_secret_message', array( 55 'capability' => 'top_secret_clearance', 56 ) ); 57 $control = new WP_Customize_Control( $this->wp_customize, 'blogname', array( 58 'settings' => array( 'blogname', 'top_secret_clearance' ), 59 ) ); 58 $this->wp_customize->add_setting( 59 'top_secret_message', array( 60 'capability' => 'top_secret_clearance', 61 ) 62 ); 63 $control = new WP_Customize_Control( 64 $this->wp_customize, 'blogname', array( 65 'settings' => array( 'blogname', 'top_secret_clearance' ), 66 ) 67 ); 60 68 $this->assertFalse( $control->check_capabilities() ); 61 69 62 $control = new WP_Customize_Control( $this->wp_customize, 'no_setting', array( 63 'settings' => array(), 64 ) ); 70 $control = new WP_Customize_Control( 71 $this->wp_customize, 'no_setting', array( 72 'settings' => array(), 73 ) 74 ); 65 75 $this->assertTrue( $control->check_capabilities() ); 66 76 67 $control = new WP_Customize_Control( $this->wp_customize, 'no_setting', array( 68 'settings' => array(), 69 'capability' => 'top_secret_clearance', 70 ) ); 77 $control = new WP_Customize_Control( 78 $this->wp_customize, 'no_setting', array( 79 'settings' => array(), 80 'capability' => 'top_secret_clearance', 81 ) 82 ); 71 83 $this->assertFalse( $control->check_capabilities() ); 72 84 73 $control = new WP_Customize_Control( $this->wp_customize, 'no_setting', array( 74 'settings' => array(), 75 'capability' => 'edit_theme_options', 76 ) ); 85 $control = new WP_Customize_Control( 86 $this->wp_customize, 'no_setting', array( 87 'settings' => array(), 88 'capability' => 'edit_theme_options', 89 ) 90 ); 77 91 $this->assertTrue( $control->check_capabilities() ); 78 92 } … … 114 128 115 129 // Ensure that auto-draft pages are included if they are among the nav_menus_created_posts. 116 $auto_draft_page_id = $this->factory()->post->create( array( 117 'post_type' => 'page', 118 'post_status' => 'auto-draft', 119 'post_title' => 'Auto Draft Page', 120 ) ); 121 $this->factory()->post->create( array( 122 'post_type' => 'page', 123 'post_status' => 'auto-draft', 124 'post_title' => 'Orphan Auto Draft Page', 125 ) ); 126 $auto_draft_post_id = $this->factory()->post->create( array( 127 'post_type' => 'post', 128 'post_status' => 'auto-draft', 129 'post_title' => 'Auto Draft Post', 130 ) ); 130 $auto_draft_page_id = $this->factory()->post->create( 131 array( 132 'post_type' => 'page', 133 'post_status' => 'auto-draft', 134 'post_title' => 'Auto Draft Page', 135 ) 136 ); 137 $this->factory()->post->create( 138 array( 139 'post_type' => 'page', 140 'post_status' => 'auto-draft', 141 'post_title' => 'Orphan Auto Draft Page', 142 ) 143 ); 144 $auto_draft_post_id = $this->factory()->post->create( 145 array( 146 'post_type' => 'post', 147 'post_status' => 'auto-draft', 148 'post_title' => 'Auto Draft Post', 149 ) 150 ); 131 151 $this->wp_customize->set_post_value( $nav_menus_created_posts_setting->id, array( $auto_draft_page_id, $auto_draft_post_id ) ); 132 152 $nav_menus_created_posts_setting->preview();
Note: See TracChangeset
for help on using the changeset viewer.