wp-cli / scaffold-package-command

Scaffolds WP-CLI commands with functional tests, full README.md, and more.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Behat tests should use WP-CLI pulled-in via Composer

schlessera opened this issue · comments

The Behat tests currently spawn new processes in several places to use wp to do all kinds of stuff.

I haven't thought through all of the consequences of this, but I think that the Behat tests should default to using vendor/bin/wp if it is available, and only fall back to the globally installed on (or the one available within the include path at least) when the Composer one is not available.

Otherwise, when running tests, the results are polluted by the surrounding environment, instead of using the exact version that was given as a Composer dependency.

Changing the following line to refer to /../../vendor/bin instead of /../../bin seems to fix the issue: https://github.com/wp-cli/wp-cli/blob/72039400fa1aaada00d4c94522dd15426e0801a9/features/bootstrap/FeatureContext.php#L62

Before making that change, we should discuss whether there are use cases where /../../bin would actually be the correct folder.

So, for wp-cli/wp-cli package itself, /../../bin is actually the correct path: https://github.com/wp-cli/wp-cli/

This means that we should prepend the composer one to the include path, instead of just replacing the /../../bin folder.

Closed in favor of wp-cli/wp-cli#3946