Created
September 12, 2012 23:08
-
-
Save kurtpayne/3710660 to your computer and use it in GitHub Desktop.
6821 image_resize unit test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: tests/image/resize.php | |
=================================================================== | |
--- tests/image/resize.php (revision 1017) | |
+++ tests/image/resize.php (working copy) | |
@@ -123,4 +123,23 @@ | |
unlink($image); | |
} | |
+ /** | |
+ * Try resizing a non-existent image | |
+ * @ticket 6821 | |
+ */ | |
+ public function test_resize_non_existent_image() { | |
+ $image = image_resize( DIR_TESTDATA.'/images/test-non-existent-image.jpg', 25, 25 ); | |
+ $this->assertInstanceOf( 'WP_Error', $image ); | |
+ $this->assertEquals( 'error_loading_image', $image->get_error_code() ); | |
+ } | |
+ | |
+ /** | |
+ * Try resizing a php file (bad image) | |
+ * @ticket 6821 | |
+ */ | |
+ public function test_resize_bad_image() { | |
+ $image = image_resize( DIR_TESTDATA.'/images/test-image.psd', 25, 25 ); | |
+ $this->assertInstanceOf( 'WP_Error', $image ); | |
+ $this->assertEquals( 'invalid_image', $image->get_error_code() ); | |
+ } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Test on line 24 is invalid for Imagick because Imagick supports reading from PSD.
Note from Marko: "Are you surprised? I am."