scaffold-command icon indicating copy to clipboard operation
scaffold-command copied to clipboard

Testing against other WordPress versions

Open keesiemeijer opened this issue 7 years ago • 2 comments

As mentioned in https://github.com/wp-cli/wp-cli/issues/2119#issuecomment-148115945, you can't test against other WP versions than the version in the $WP_CORE_DIR directory. As I see it there are two reasons this exists.

  • To not re-download WordPress again and again when using the install-wp-tests.sh command.
  • For back compatibility with the $WP_CORE_DIR directory.

The $WP_CORE_DIR is an environment variable you can set to use an existing WordPress install for the PHPUnit tests. For back compatibility it's not expected the install-wp-tests.sh command installs other WordPress versions in that directory.

On the other hand when setting a specific $WP_VERSION it is expected you test your plugin against that WP version.

Would it be an Idea to add a flag --force-update to the install-wp-tests.sh command that allows you to update WP regardless if the $WP_CORE_DIR directory already exists?

On an unrelated note we could also convert the skip-database-creation argument to a flag, to not create too many arguments.

keesiemeijer avatar Jun 11 '17 13:06 keesiemeijer

Would it be an Idea to add a flag --force-update to the install-wp-tests.sh command that allows you to update WP regardless if the $WP_CORE_DIR directory already exists?

How would this be different than running rm $WP_CORE_DIR before install-wp-tests.sh?

danielbachhuber avatar Jun 11 '17 14:06 danielbachhuber

I'm using VVV to work on WordPress core. There the $WP_CORE_DIR is set to the wordpress-develop (trunk) directory. In other dev environments I just use the default /tmp/wordpress directory where I don't mind if it's deleted or other WP versions installed.

A problem with deleting is that I would then also have to delete the $WP_TESTS_DIR directory to have install-wp-tests.sh re-install the correct test suite version (and wp-tests-config-sample.php). I would also have to check if the $WP_CORE_DIR and $WP_TESTS_DIR directories are actually set before deleting.

It would be nice to just re-use the install-wp-tests.sh command to do all this for me and allow me to use specific WP versions where needed.

keesiemeijer avatar Jun 11 '17 15:06 keesiemeijer