Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attachment unit tests suddenly failing #8473

Closed
ashleyfae opened this issue Mar 11, 2021 · 1 comment · Fixed by #8475 or #8502
Closed

Attachment unit tests suddenly failing #8473

ashleyfae opened this issue Mar 11, 2021 · 1 comment · Fixed by #8475 or #8502

Comments

@ashleyfae
Copy link
Contributor

Bug Report

Some of our attachment-related unit tests are suddenly sporadically failing. For example: https://buildkite.com/sandhills-development-llc/easy-digital-downloads/builds/339#8a0a10a5-23b7-42cb-af04-c58af76dea20

There were 4 errors:

1) Tests_Query_Filters::test_edd_block_attachments_no_parent_bail

getimagesize(../assets/images/loading.gif): failed to open stream: No such file or directory

/tmp/wordpress/wp-includes/media.php:4985
/tmp/wordpress/wp-admin/includes/image.php:917
/tmp/wordpress/wp-admin/includes/image.php:482
/tmp/PvF7Jx5jvhhLuSD6If66N8W5EYihzFJq/tests/tests-query-filters.php:53


2) Tests_Query_Filters::test_edd_block_attachments_no_download_bail

getimagesize(../assets/images/loading.gif): failed to open stream: No such file or directory

/tmp/wordpress/wp-includes/media.php:4985
/tmp/wordpress/wp-admin/includes/image.php:917
/tmp/wordpress/wp-admin/includes/image.php:482
/tmp/PvF7Jx5jvhhLuSD6If66N8W5EYihzFJq/tests/tests-query-filters.php:95


3) Tests_Query_Filters::test_edd_block_attachments_not_restricted_bail

getimagesize(../assets/images/loading.gif): failed to open stream: No such file or directory

/tmp/wordpress/wp-includes/media.php:4985
/tmp/wordpress/wp-admin/includes/image.php:917
/tmp/wordpress/wp-admin/includes/image.php:482
/tmp/PvF7Jx5jvhhLuSD6If66N8W5EYihzFJq/tests/tests-query-filters.php:157


4) Tests_Query_Filters::test_edd_block_attachments_die

getimagesize(../assets/images/loading.gif): failed to open stream: No such file or directory

/tmp/wordpress/wp-includes/media.php:4985
/tmp/wordpress/wp-admin/includes/image.php:917
/tmp/wordpress/wp-admin/includes/image.php:482
/tmp/PvF7Jx5jvhhLuSD6If66N8W5EYihzFJq/tests/tests-query-filters.php:219

I'm not quite sure why because:

  1. Those files do exist.
  2. The unit tests will pass in some environments, but randomly(?) not a couple others. So it's not failing all the time.
  3. That code hasn't changed.

I initially experimented with changing the file path from relative:

$filename 		= '../assets/images/loading.gif';

to absolute:

$filename 		= EDD_PLUGIN_DIR . '/assets/images/loading.gif';

and that appeared to fix the problem for me, but broke it for Robin.

Information (if a specific version is affected):

PHP Version:

EDD Version (or branch): Master could be affected, but it's hard to tell because there's more movement going in 3.0. Definitely seen the issues in the 3.0 branch though.

WordPress Version:

Any other relevant information:

@ashleyfae
Copy link
Contributor Author

ashleyfae commented Mar 12, 2021

I think the unit tests fail with WordPress latest

Screenshot from 2021-03-12 09-17-55

Looks like 5.7 introduced wp_getimagesize(), wh ich is used in file_is_displayable_image(). wp_getimagesize() is running getimagesize(), which is failing.

@ashleyfae ashleyfae linked a pull request Mar 12, 2021 that will close this issue
ashleyfae added a commit that referenced this issue Mar 17, 2021
Use absolute file paths instead of relative #8473
@ashleyfae ashleyfae added this to the 3.0 milestone Mar 17, 2021
@ashleyfae ashleyfae modified the milestones: 3.0, 2.10.2 Mar 22, 2021
ashleyfae added a commit that referenced this issue Mar 22, 2021
Fix attachment unit tests in WordPress 5.7 #8473
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant