Changeset 42343 for trunk/tests/phpunit/tests/theme/customHeader.php
- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/theme/customHeader.php
r40826 r42343 10 10 11 11 public static function wpSetUpBeforeClass( $factory ) { 12 self::$post = self::factory()->post->create( array( 13 'post_status' => 'publish', 14 ) ); 15 16 $file = DIR_TESTDATA . '/uploads/small-video.mp4'; 12 self::$post = self::factory()->post->create( 13 array( 14 'post_status' => 'publish', 15 ) 16 ); 17 18 $file = DIR_TESTDATA . '/uploads/small-video.mp4'; 17 19 self::$header_video_id = $factory->attachment->create_upload_object( $file ); 18 20 } … … 66 68 function test_get_header_image_from_theme_mod() { 67 69 $default = 'http://localhost/default-header.jpg'; 68 $custom = 'http://localhost/custom-header.jpg';70 $custom = 'http://localhost/custom-header.jpg'; 69 71 $this->_add_theme_support( array( 'default-image' => $default ) ); 70 72 … … 109 111 function test_get_header_image_tag_with_registered_default_image_and_custom_theme_mod() { 110 112 $default = 'http://localhost/default-header.jpg'; 111 $custom = 'http://localhost/custom-header.jpg';113 $custom = 'http://localhost/custom-header.jpg'; 112 114 $this->_add_theme_support( array( 'default-image' => $default ) ); 113 115 … … 174 176 function test_get_custom_header_markup_with_video_and_without_an_image() { 175 177 $custom = 'http://localhost/custom-video.mp4'; 176 $this->_add_theme_support( array( 'video' => true, 'video-active-callback' => '__return_true' ) ); 178 $this->_add_theme_support( 179 array( 180 'video' => true, 181 'video-active-callback' => '__return_true', 182 ) 183 ); 177 184 178 185 set_theme_mod( 'external_header_video', $custom ); … … 184 191 185 192 function test_header_script_is_not_enqueued_by_the_custom_header_markup_without_video() { 186 $this->_add_theme_support( array( 'video' => true, 'video-active-callback' => '__return_true' ) ); 193 $this->_add_theme_support( 194 array( 195 'video' => true, 196 'video-active-callback' => '__return_true', 197 ) 198 ); 187 199 188 200 ob_start(); … … 200 212 201 213 function test_header_script_is_not_enqueued_by_the_custom_header_markup_when_active_callback_is_false() { 202 $this->_add_theme_support( array( 'video' => true, 'video-active-callback' => '__return_false' ) ); 214 $this->_add_theme_support( 215 array( 216 'video' => true, 217 'video-active-callback' => '__return_false', 218 ) 219 ); 203 220 set_theme_mod( 'external_header_video', 'http://localhost/custom-video.mp4' ); 204 221 … … 215 232 } 216 233 217 $this->_add_theme_support( array( 'video' => true, 'video-active-callback' => '__return_true' ) ); 234 $this->_add_theme_support( 235 array( 236 'video' => true, 237 'video-active-callback' => '__return_true', 238 ) 239 ); 218 240 $this->_set_customize_previewing( true ); 219 241 … … 225 247 226 248 function test_header_script_is_enqueued_by_the_custom_header_markup_with_video() { 227 $this->_add_theme_support( array( 'video' => true, 'video-active-callback' => '__return_true' ) ); 249 $this->_add_theme_support( 250 array( 251 'video' => true, 252 'video-active-callback' => '__return_true', 253 ) 254 ); 228 255 set_theme_mod( 'external_header_video', 'http://localhost/custom-video.mp4' ); 229 256 … … 238 265 */ 239 266 function test_video_header_callback_front_page_from_front_page() { 240 $this->_add_theme_support( array( 241 'video' => true, 242 ) ); 267 $this->_add_theme_support( 268 array( 269 'video' => true, 270 ) 271 ); 243 272 244 273 $this->go_to( home_url() ); … … 253 282 */ 254 283 function test_video_header_callback_front_page_from_elsewhere() { 255 $this->_add_theme_support( array( 256 'video' => true, 257 ) ); 284 $this->_add_theme_support( 285 array( 286 'video' => true, 287 ) 288 ); 258 289 259 290 $this->go_to( get_permalink( self::$post ) ); … … 268 299 */ 269 300 function test_video_header_callback_globally_from_front_page() { 270 $this->_add_theme_support( array( 271 'video' => true, 272 'video-active-callback' => '__return_true', 273 ) ); 301 $this->_add_theme_support( 302 array( 303 'video' => true, 304 'video-active-callback' => '__return_true', 305 ) 306 ); 274 307 275 308 $this->go_to( home_url() ); … … 284 317 */ 285 318 function test_video_header_callback_globally_from_elsewhere() { 286 $this->_add_theme_support( array( 287 'video' => true, 288 'video-active-callback' => '__return_true', 289 ) ); 319 $this->_add_theme_support( 320 array( 321 'video' => true, 322 'video-active-callback' => '__return_true', 323 ) 324 ); 290 325 291 326 $this->go_to( get_permalink( self::$post ) ); … … 300 335 */ 301 336 function test_video_header_callback_globally_with_negative_filter() { 302 $this->_add_theme_support( array( 303 'video' => true, 304 'video-active-callback' => '__return_true', 305 ) ); 337 $this->_add_theme_support( 338 array( 339 'video' => true, 340 'video-active-callback' => '__return_true', 341 ) 342 ); 306 343 307 344 $this->go_to( get_permalink( self::$post ) ); … … 322 359 global $_wp_theme_features; 323 360 324 $_wp_theme_features['custom-header'][0] = wp_parse_args( $args, array( 325 'default-image' => '', 326 'random-default' => false, 327 'width' => 0, 328 'height' => 0, 329 'flex-height' => false, 330 'flex-width' => false, 331 'default-text-color' => '', 332 'header-text' => true, 333 'uploads' => true, 334 'wp-head-callback' => '', 335 'admin-head-callback' => '', 336 'admin-preview-callback' => '', 337 'video' => false, 338 'video-active-callback' => 'is_front_page', 339 ) ); 361 $_wp_theme_features['custom-header'][0] = wp_parse_args( 362 $args, array( 363 'default-image' => '', 364 'random-default' => false, 365 'width' => 0, 366 'height' => 0, 367 'flex-height' => false, 368 'flex-width' => false, 369 'default-text-color' => '', 370 'header-text' => true, 371 'uploads' => true, 372 'wp-head-callback' => '', 373 'admin-head-callback' => '', 374 'admin-preview-callback' => '', 375 'video' => false, 376 'video-active-callback' => 'is_front_page', 377 ) 378 ); 340 379 } 341 380 342 381 function _set_customize_previewing( $value ) { 343 $class = new ReflectionClass( 'WP_Customize_Manager' );382 $class = new ReflectionClass( 'WP_Customize_Manager' ); 344 383 $property = $class->getProperty( 'previewing' ); 345 384 $property->setAccessible( true );
Note: See TracChangeset
for help on using the changeset viewer.