[wp-trac] [WordPress Trac] #38738: Remove front page restrictions from new custom header functions
WordPress Trac
noreply at wordpress.org
Tue Nov 15 00:23:34 UTC 2016
#38738: Remove front page restrictions from new custom header functions
--------------------------------------------------+--------------------
Reporter: peterwilsoncc | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.7
Component: Themes | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests 2nd-opinion | Focuses:
--------------------------------------------------+--------------------
Comment (by bradyvercher):
It wasn't readily apparent with the tests in [attachment:38738.5.diff]
since they're only testing new video arguments, but they still poisoned
subsequent tests. Backing up the global and restoring doesn't fix the
issue and shouldn't be necessary.
Any time `add_theme_support( 'custom-header' )` is called with any of the
following arguments, it
[https://github.com/WordPress/WordPress/blob/56723c61c6d002ecb7d0ac57e9bbbbe8cd104866
/wp-includes/theme.php#L2076-L2105 defines constants that will persist]
through subsequent tests: header-text, width, height, default-text-color,
and default-image.
When custom header support is registered with `'__jit' => true`, it
defines all of the header constants, which prevents any of the values from
being updated/tested in subsequent tests.
In [attachment:38738.6.diff] I pulled in and updated the tests I wrote for
#38639. I also moved the tests from [attachment:38738.5.diff] over to the
new `customHeader.php` test case and updated those to not call
`add_theme_support( 'custom-header' )` to prevent header constants from
ever being defined.
It doesn't look like the patch keeps binary files, so the video file will
need to be [https://github.com/mathiasbynens/small/blob/master/mp4.mp4
downloaded from this repo] and saved to
`tests/phpunit/data/images/video.mp4` to make the tests pass.
There are also some changes in `_remove_theme_support()` to prevent
notices from being thrown when removing custom header support.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38738#comment:23>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list