diff --git a/tests/phpunit/tests/media.php b/tests/phpunit/tests/media.php index 12e30e6eb7..b1151367fe 100644 --- a/tests/phpunit/tests/media.php +++ b/tests/phpunit/tests/media.php @@ -6,14 +6,20 @@ */ class Tests_Media extends WP_UnitTestCase { protected static $large_id; + protected static $_sizes; public static function wpSetUpBeforeClass( $factory ) { + self::$_sizes = $GLOBALS['_wp_additional_image_sizes']; + $GLOBALS['_wp_additional_image_sizes'] = array(); + $filename = DIR_TESTDATA . '/images/test-image-large.png'; self::$large_id = $factory->attachment->create_upload_object( $filename ); } public static function wpTearDownAfterClass() { wp_delete_attachment( self::$large_id ); + + $GLOBALS['_wp_additional_image_sizes'] = self::$_sizes; } function setUp() { @@ -1770,8 +1776,17 @@ EOF; function test_wp_get_attachment_image_should_use_wp_get_attachment_metadata() { add_filter( 'wp_get_attachment_metadata', array( $this, '_filter_36246' ), 10, 2 ); + remove_all_filters( 'wp_calculate_image_sizes' ); + $actual = wp_get_attachment_image( self::$large_id, 'testsize' ); - $expected = 'test-image-large.png'; + $year = date( 'Y' ); + $month = date( 'm' ); + + $expected = 'test-image-large.png'; remove_filter( 'wp_get_attachment_metadata', array( $this, '_filter_36246' ) );