I’m trying to do WordPress Plugin Testing on Ubuntu 14.04 and I’m going through the setup of WP-CLI but I’m not able to download the necessary files (includes/functions.php).
This is the command I’m using:
bash bin/install-wp-tests.sh wordpress_test root '' localhost latest
This is the output:
+ install_wp
+ '[' -d /tmp/wordpress/ ']'
+ return
+ install_test_suite
++ uname -s
+ [[ Linux == Darwin ]]
+ local ioption=-i
+ '[' '!' -d /tmp/wordpress-tests-lib ']'
+ cd /tmp/wordpress-tests-lib
+ '[' '!' -f wp-tests-config.php ']'
+ download https://develop.svn.wordpress.org/trunk/wp-tests-config-sample.php /tmp/wordpress-tests-lib/wp-tests-config.php
++ which curl
+ '[' /opt/lampp/bin/curl ']'
+ curl -s https://develop.svn.wordpress.org/trunk/wp-tests-config-sample.php
+ sed -i 's:dirname( __FILE__ ) . '''/src/''':'''/tmp/wordpress/''':' /tmp/wordpress-tests-lib/wp-tests-config.php
+ sed -i s/youremptytestdbnamehere/wordpress_test/ /tmp/wordpress-tests-lib/wp-tests-config.php
+ sed -i s/yourusernamehere/root/ /tmp/wordpress-tests-lib/wp-tests-config.php
+ sed -i s/yourpasswordhere// /tmp/wordpress-tests-lib/wp-tests-config.php
+ sed -i 's|localhost|localhost|' /tmp/wordpress-tests-lib/wp-tests-config.php
+ install_db
+ PARTS=(${DB_HOST//:/ })
+ local PARTS
+ local DB_HOSTNAME=localhost
+ local DB_SOCK_OR_PORT=
+ local EXTRA=
+ '[' -z localhost ']'
++ echo
++ grep -e '^[0-9]{1,}$'
+ '[' ']'
+ '[' -z ']'
+ '[' -z localhost ']'
+ EXTRA=' --host=localhost --protocol=tcp'
+ mysqladmin create wordpress_test --user=root --password= --host=localhost --protocol=tcp
Warning: Using a password on the command line interface can be insecure.
On using the phpunit command it throws an error:
Fatal error: require_once(): Failed opening required '/tmp/wordpress-tests-lib/includes/functions.php' (include_path='.:/opt/lampp/lib/php')
I’m at the office so I think the firewall could be blocking this command, though I have set a proxy in /etc/environment.
Help is appreciated.
I had this problem and here is what you might try:
Confirm that
/tmp/wordpress-tests-lib
is missing theincludes
directory.Confirm that you have svn installed on the machine. If not run
sudo apt-get install subversion
Delete the
/tmp/wordpress-tests-lib
folderInside your plugin directory open up the
bin/install-wp-tests.sh
file and remove the quiet flag on the Subversion call. Change this line:Run the install shell script command again.
You should now be able to run PHPUnit and see the one default test passes.
I was having the same issue; resolved it by following the instructions here: https://github.com/wp-cli/wp-cli/wiki/Plugin-Unit-Tests . Specifically, I needed to initialize the testing environment.
bash bin/install-wp-tests.sh wordpress_test root '' localhost latest
where
wordpress_test
is test database,root
is DB user and''
contains password.Further Resources: