Changeset 53525 for trunk/tests/phpunit/tests/image/functions.php
- Timestamp:
- 06/19/2022 03:28:25 PM (4 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/image/functions.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/image/functions.php
r53524 r53525 139 139 } 140 140 141 public function test_is_displayable_image_positive() { 141 /** 142 * @dataProvider data_is_displayable_image_positive 143 * 144 * @covers ::file_is_displayable_image 145 * 146 * @param string $file File name. 147 */ 148 public function test_is_displayable_image_positive( $file ) { 149 $this->assertTrue( 150 file_is_displayable_image( DIR_TESTDATA . '/images/' . $file ), 151 "file_is_displayable_image( '$file' ) should return true" 152 ); 153 } 154 155 /** 156 * Data provider. 157 * 158 * @return array 159 */ 160 public function data_is_displayable_image_positive() { 142 161 // These are all usable in typical web browsers. 143 162 $files = array( … … 145 164 'test-image.png', 146 165 'test-image.jpg', 166 'test-image.ico', 147 167 ); 148 168 … … 152 172 153 173 if ( ! is_wp_error( $editor ) && $editor->supports_mime_type( 'image/webp' ) ) { 154 $files = array_merge( 155 $files, 156 array( 157 'webp-animated.webp', 158 'webp-lossless.webp', 159 'webp-lossy.webp', 160 'webp-transparent.webp', 161 ) 162 ); 163 } 164 165 // IMAGETYPE_ICO is only defined in PHP 5.3+. 166 if ( defined( 'IMAGETYPE_ICO' ) ) { 167 $files[] = 'test-image.ico'; 168 } 169 170 foreach ( $files as $file ) { 171 $this->assertTrue( file_is_displayable_image( DIR_TESTDATA . '/images/' . $file ), "file_is_valid_image($file) should return true" ); 172 } 174 $files[] = 'webp-animated.webp'; 175 $files[] = 'webp-lossless.webp'; 176 $files[] = 'webp-lossy.webp'; 177 $files[] = 'webp-transparent.webp'; 178 } 179 180 return $this->text_array_to_dataprovider( $files ); 173 181 } 174 182
Note: See TracChangeset
for help on using the changeset viewer.