You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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:
PHP Notice: Undefined variable: test_root in /srv/www/s3-uploads/htdocs/wp-content/plugins/s3-uploads/tests/bootstrap.php on line 21
PHP Warning: require(/includes/functions.php): failed to open stream: No such file or directory in /srv/www/s3-uploads/htdocs/wp-content/plugins/s3-uploads/tests/bootstrap.php on line 21
PHP Fatal error: require(): Failed opening required '/includes/functions.php' (include_path='/usr/local/src/composer/vendor/phpunit/php-file-iterator:/usr/local/src/composer/vendor/phpunit/phpunit:/usr/local/src/composer/vendor/symfony/yaml:.:/usr/share/php:/usr/share/pear') in /srv/www/s3-uploads/htdocs/wp-content/plugins/s3-uploads/tests/bootstrap.php on line 21
I fixed this error by replacing the tests/bootstrap.php file with the following code:
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 😄
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.
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: wp-cli/wp-cli#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:
The text was updated successfully, but these errors were encountered: