Changeset 1061 in tests for trunk/tests/image/resize.php
- Timestamp:
- 10/01/2012 09:08:41 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/tests/image/resize.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/image/resize.php
r909 r1061 124 124 } 125 125 126 /** 127 * Try resizing a non-existent image 128 * @ticket 6821 129 */ 130 public function test_resize_non_existent_image() { 131 $classes = array('WP_Image_Editor_GD', 'WP_Image_Editor_Imagick'); 132 foreach ( $classes as $class ) { 133 if ( !$class::test() ) { 134 continue; 135 } 136 $filter = create_function( '', "return $class;" ); 137 add_filter( 'image_editor_class', $filter ); 138 $image = image_resize( DIR_TESTDATA.'/images/test-non-existent-image.jpg', 25, 25 ); 139 $this->assertInstanceOf( 'WP_Error', $image ); 140 $this->assertEquals( 'error_loading_image', $image->get_error_code() ); 141 } 142 } 143 144 /** 145 * Try resizing a php file (bad image) 146 * @ticket 6821 147 */ 148 public function test_resize_bad_image() { 149 $classes = array('WP_Image_Editor_GD', 'WP_Image_Editor_Imagick'); 150 foreach ( $classes as $class ) { 151 if ( !$class::test() ) { 152 continue; 153 } 154 $filter = create_function( '', "return $class;" ); 155 add_filter( 'image_editor_class', $filter ); 156 $image = image_resize( DIR_TESTDATA.'/export/crazy-cdata.xml', 25, 25 ); 157 $this->assertInstanceOf( 'WP_Error', $image ); 158 $this->assertEquals( 'invalid_image', $image->get_error_code() ); 159 } 160 } 126 161 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)