Changeset 38302
- Timestamp:
- 08/22/2016 04:16:29 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/media.php
r38296 r38302 7 7 class Tests_Media extends WP_UnitTestCase { 8 8 protected static $large_id; 9 protected static $_sizes; 9 10 10 11 public static function wpSetUpBeforeClass( $factory ) { 12 self::$_sizes = $GLOBALS['_wp_additional_image_sizes']; 13 $GLOBALS['_wp_additional_image_sizes'] = array(); 14 11 15 $filename = DIR_TESTDATA . '/images/test-image-large.png'; 12 16 self::$large_id = $factory->attachment->create_upload_object( $filename ); … … 15 19 public static function wpTearDownAfterClass() { 16 20 wp_delete_attachment( self::$large_id ); 21 22 $GLOBALS['_wp_additional_image_sizes'] = self::$_sizes; 17 23 } 18 24 … … 1771 1777 add_filter( 'wp_get_attachment_metadata', array( $this, '_filter_36246' ), 10, 2 ); 1772 1778 1779 remove_all_filters( 'wp_calculate_image_sizes' ); 1780 1773 1781 $actual = wp_get_attachment_image( self::$large_id, 'testsize' ); 1774 $expected = '<img width="999" height="999" src="http://example.org/wp-content/uploads/2016/03/test-image-testsize-999x999.png" class="attachment-testsize size-testsize" alt="test-image-large.png" srcset="http://example.org/wp-content/uploads/2016/03/test-image-large-150x150.png 150w, http://example.org/wp-content/uploads/2016/03/test-image-testsize-999x999.png 999w" sizes="(max-width: 999px) 100vw, 999px" />'; 1782 $year = date( 'Y' ); 1783 $month = date( 'm' ); 1784 1785 $expected = '<img width="999" height="999" src="http://example.org/wp-content/uploads/' . $year . '/' . $month . '/test-image-testsize-999x999.png"' . 1786 ' class="attachment-testsize size-testsize" alt="test-image-large.png"' . 1787 ' srcset="http://example.org/wp-content/uploads/' . $year . '/' . $month . '/test-image-testsize-999x999.png 999w,' . 1788 ' http://example.org/wp-content/uploads/' . $year . '/' . $month . '/test-image-large-150x150.png 150w"' . 1789 ' sizes="(max-width: 999px) 100vw, 999px" />'; 1775 1790 1776 1791 remove_filter( 'wp_get_attachment_metadata', array( $this, '_filter_36246' ) );
Note: See TracChangeset
for help on using the changeset viewer.