scaffold-command
scaffold-command copied to clipboard
Testing against other WordPress versions
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.shcommand. - For back compatibility with the
$WP_CORE_DIRdirectory.
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.
Would it be an Idea to add a flag
--force-updateto theinstall-wp-tests.shcommand that allows you to update WP regardless if the$WP_CORE_DIRdirectory already exists?
How would this be different than running rm $WP_CORE_DIR before install-wp-tests.sh?
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.