Tests: Check if image metadata for a particular size was successfully retrieved in some media tests.

This outputs a proper message in case of failure, instead of an obscure PHP error further in the test.

See #50913.

git-svn-id: https://develop.svn.wordpress.org/trunk@49032 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-09-22 12:30:48 +00:00
parent c263d2e56c
commit a9ee47c806

View File

@ -1430,7 +1430,7 @@ EOF;
} }
/** /**
* Helper function to get image size array from size "name" * Helper function to get image size array from size "name".
*/ */
function _get_image_size_array_from_meta( $image_meta, $size_name ) { function _get_image_size_array_from_meta( $image_meta, $size_name ) {
$array = false; $array = false;
@ -1443,6 +1443,10 @@ EOF;
} }
} }
if ( ! $array ) {
$this->fail( sprintf( "Could not retrieve image metadata for size '%s'.", $size_name ) );
}
return $array; return $array;
} }