PHP Unit + WP-CLI + wp_read_image_metadata (file_exists)
-
Hi, I’m writing unit tests for a plugin which extracts EXIF data from images.
The plugin works, but the tests are failing.
Specifically, I’m unable to use
wp_read_image_metadatawith the [attachment factory](http://develop.svn.wordpress.org/trunk/tests/phpunit/includes/factory/class-wp-unittest-factory-for-attachment.php).It seems that the factory uploads an image to a path, which can be returned by
get_attached_file(), but doesn’t resolve to a real file. This means that it can’t be inspected bywp_read_image_metadata().The root problem seems to be that the ‘file’ fails PHP’s
file_existscheck. This causeswp_read_image_metadata()to exit withfalse.Inspecting the directory path identified by
get_attached_file()shows an empty folder.More details on the linked Github issue.
Many thanks,
DanThe page I need help with: [log in to see the link]
The topic ‘PHP Unit + WP-CLI + wp_read_image_metadata (file_exists)’ is closed to new replies.