Open fklein-lu opened 9 years ago
Great write up. We definitely need to add a section to the readme on how to get this running.
I don't think its a WP-CLI issue as such... but rather the latest version of wordpress-tests-lib
requires WP trunk (not latest stable). I guess we used the scaffold plugin
command from WP-CLI when creating the plugin - hence the WP-CLI connection here.
Once 4.4 is released, I think this should just work :smile:
Also - If we need to define any environment variables - this should be documented in the readme. I had to add WP_TEST_DIR
and WP_CONFIG_DIR
to get this running.
Okay, so since WordPress 4.4 is slated for early December, let's hold off on this until it gets released.
We'll then revisit and see what errors persist, and what steps need to be taken.
Currently it is very difficult to install and run the plugin's unit tests on either Salty WordPress or VVV.
With Salty WordPress, the
bin/install-wp-tests.sh
script needs to be run first. This is not marked in any documentation. After the script has finished running, you get the following error:PHP Fatal error: Class 'WP_REST_Server' not found in /srv/www/wordpress-develop.dev/tests/phpunit/includes/spy-rest-server.php on line 3
This is due to WP CLI issue: https://github.com/wp-cli/wp-cli/issues/2129, and the solution is to update the install script based on this: https://raw.githubusercontent.com/wp-cli/wp-cli/master/templates/install-wp-tests.sh
After having done this, we encounter the same issue as on VVV, that does not need any set up. This is the error you get:
I fixed this error by replacing the
tests/bootstrap.php
file with the following code:This makes the unit tests run successfully.
What I think we need to do is: