WordPress.org

Make WordPress Core

Opened 8 months ago

Closed 8 months ago

Last modified 8 months ago

#51594 closed defect (bug) (fixed)

WP_PLUGIN_DIR constant unintentionally breaks plugin tests

Reported by: pierlo Owned by: SergeyBiryukov
Milestone: 5.6 Priority: high
Severity: major Version: 5.6
Component: Build/Test Tools Keywords: has-patch has-unit-tests
Focuses: Cc:

Description (last modified by pierlo)

A recent change was made to the PHPUnit bootstrap file that sets WP_PLUGIN_DIR to the path of the plugin test data directory (tests/phpunit/data/plugins). This modification will unintentionally break a lot of tests for non-core plugins that rely on WP_PLUGIN_DIR being set to the expected plugins directory in WP_CONTENT_DIR or already have the constant defined.

Since the WP_PLUGIN_DIR constant is only needed when Core tests are to be run, I'd like to propose that the constant will only be set when WP_RUN_CORE_TESTS has a truthy value.

Change History (4)

This ticket was mentioned in PR #642 on WordPress/wordpress-develop by pierlon.


8 months ago

  • Keywords has-patch has-unit-tests added

#2 @pierlo
8 months ago

  • Description modified (diff)

#3 @SergeyBiryukov
8 months ago

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

In 49269:

Build/Test Tools: Only define WP_PLUGIN_DIR in when running core tests.

This takes into account non-core plugins that rely on WP_PLUGIN_DIR being set to the expected plugin's directory in WP_CONTENT_DIR, or already have the constant defined.

Follow-up to [49236].

Props pierlo.
Fixes #51594.

Note: See TracTickets for help on using tickets.