Site Icon: There is no good reason for class-wp-site-icon.php to drop a global instance of itself whenever the file is loaded. The lone use of the global instance of WP_Site_Icon is in an AJAX action that provides virtually no way to override - the file is loaded immediately before the global is used.

Let us remove the `$wp_site_icon` global. I will fall on the sword if this comes back to bite us (waiting with bated breath).

See #37699.


git-svn-id: https://develop.svn.wordpress.org/trunk@38355 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2016-08-25 19:08:38 +00:00
parent 9e9cc9d07a
commit a02d79cf73
4 changed files with 18 additions and 18 deletions

View File

@@ -1,13 +1,15 @@
<?php
/**
* A set of unit tests for functions in wp-includes/general-template.php
*
* @group template
* @group site_icon
*/
class Tests_General_Template extends WP_UnitTestCase {
public $wp_site_icon;
require_once( ABSPATH . 'wp-admin/includes/class-wp-site-icon.php' );
class Tests_General_Template extends WP_UnitTestCase {
protected $wp_site_icon;
public $site_icon_id;
public $site_icon_url;
@@ -17,8 +19,7 @@ class Tests_General_Template extends WP_UnitTestCase {
function setUp() {
parent::setUp();
require_once ABSPATH . 'wp-admin/includes/class-wp-site-icon.php';
$this->wp_site_icon = $GLOBALS['wp_site_icon'];
$this->wp_site_icon = new WP_Site_Icon();
}
function tearDown() {

View File

@@ -1,27 +1,33 @@
<?php
/**
* Tests for the WP_Site_Icon class.
*
* @group site_icon
*/
require_once( ABSPATH . 'wp-admin/includes/class-wp-site-icon.php' );
class Tests_WP_Site_Icon extends WP_UnitTestCase {
public $wp_site_icon;
protected $wp_site_icon;
public $attachment_id = 0;
function setUp() {
parent::setUp();
require_once ABSPATH . 'wp-admin/includes/class-wp-site-icon.php';
$this->wp_site_icon = $GLOBALS['wp_site_icon'];
$this->wp_site_icon = new WP_Site_Icon();
}
function tearDown() {
$this->site_icon = null;
$this->_remove_custom_logo();
$this->remove_added_uploads();
parent::tearDown();
}
function _remove_custom_logo() {
remove_theme_mod( 'custom_logo' );
}
function test_intermediate_image_sizes() {
$image_sizes = $this->wp_site_icon->intermediate_image_sizes( array() );