wp-cli: Test suite for abstracted command package runs against wrong code

Houston, we have a problem.

When a command is abstracted out to a separate package (#3728), its test suite is incorrectly run against the version of the command included in the current WP-CLI nightly build, not the version of the command in the package repository.

To illustrate, here’s a PR that should fail its tests, but doesn’t: https://github.com/wp-cli/cron-command/pull/3

In this example:

  • bin/install-wp-tests.sh downloads wp-cli-nightly.php from GitHub, for use in the test suite: https://github.com/wp-cli/cron-command/blob/master/bin/install-package-tests.sh#L21
  • wp-cli-nightly.php includes a copy of class Cron_Command from the point at which the Phar package was built.
  • Because the nightly’s copy of class Cron_Command is autoloaded before the package repository’s copy, the test suite is run against wp cron * present in the nightly build, not that represented by the code in the repository.

The expectation is that the repository’s copy of class Cron_Command is registered over the nightly’s copy.

Open to all sorts of creative ideas for how we should address this issue.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 32 (32 by maintainers)

Commits related to this issue

Most upvoted comments

Yes, but I thought the problem came from using a PHAR while testing?

It did, yes.

Won’t we ever have the need to make this work with PHARs?

Probably yes, but it’s no longer the omgwtfbbq blocker for proceeding with #3728 (and actually improving upon the packages).