Changeset 52010 for trunk/tests/phpunit/tests/theme/customHeader.php
- Timestamp:
- 11/04/2021 03:22:47 PM (4 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/theme/customHeader.php (modified) (26 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/theme/customHeader.php
r51568 r52010 20 20 } 21 21 22 function set_up() {22 public function set_up() { 23 23 parent::set_up(); 24 24 … … 30 30 } 31 31 32 function tear_down() {32 public function tear_down() { 33 33 $this->customize_manager = null; 34 34 unset( $GLOBALS['wp_customize'] ); … … 43 43 } 44 44 45 function test_add_and_remove_theme_support() {46 $this-> _add_theme_support();45 public function test_add_and_remove_theme_support() { 46 $this->add_theme_support(); 47 47 $this->assertTrue( current_theme_supports( 'custom-header' ) ); 48 48 remove_theme_support( 'custom-header' ); … … 50 50 } 51 51 52 function test_get_header_image_without_registered_default() {53 $this-> _add_theme_support();52 public function test_get_header_image_without_registered_default() { 53 $this->add_theme_support(); 54 54 $image = get_header_image(); 55 55 $this->assertFalse( has_header_image() ); … … 57 57 } 58 58 59 function test_get_header_image_with_registered_default() {60 $default = 'http://localhost/default-header.jpg'; 61 $this-> _add_theme_support( array( 'default-image' => $default ) );59 public function test_get_header_image_with_registered_default() { 60 $default = 'http://localhost/default-header.jpg'; 61 $this->add_theme_support( array( 'default-image' => $default ) ); 62 62 63 63 $image = get_header_image(); … … 66 66 } 67 67 68 function test_get_header_image_from_theme_mod() {68 public function test_get_header_image_from_theme_mod() { 69 69 $default = 'http://localhost/default-header.jpg'; 70 70 $custom = 'http://localhost/custom-header.jpg'; 71 $this-> _add_theme_support( array( 'default-image' => $default ) );71 $this->add_theme_support( array( 'default-image' => $default ) ); 72 72 73 73 set_theme_mod( 'header_image', $custom ); … … 82 82 } 83 83 84 function test_get_header_image_tag_without_registered_default_image() {85 $this-> _add_theme_support();84 public function test_get_header_image_tag_without_registered_default_image() { 85 $this->add_theme_support(); 86 86 $html = get_header_image_tag(); 87 87 $this->assertEmpty( $html ); 88 88 } 89 89 90 function test_get_header_image_tag_with_registered_default_image() {91 $default = 'http://localhost/default-header.jpg'; 92 $this-> _add_theme_support( array( 'default-image' => $default ) );90 public function test_get_header_image_tag_with_registered_default_image() { 91 $default = 'http://localhost/default-header.jpg'; 92 $this->add_theme_support( array( 'default-image' => $default ) ); 93 93 94 94 $html = get_header_image_tag(); … … 100 100 * @ticket 38633 101 101 */ 102 function test_get_header_image_tag_with_registered_default_image_and_remove_header_theme_mod() {103 $default = 'http://localhost/default-header.jpg'; 104 $this-> _add_theme_support( array( 'default-image' => $default ) );102 public function test_get_header_image_tag_with_registered_default_image_and_remove_header_theme_mod() { 103 $default = 'http://localhost/default-header.jpg'; 104 $this->add_theme_support( array( 'default-image' => $default ) ); 105 105 106 106 set_theme_mod( 'header_image', 'remove-header' ); … … 109 109 } 110 110 111 function test_get_header_image_tag_with_registered_default_image_and_custom_theme_mod() {111 public function test_get_header_image_tag_with_registered_default_image_and_custom_theme_mod() { 112 112 $default = 'http://localhost/default-header.jpg'; 113 113 $custom = 'http://localhost/custom-header.jpg'; 114 $this-> _add_theme_support( array( 'default-image' => $default ) );114 $this->add_theme_support( array( 'default-image' => $default ) ); 115 115 116 116 set_theme_mod( 'header_image', $custom ); … … 120 120 } 121 121 122 function test_get_custom_header_markup_without_registered_default_image() {123 $this-> _add_theme_support();122 public function test_get_custom_header_markup_without_registered_default_image() { 123 $this->add_theme_support(); 124 124 125 125 $html = get_custom_header_markup(); … … 128 128 129 129 // The container should always be returned in the Customizer preview. 130 $this-> _set_customize_previewing( true );130 $this->set_customize_previewing( true ); 131 131 $html = get_custom_header_markup(); 132 132 $this->assertSame( '<div id="wp-custom-header" class="wp-custom-header"></div>', $html ); 133 133 } 134 134 135 function test_get_custom_header_markup_with_registered_default_image() {136 $default = 'http://localhost/default-header.jpg'; 137 $this-> _add_theme_support( array( 'default-image' => $default ) );135 public function test_get_custom_header_markup_with_registered_default_image() { 136 $default = 'http://localhost/default-header.jpg'; 137 $this->add_theme_support( array( 'default-image' => $default ) ); 138 138 $html = get_custom_header_markup(); 139 139 $this->assertTrue( has_custom_header() ); … … 142 142 } 143 143 144 function test_get_header_video_url() {145 $this-> _add_theme_support( array( 'video' => true ) );144 public function test_get_header_video_url() { 145 $this->add_theme_support( array( 'video' => true ) ); 146 146 147 147 $this->assertFalse( has_header_video() ); … … 151 151 } 152 152 153 function test_get_external_header_video_url() {153 public function test_get_external_header_video_url() { 154 154 $external = 'http://example.com/custom-video.mp4'; 155 $this-> _add_theme_support( array( 'video' => true ) );155 $this->add_theme_support( array( 'video' => true ) ); 156 156 157 157 $this->assertFalse( has_header_video() ); … … 161 161 } 162 162 163 function test_get_header_video_url_prefers_local_video() {163 public function test_get_header_video_url_prefers_local_video() { 164 164 $external = 'http://example.com/custom-video.mp4'; 165 $this-> _add_theme_support( array( 'video' => true ) );165 $this->add_theme_support( array( 'video' => true ) ); 166 166 167 167 set_theme_mod( 'header_video', self::$header_video_id ); … … 170 170 } 171 171 172 function test_get_custom_header_markup_with_video_and_without_an_image() {172 public function test_get_custom_header_markup_with_video_and_without_an_image() { 173 173 $custom = 'http://localhost/custom-video.mp4'; 174 $this-> _add_theme_support(174 $this->add_theme_support( 175 175 array( 176 176 'video' => true, … … 186 186 } 187 187 188 function test_header_script_is_not_enqueued_by_the_custom_header_markup_without_video() {189 $this-> _add_theme_support(188 public function test_header_script_is_not_enqueued_by_the_custom_header_markup_without_video() { 189 $this->add_theme_support( 190 190 array( 191 191 'video' => true, … … 207 207 } 208 208 209 function test_header_script_is_not_enqueued_by_the_custom_header_markup_when_active_callback_is_false() {210 $this-> _add_theme_support(209 public function test_header_script_is_not_enqueued_by_the_custom_header_markup_when_active_callback_is_false() { 210 $this->add_theme_support( 211 211 array( 212 212 'video' => true, … … 222 222 } 223 223 224 function test_header_script_is_enqueued_by_the_custom_header_markup_without_video_when_previewing_in_customizer() {225 $this-> _add_theme_support(226 array( 227 'video' => true, 228 'video-active-callback' => '__return_true', 229 ) 230 ); 231 $this-> _set_customize_previewing( true );224 public function test_header_script_is_enqueued_by_the_custom_header_markup_without_video_when_previewing_in_customizer() { 225 $this->add_theme_support( 226 array( 227 'video' => true, 228 'video-active-callback' => '__return_true', 229 ) 230 ); 231 $this->set_customize_previewing( true ); 232 232 233 233 ob_start(); … … 237 237 } 238 238 239 function test_header_script_is_enqueued_by_the_custom_header_markup_with_video() {240 $this-> _add_theme_support(239 public function test_header_script_is_enqueued_by_the_custom_header_markup_with_video() { 240 $this->add_theme_support( 241 241 array( 242 242 'video' => true, … … 255 255 * @ticket 38738 256 256 */ 257 function test_video_header_callback_front_page_from_front_page() {258 $this-> _add_theme_support(257 public function test_video_header_callback_front_page_from_front_page() { 258 $this->add_theme_support( 259 259 array( 260 260 'video' => true, … … 272 272 * @ticket 38738 273 273 */ 274 function test_video_header_callback_front_page_from_elsewhere() {275 $this-> _add_theme_support(274 public function test_video_header_callback_front_page_from_elsewhere() { 275 $this->add_theme_support( 276 276 array( 277 277 'video' => true, … … 289 289 * @ticket 38738 290 290 */ 291 function test_video_header_callback_globally_from_front_page() {292 $this-> _add_theme_support(291 public function test_video_header_callback_globally_from_front_page() { 292 $this->add_theme_support( 293 293 array( 294 294 'video' => true, … … 307 307 * @ticket 38738 308 308 */ 309 function test_video_header_callback_globally_from_elsewhere() {310 $this-> _add_theme_support(309 public function test_video_header_callback_globally_from_elsewhere() { 310 $this->add_theme_support( 311 311 array( 312 312 'video' => true, … … 325 325 * @ticket 38738 326 326 */ 327 function test_video_header_callback_globally_with_negative_filter() {328 $this-> _add_theme_support(327 public function test_video_header_callback_globally_with_negative_filter() { 328 $this->add_theme_support( 329 329 array( 330 330 'video' => true, … … 347 347 * it defines constants. 348 348 */ 349 function _add_theme_support( $args = array() ) {349 private function add_theme_support( $args = array() ) { 350 350 global $_wp_theme_features; 351 351 … … 371 371 } 372 372 373 function _set_customize_previewing( $value ) {373 private function set_customize_previewing( $value ) { 374 374 $class = new ReflectionClass( 'WP_Customize_Manager' ); 375 375 $property = $class->getProperty( 'previewing' );
Note: See TracChangeset
for help on using the changeset viewer.