Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add functional tests for CLI commands #3076

Closed
schlessera opened this issue Aug 22, 2019 · 1 comment · Fixed by #6070
Closed

Add functional tests for CLI commands #3076

schlessera opened this issue Aug 22, 2019 · 1 comment · Fixed by #6070
Labels
Infrastructure Changes impacting testing infrastructure or build tooling P2 Low priority Testing Issues related with Unit, E2E, Smoke, and other testing requirements/needs WP-CLI WS:Perf Work stream for Metrics, Performance and Optimizer
Milestone

Comments

@schlessera
Copy link
Collaborator

schlessera commented Aug 22, 2019

The obvious choice would be reusing wp-cli/wp-cli-tests to write Behat tests, but there seems to be a blocking technical issue so far that doesn't allow this without resorting to a hack.

The main issue is that you need to install the plugin within the WordPress installation that Behat will set up. To do so, you use a built plugin version and send it over for installation as a ZIP archive.

However, this built version will contain the same Composer autoloader (with the same hash included in the class name) than the Composer autoloader that Behat was actually run from. This causes a redeclaration error from PHP when the WordPress installation tries to load the plugin.

I can think of two possible solutions right now to solve this:
1.) Rebuild a fresh ZIP archive with a regenerated autoloader that will have a different hash than the one Behat was loaded from.
2.) Avoid using Behat directly as a Composer dependency and use a binary/Phar instead, that comes with its own autoloader.

Before trying to tackle this, I'd like to investigate this from the WP-CLI side, to see whether this can be streamlined through the official package first.

Related #1815

@schlessera schlessera added Infrastructure Changes impacting testing infrastructure or build tooling WP-CLI labels Aug 22, 2019
@amedina
Copy link
Member

amedina commented Apr 1, 2020

@schlessera Any updates on your exploration here?

@westonruter westonruter added P2 Low priority Testing Issues related with Unit, E2E, Smoke, and other testing requirements/needs labels Apr 12, 2020
@kmyram kmyram added the WS:Perf Work stream for Metrics, Performance and Optimizer label Aug 5, 2020
@westonruter westonruter added this to the v2.1 milestone Apr 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Infrastructure Changes impacting testing infrastructure or build tooling P2 Low priority Testing Issues related with Unit, E2E, Smoke, and other testing requirements/needs WP-CLI WS:Perf Work stream for Metrics, Performance and Optimizer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants