diff --git a/tests/phpunit/tests/image/functions.php b/tests/phpunit/tests/image/functions.php index b359bcff0a..8c94e8baca 100644 --- a/tests/phpunit/tests/image/functions.php +++ b/tests/phpunit/tests/image/functions.php @@ -87,8 +87,8 @@ class Tests_Image_Functions extends WP_UnitTestCase { // These are all image files recognized by PHP. $files = array( 'test-image-cmyk.jpg', - 'test-image.bmp', 'test-image-grayscale.jpg', + 'test-image.bmp', 'test-image.gif', 'test-image.png', 'test-image.tiff', @@ -180,12 +180,31 @@ class Tests_Image_Functions extends WP_UnitTestCase { return $this->text_array_to_dataprovider( $files ); } - public function test_is_displayable_image_negative() { + /** + * @dataProvider data_is_displayable_image_negative + * + * @covers ::file_is_displayable_image + * + * @param string $file File name. + */ + public function test_is_displayable_image_negative( $file ) { + $this->assertFalse( + file_is_displayable_image( DIR_TESTDATA . '/images/' . $file ), + "file_is_displayable_image( '$file' ) should return false" + ); + } + + /** + * Data provider. + * + * @return array + */ + public function data_is_displayable_image_negative() { // These are image files but aren't suitable for web pages because of compatibility or size issues. $files = array( // 'test-image-cmyk.jpg', Allowed in r9727. - // 'test-image.bmp', Allowed in r28589. // 'test-image-grayscale.jpg', Allowed in r9727. + // 'test-image.bmp', Allowed in r28589. 'test-image.pct', 'test-image.tga', 'test-image.sgi', @@ -196,9 +215,7 @@ class Tests_Image_Functions extends WP_UnitTestCase { 'test-image-zip.tiff', ); - foreach ( $files as $file ) { - $this->assertFalse( file_is_displayable_image( DIR_TESTDATA . '/images/' . $file ), "file_is_valid_image($file) should return false" ); - } + return $this->text_array_to_dataprovider( $files ); } /**