Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#33888 closed defect (bug) (invalid)

WP Test Suite utils: is_post_type_viewable() is used, but might not be defined

Reported by: tyxla's profile tyxla Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.4
Component: Build/Test Tools Keywords: close
Focuses: Cc:

Description

In _cleanup_query_vars() in the WordPress test suite utils.php, the is_post_type_viewable() function is used to assure that only the viewable post type query vars are added.

This is fine and makes perfect sense, but since is_post_type_viewable() is a new function (introduced in [33666]), it is not available in 4.3 and older versions. This basically ruins backward compatibility, and prevents testing 4.3 and older versions.

This is particularly an issue if running tests for a WordPress plugin or theme with any CI tool (like Travis) and testing with the following env config in .travis.yml:

env:
  - WP_VERSION=4.3 WP_MULTISITE=0
  - WP_VERSION=4.2 WP_MULTISITE=0
  - WP_VERSION=4.1 WP_MULTISITE=0
  - WP_VERSION=4.0 WP_MULTISITE=0

The problematic modification appears to have been introduced in [34215], a little more than an hour ago.

Change History (5)

#1 follow-up: @ocean90
9 years ago

  • Keywords reporter-feedback added

Why are you using the tests of trunk and not the tests from the specific branches?

#2 @tyxla
9 years ago

  • Keywords close added; reporter-feedback removed
  • Resolution set to invalid
  • Status changed from new to closed

@ocean90: good point, thanks.

#3 in reply to: ↑ 1 ; follow-up: @jdgrimes
9 years ago

Replying to ocean90:

Why are you using the tests of trunk and not the tests from the specific branches?

Because the tests in trunk may have added sugar that isn't in the older branches. Yes, it may make more sense to test with the tests from the same branch, but this is currently the convention used across a wide range of plugins.

#4 in reply to: ↑ 3 @boonebgorges
9 years ago

  • Milestone Awaiting Review deleted

Replying to jdgrimes:

Replying to ocean90:

Why are you using the tests of trunk and not the tests from the specific branches?

Because the tests in trunk may have added sugar that isn't in the older branches. Yes, it may make more sense to test with the tests from the same branch, but this is currently the convention used across a wide range of plugins.

I'm the author of a number of plugins that leverage core tests in the way described here. But it's my responsibility as a plugin author to provide necessary shims/compat functions in cases where my tests need them. The alternative is for the core utils not to use new functions for a specified number of versions (how many? one? three?), which doesn't seem reasonable to me.

This ticket was mentioned in Slack in #core by boone. View the logs.


9 years ago

Note: See TracTickets for help on using tickets.