WordPress.org

Make WordPress Core

Opened 4 months ago

Closed 4 months ago

#52606 closed defect (bug) (fixed)

Investigate why the media test group errors when run on its own

Reported by: johnbillion Owned by: SergeyBiryukov
Milestone: 5.7 Priority: normal
Severity: normal Version:
Component: Media Keywords: needs-unit-tests
Focuses: Cc:

Description

When the media test group is run on its own it fails with errors.

composer test -- --group media

There were 2 errors:

1) Tests_Post_Attachments::test_wp_get_attachment_url_should_force_https_with_https_on_same_host_when_siteurl_is_non_ssl_but_ssl_is_available
Undefined index: pagenow

/var/www/build/wp-includes/post.php:6322
/var/www/tests/phpunit/tests/post/attachments.php:359

2) Tests_Post_Attachments::test_wp_get_attachment_url_with_https_on_same_host_when_siteurl_is_https
Undefined index: pagenow

/var/www/build/wp-includes/post.php:6322
/var/www/tests/phpunit/tests/post/attachments.php:387

Notably these two tests do not error when they are run individually nor when they are run as part of the entire suite. They only error when the media group is run on its own.

Change History (2)

#1 @SergeyBiryukov
4 months ago

  • Milestone changed from Awaiting Review to 5.7

This is likely the same issue as in [50393] / #52566 and would probably require the same fix.

Moving to 5.7, since this appears to be a regression.

#2 @SergeyBiryukov
4 months ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 50406:

Media: Explicitly declare the $pagenow global in wp_get_attachment_url().

This avoids an "Undefined index" PHP notice in the function when running the media test group separately.

Follow-up to [32342], [50156], [50164], [50393].

Props johnbillion.
Fixes #52606.

Note: See TracTickets for help on using tickets.