| @@ 131-144 (lines=14) @@ | ||
| 128 | /** |
|
| 129 | * @see WP_Customize_Panel::check_capabilities() |
|
| 130 | */ |
|
| 131 | function test_check_capabilities() { |
|
| 132 | $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) ); |
|
| 133 | wp_set_current_user( $user_id ); |
|
| 134 | ||
| 135 | $panel = new WP_Customize_Panel( $this->manager, 'foo' ); |
|
| 136 | $this->assertTrue( $panel->check_capabilities() ); |
|
| 137 | $old_cap = $panel->capability; |
|
| 138 | $panel->capability = 'do_not_allow'; |
|
| 139 | $this->assertFalse( $panel->check_capabilities() ); |
|
| 140 | $panel->capability = $old_cap; |
|
| 141 | $this->assertTrue( $panel->check_capabilities() ); |
|
| 142 | $panel->theme_supports = 'impossible_feature'; |
|
| 143 | $this->assertFalse( $panel->check_capabilities() ); |
|
| 144 | } |
|
| 145 | ||
| 146 | /** |
|
| 147 | * @see WP_Customize_Panel::get_content() |
|
| @@ 138-151 (lines=14) @@ | ||
| 135 | /** |
|
| 136 | * @see WP_Customize_Section::check_capabilities() |
|
| 137 | */ |
|
| 138 | function test_check_capabilities() { |
|
| 139 | $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) ); |
|
| 140 | wp_set_current_user( $user_id ); |
|
| 141 | ||
| 142 | $section = new WP_Customize_Section( $this->manager, 'foo' ); |
|
| 143 | $this->assertTrue( $section->check_capabilities() ); |
|
| 144 | $old_cap = $section->capability; |
|
| 145 | $section->capability = 'do_not_allow'; |
|
| 146 | $this->assertFalse( $section->check_capabilities() ); |
|
| 147 | $section->capability = $old_cap; |
|
| 148 | $this->assertTrue( $section->check_capabilities() ); |
|
| 149 | $section->theme_supports = 'impossible_feature'; |
|
| 150 | $this->assertFalse( $section->check_capabilities() ); |
|
| 151 | } |
|
| 152 | ||
| 153 | /** |
|
| 154 | * @see WP_Customize_Section::get_content() |
|