@@ -23,6 +23,8 @@ public function wp_image_editors() {
2323 public function test_resize_jpg () {
2424 $ image = $ this ->resize_helper ( DIR_TESTDATA . '/images/test-image.jpg ' , 25 , 25 );
2525
26+ $ this ->assertNotWPError ( $ image );
27+
2628 list ( $ w , $ h , $ type ) = getimagesize ( $ image );
2729
2830 unlink ( $ image );
@@ -78,6 +80,8 @@ public function test_resize_webp() {
7880
7981 $ image = $ this ->resize_helper ( $ file , 25 , 25 );
8082
83+ $ this ->assertNotWPError ( $ image );
84+
8185 list ( $ w , $ h , $ type ) = wp_getimagesize ( $ image );
8286
8387 unlink ( $ image );
@@ -104,6 +108,8 @@ public function test_resize_avif() {
104108
105109 $ image = $ this ->resize_helper ( $ file , 25 , 25 );
106110
111+ $ this ->assertNotWPError ( $ image );
112+
107113 list ( $ w , $ h , $ type ) = wp_getimagesize ( $ image );
108114
109115 unlink ( $ image );
@@ -130,6 +136,8 @@ public function test_resize_heic() {
130136
131137 $ image = $ this ->resize_helper ( $ file , 25 , 25 );
132138
139+ $ this ->assertNotWPError ( $ image );
140+
133141 list ( $ w , $ h , $ type ) = wp_getimagesize ( $ image );
134142
135143 unlink ( $ image );
@@ -151,6 +159,8 @@ public function test_resize_larger() {
151159 public function test_resize_thumb_128x96 () {
152160 $ image = $ this ->resize_helper ( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG ' , 128 , 96 );
153161
162+ $ this ->assertNotWPError ( $ image );
163+
154164 list ( $ w , $ h , $ type ) = getimagesize ( $ image );
155165
156166 unlink ( $ image );
@@ -164,6 +174,8 @@ public function test_resize_thumb_128x96() {
164174 public function test_resize_thumb_128x0 () {
165175 $ image = $ this ->resize_helper ( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG ' , 128 , 0 );
166176
177+ $ this ->assertNotWPError ( $ image );
178+
167179 list ( $ w , $ h , $ type ) = getimagesize ( $ image );
168180
169181 unlink ( $ image );
@@ -177,6 +189,8 @@ public function test_resize_thumb_128x0() {
177189 public function test_resize_thumb_0x96 () {
178190 $ image = $ this ->resize_helper ( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG ' , 0 , 96 );
179191
192+ $ this ->assertNotWPError ( $ image );
193+
180194 list ( $ w , $ h , $ type ) = getimagesize ( $ image );
181195
182196 unlink ( $ image );
@@ -190,6 +204,8 @@ public function test_resize_thumb_0x96() {
190204 public function test_resize_thumb_150x150_crop () {
191205 $ image = $ this ->resize_helper ( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG ' , 150 , 150 , true );
192206
207+ $ this ->assertNotWPError ( $ image );
208+
193209 list ( $ w , $ h , $ type ) = getimagesize ( $ image );
194210
195211 unlink ( $ image );
@@ -203,6 +219,8 @@ public function test_resize_thumb_150x150_crop() {
203219 public function test_resize_thumb_150x100_crop () {
204220 $ image = $ this ->resize_helper ( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG ' , 150 , 100 , true );
205221
222+ $ this ->assertNotWPError ( $ image );
223+
206224 list ( $ w , $ h , $ type ) = getimagesize ( $ image );
207225
208226 unlink ( $ image );
@@ -216,6 +234,8 @@ public function test_resize_thumb_150x100_crop() {
216234 public function test_resize_thumb_50x150_crop () {
217235 $ image = $ this ->resize_helper ( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG ' , 50 , 150 , true );
218236
237+ $ this ->assertNotWPError ( $ image );
238+
219239 list ( $ w , $ h , $ type ) = getimagesize ( $ image );
220240
221241 unlink ( $ image );
@@ -240,6 +260,8 @@ public function test_resize_non_existent_image() {
240260
241261 /**
242262 * Function to help out the tests
263+ *
264+ * @return string|WP_Error The path to the resized image file or a WP_Error on failure.
243265 */
244266 protected function resize_helper ( $ file , $ width , $ height , $ crop = false ) {
245267 $ editor = wp_get_image_editor ( $ file );
0 commit comments