Make WordPress Core


Ignore:
Timestamp:
08/25/2016 07:08:38 PM (8 years ago)
Author:
wonderboymusic
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/image/site_icon.php

    r35309 r38355  
    11<?php
    2 
    32/**
    43 * Tests for the WP_Site_Icon class.
     
    65 * @group site_icon
    76 */
     7
     8require_once( ABSPATH . 'wp-admin/includes/class-wp-site-icon.php' );
     9
    810class Tests_WP_Site_Icon extends WP_UnitTestCase {
    9     public $wp_site_icon;
     11    protected $wp_site_icon;
     12
    1013    public $attachment_id = 0;
    1114
     
    1316        parent::setUp();
    1417
    15         require_once ABSPATH . 'wp-admin/includes/class-wp-site-icon.php';
    16         $this->wp_site_icon = $GLOBALS['wp_site_icon'];
     18        $this->wp_site_icon = new WP_Site_Icon();
    1719    }
    1820
    1921    function tearDown() {
    20         $this->site_icon = null;
     22        $this->_remove_custom_logo();
    2123        $this->remove_added_uploads();
    2224        parent::tearDown();
     25    }
     26
     27    function _remove_custom_logo() {
     28        remove_theme_mod( 'custom_logo' );
    2329    }
    2430
Note: See TracChangeset for help on using the changeset viewer.