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

Rewrite install-wp-tests.sh as a WP-CLI command #2119

Closed
danielbachhuber opened this issue Oct 7, 2015 · 4 comments
Closed

Rewrite install-wp-tests.sh as a WP-CLI command #2119

danielbachhuber opened this issue Oct 7, 2015 · 4 comments

Comments

@danielbachhuber
Copy link
Member

Pros:

  • We can more easily write tests around it to better help prevent scenarios like v0.19.1 and v0.19.2.
  • It would be written in PHP, so contribution isn't limited to just those who are bash hackers.
  • We can make use of WP-CLI utilities like WP_CLI::log().

Con:

  • Adds a dependency on WP-CLI in the plugin test setup process.
@mAAdhaTTah
Copy link

I don't know if this counts as a bug, but if I have wp-cli required as a dependency for a plugin I'm working on, which is installed in a WordPress install, and I run wp-cli from a globally installed phar, I've gotten some either class missing or cannot redeclare class errors (can't remember offhand).

Which means I haven't been requiring wp-cli as a dev dependency in my plugins.

I like the idea of having the test installer as a wp-cli command, but the way it's currently autoloaded conflicts when it's a plugin dependency. Also, does wp-cli only function within a Wordpress context? How would this work for running the installer for plugin tests?

@danielbachhuber
Copy link
Member Author

@mAAdhaTTah Please open a separate issue for your question.

@danielbachhuber
Copy link
Member Author

From #2050 (comment)

Another point regarding the new install-wp-tests.sh code when installing WordPress for the tests:

if [ -d $WP_CORE_DIR ]; then
        return;
fi

Consider the following scenario:

Do tests for WordPress latest (4.3.1) with

bash bin/install-wp-tests.sh wordpress_test root '' localhost latest
phpunit

This will create the WP core directory and use the latest WordPress version for your test.
After that do tests for WordPress 4.2

bash bin/install-wp-tests.sh wordpress_test root '' localhost 4.2
phpunit

Now the WP core directory exists (with WP 4.3.1 ) and as a result you test with the wrong version of WP (4.3.1) instead of the version you wanted (4.2) .

There should be a check if the WP core directory contains the WordPress version you want to test against. Or just download the correct WP version without checking.

@danielbachhuber
Copy link
Member Author

install-wp-tests.sh is quite stable at this point. Rewriting the script is more work than benefit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants