Unit Tests: after r38303, replace usage of `global $_wp_additional_image_sizes` with `wp_get_additional_image_sizes()`.
See #37699. git-svn-id: https://develop.svn.wordpress.org/trunk@38383 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
e795f6da1d
commit
db0e1ed0af
|
@ -9,7 +9,7 @@ class Tests_Media extends WP_UnitTestCase {
|
||||||
protected static $_sizes;
|
protected static $_sizes;
|
||||||
|
|
||||||
public static function wpSetUpBeforeClass( $factory ) {
|
public static function wpSetUpBeforeClass( $factory ) {
|
||||||
self::$_sizes = $GLOBALS['_wp_additional_image_sizes'];
|
self::$_sizes = wp_get_additional_image_sizes();
|
||||||
$GLOBALS['_wp_additional_image_sizes'] = array();
|
$GLOBALS['_wp_additional_image_sizes'] = array();
|
||||||
|
|
||||||
$filename = DIR_TESTDATA . '/images/test-image-large.png';
|
$filename = DIR_TESTDATA . '/images/test-image-large.png';
|
||||||
|
@ -650,18 +650,14 @@ VIDEO;
|
||||||
* @ticket 26768
|
* @ticket 26768
|
||||||
*/
|
*/
|
||||||
function test_add_image_size() {
|
function test_add_image_size() {
|
||||||
global $_wp_additional_image_sizes;
|
$_wp_additional_image_sizes = wp_get_additional_image_sizes();
|
||||||
|
|
||||||
if ( ! isset( $_wp_additional_image_sizes ) ) {
|
|
||||||
$_wp_additional_image_sizes = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
remove_image_size( 'test-size' );
|
remove_image_size( 'test-size' );
|
||||||
|
|
||||||
$this->assertArrayNotHasKey( 'test-size', $_wp_additional_image_sizes );
|
$this->assertArrayNotHasKey( 'test-size', $_wp_additional_image_sizes );
|
||||||
add_image_size( 'test-size', 200, 600 );
|
add_image_size( 'test-size', 200, 600 );
|
||||||
|
|
||||||
$sizes = $_wp_additional_image_sizes;
|
$sizes = wp_get_additional_image_sizes();
|
||||||
|
|
||||||
// Clean up
|
// Clean up
|
||||||
remove_image_size( 'test-size' );
|
remove_image_size( 'test-size' );
|
||||||
|
@ -977,7 +973,7 @@ EOF;
|
||||||
* @ticket 33641
|
* @ticket 33641
|
||||||
*/
|
*/
|
||||||
function test_wp_calculate_image_srcset() {
|
function test_wp_calculate_image_srcset() {
|
||||||
global $_wp_additional_image_sizes;
|
$_wp_additional_image_sizes = wp_get_additional_image_sizes();
|
||||||
|
|
||||||
$year_month = date('Y/m');
|
$year_month = date('Y/m');
|
||||||
$image_meta = wp_get_attachment_metadata( self::$large_id );
|
$image_meta = wp_get_attachment_metadata( self::$large_id );
|
||||||
|
@ -1017,7 +1013,7 @@ EOF;
|
||||||
* @ticket 33641
|
* @ticket 33641
|
||||||
*/
|
*/
|
||||||
function test_wp_calculate_image_srcset_no_date_uploads() {
|
function test_wp_calculate_image_srcset_no_date_uploads() {
|
||||||
global $_wp_additional_image_sizes;
|
$_wp_additional_image_sizes = wp_get_additional_image_sizes();
|
||||||
|
|
||||||
// Disable date organized uploads
|
// Disable date organized uploads
|
||||||
add_filter( 'upload_dir', '_upload_dir_no_subdir' );
|
add_filter( 'upload_dir', '_upload_dir_no_subdir' );
|
||||||
|
@ -1099,7 +1095,7 @@ EOF;
|
||||||
* @ticket 35106
|
* @ticket 35106
|
||||||
*/
|
*/
|
||||||
function test_wp_calculate_image_srcset_with_absolute_path_in_meta() {
|
function test_wp_calculate_image_srcset_with_absolute_path_in_meta() {
|
||||||
global $_wp_additional_image_sizes;
|
$_wp_additional_image_sizes = wp_get_additional_image_sizes();
|
||||||
|
|
||||||
$year_month = date('Y/m');
|
$year_month = date('Y/m');
|
||||||
$image_meta = wp_get_attachment_metadata( self::$large_id );
|
$image_meta = wp_get_attachment_metadata( self::$large_id );
|
||||||
|
@ -1375,7 +1371,7 @@ EOF;
|
||||||
* @ticket 33641
|
* @ticket 33641
|
||||||
*/
|
*/
|
||||||
function test_wp_get_attachment_image_srcset() {
|
function test_wp_get_attachment_image_srcset() {
|
||||||
global $_wp_additional_image_sizes;
|
$_wp_additional_image_sizes = wp_get_additional_image_sizes();
|
||||||
|
|
||||||
$image_meta = wp_get_attachment_metadata( self::$large_id );
|
$image_meta = wp_get_attachment_metadata( self::$large_id );
|
||||||
$size_array = array( 1600, 1200 ); // full size
|
$size_array = array( 1600, 1200 ); // full size
|
||||||
|
|
Loading…
Reference in New Issue