Skip to content

Instantly share code, notes, and snippets.

@justinwhall
Last active June 4, 2017 17:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinwhall/ff10c5da5639157f6b209ef0fb900e63 to your computer and use it in GitHub Desktop.
Save justinwhall/ff10c5da5639157f6b209ef0fb900e63 to your computer and use it in GitHub Desktop.
// 1. $ wp scaffold plugin-tests myplugin
// 2. bash bin/install-wp-tests.sh wordpress_test root root localhost latest (on plugin directory. Terminal results:)
root@b96f5ad58969:/app/public/wp-content/plugins/myplugin# bash bin/install-wp-tests.sh wordpress_test root root localhost latest
2017-06-03 00:24:13 URL:http://api.wordpress.org/core/version-check/1.7/ [568] -> "/tmp/wp-latest.json" [1]
+ install_wp
+ '[' -d /tmp/wordpress/ ']'
+ return
+ install_test_suite
++ uname -s
+ [[ Linux == \D\a\r\w\i\n ]]
+ local ioption=-i
+ '[' '!' -d /tmp/wordpress-tests-lib ']'
+ '[' '!' -f wp-tests-config.php ']'
+ download https://develop.svn.wordpress.org/tags/4.7.5/wp-tests-config-sample.php /tmp/wordpress-tests-lib/wp-tests-config.php
++ which curl
+ '[' ']'
++ which wget
+ '[' /usr/bin/wget ']'
+ wget -nv -O /tmp/wordpress-tests-lib/wp-tests-config.php https://develop.svn.wordpress.org/tags/4.7.5/wp-tests-config-sample.php
2017-06-03 00:24:13 URL:https://develop.svn.wordpress.org/tags/4.7.5/wp-tests-config-sample.php [1611/1611] -> "/tmp/wordpress-tests-lib/wp-tests-config.php" [1]
++ sed 's:/\+$::'
++ echo /tmp/wordpress/
+ WP_CORE_DIR=/tmp/wordpress
+ 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/root/ /tmp/wordpress-tests-lib/wp-tests-config.php
+ sed -i 's|localhost|localhost|' /tmp/wordpress-tests-lib/wp-tests-config.php
+ install_db
+ '[' false = true ']'
+ PARTS=(${DB_HOST//\:/ })
+ local PARTS
+ local DB_HOSTNAME=localhost
+ local DB_SOCK_OR_PORT=
+ local EXTRA=
+ '[' -z localhost ']'
++ grep -e '^[0-9]\{1,\}$'
++ echo
+ '[' ']'
+ '[' -z ']'
+ '[' -z localhost ']'
+ EXTRA=' --host=localhost --protocol=tcp'
// 3. $ phpunit
Warning: require_once(/tmp/wordpress-tests-lib/includes/functions.php): failed to open stream: No such file or directory in /app/public/wp-content/plugins/myplugin/tests/bootstrap.php on line 14
Call Stack:
0.0005 482296 1. {main}() /usr/local/bin/phpunit:0
0.0534 8005544 2. PHPUnit\TextUI\Command::main() /usr/local/bin/phpunit:546
0.0534 8005656 3. PHPUnit\TextUI\Command->run() phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:141
0.0534 8005656 4. PHPUnit\TextUI\Command->handleArguments() phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:152
0.0558 8009328 5. PHPUnit\TextUI\Command->handleBootstrap() phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:735
0.0558 8009328 6. PHPUnit\Util\Fileloader::checkAndLoad() phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:913
0.0565 8009552 7. PHPUnit\Util\Fileloader::load() phar:///usr/local/bin/phpunit/phpunit/Util/Fileloader.php:45
0.0568 8013192 8. include_once('/app/public/wp-content/plugins/littlebot/tests/bootstrap.php') phar:///usr/local/bin/phpunit/phpunit/Util/Fileloader.php:61
Fatal error: require_once(): Failed opening required '/tmp/wordpress-tests-lib/includes/functions.php' (include_path='.:') in /app/public/wp-content/plugins/myplugin/tests/bootstrap.php on line 14
Call Stack:
0.0005 482296 1. {main}() /usr/local/bin/phpunit:0
0.0534 8005544 2. PHPUnit\TextUI\Command::main() /usr/local/bin/phpunit:546
0.0534 8005656 3. PHPUnit\TextUI\Command->run() phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:141
0.0534 8005656 4. PHPUnit\TextUI\Command->handleArguments() phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:152
0.0558 8009328 5. PHPUnit\TextUI\Command->handleBootstrap() phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:735
0.0558 8009328 6. PHPUnit\Util\Fileloader::checkAndLoad() phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:913
0.0565 8009552 7. PHPUnit\Util\Fileloader::load() phar:///usr/local/bin/phpunit/phpunit/Util/Fileloader.php:45
0.0568 8013192 8. include_once('/app/public/wp-content/plugins/myplugin/tests/bootstrap.php') phar:///usr/local/bin/phpunit/phpunit/Util/Fileloader.php:61
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment