mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-01-29 21:17:39 +00:00
Tests: Declare custom-logo theme support for custom logo tests.
This addresses failures in `has_custom_logo()` and `get_custom_logo()` tests when being run separately:
{{{
1) Tests_General_Template::test_has_custom_logo
Custom logo should not be set after removal.
Failed asserting that true is false.
tests/phpunit/tests/general/template.php:291
2) Tests_General_Template::test_get_custom_logo
Custom logo should not be set after removal.
Failed asserting that a string is empty.
tests/phpunit/tests/general/template.php:336
}}}
Specifically, this ensures that the `site_logo` option gets deleted in `_delete_site_logo_on_remove_theme_mods()`, which in turn prevents the `core/site-logo` block filters from affecting the custom logo tests.
Alternatively, these filters could be removed instead:
{{{
remove_filter( 'theme_mod_custom_logo', '_override_custom_logo_theme_mod' );
remove_filter( 'pre_set_theme_mod_custom_logo', '_sync_custom_logo_to_site_logo' );
}}}
Follow-up to [36905], [51091], [51421], [52042].
See #55652.
git-svn-id: https://develop.svn.wordpress.org/trunk@53774 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
4ed912c8c3
commit
36fcd57c91
@ -17,6 +17,27 @@ class Tests_General_Template extends WP_UnitTestCase {
|
||||
public $custom_logo_id;
|
||||
public $custom_logo_url;
|
||||
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
/*
|
||||
* Declare theme support for custom logo.
|
||||
*
|
||||
* This ensures that the `site_logo` option gets deleted in
|
||||
* _delete_site_logo_on_remove_theme_mods(), which in turn
|
||||
* prevents the `core/site-logo` block filters from affecting
|
||||
* the custom logo tests.
|
||||
*
|
||||
* Alternatively, these filters can be removed instead:
|
||||
*
|
||||
* remove_filter( 'theme_mod_custom_logo', '_override_custom_logo_theme_mod' );
|
||||
* remove_filter( 'pre_set_theme_mod_custom_logo', '_sync_custom_logo_to_site_logo' );
|
||||
*/
|
||||
add_theme_support( 'custom-logo' );
|
||||
}
|
||||
|
||||
public static function wpTearDownAfterClass() {
|
||||
remove_theme_support( 'custom-logo' );
|
||||
}
|
||||
|
||||
public function set_up() {
|
||||
parent::set_up();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user