-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from miya0001/add-tests-for-install-wp-tests
add behat tests for install-wp-tests.sh
- Loading branch information
Showing
1 changed file
with
188 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,188 @@ | ||
Feature: Scaffold install-wp-tests.sh tests | ||
|
||
Scenario: Help should be displayed | ||
When I try `/usr/bin/env bash templates/install-wp-tests.sh` | ||
Then STDOUT should contain: | ||
""" | ||
usage: | ||
""" | ||
And the return code should be 1 | ||
|
||
Scenario: Install latest version of WordPress | ||
Given I run `echo "DROP DATABASE IF EXISTS wordpress_behat_test" | mysql -u root` | ||
And I try `rm -fr /tmp/behat-wordpress-tests-lib` | ||
And I try `rm -fr /tmp/behat-wordpress` | ||
And I run `pwd` | ||
And save STDOUT as {WORK_DIR} | ||
And a WP install | ||
And I run `wp plugin path` | ||
And save STDOUT as {PLUGIN_DIR} | ||
|
||
When I run `WP_TESTS_DIR=/tmp/behat-wordpress-tests-lib WP_CORE_DIR=/tmp/behat-wordpress /usr/bin/env bash {WORK_DIR}/templates/install-wp-tests.sh wordpress_behat_test root '' localhost latest` | ||
Then the return code should be 0 | ||
And the /tmp/behat-wordpress-tests-lib directory should contain: | ||
""" | ||
data | ||
""" | ||
And the /tmp/behat-wordpress-tests-lib directory should contain: | ||
""" | ||
includes | ||
""" | ||
And the /tmp/behat-wordpress-tests-lib directory should contain: | ||
""" | ||
wp-tests-config.php | ||
""" | ||
And the /tmp/behat-wordpress directory should contain: | ||
""" | ||
index.php | ||
license.txt | ||
readme.html | ||
wp-activate.php | ||
wp-admin | ||
wp-blog-header.php | ||
wp-comments-post.php | ||
wp-config-sample.php | ||
wp-content | ||
wp-cron.php | ||
wp-includes | ||
wp-links-opml.php | ||
wp-load.php | ||
wp-login.php | ||
wp-mail.php | ||
wp-settings.php | ||
wp-signup.php | ||
wp-trackback.php | ||
xmlrpc.php | ||
""" | ||
|
||
When I run `echo 'show databases' | mysql -u root` | ||
Then the return code should be 0 | ||
And STDOUT should contain: | ||
""" | ||
wordpress_behat_test | ||
""" | ||
|
||
When I run `wp scaffold plugin hello-world` | ||
Then the {PLUGIN_DIR}/hello-world/phpunit.xml.dist file should exist | ||
|
||
When I run `WP_TESTS_DIR=/tmp/behat-wordpress-tests-lib phpunit -c {PLUGIN_DIR}/hello-world/phpunit.xml.dist` | ||
Then the return code should be 0 | ||
|
||
Scenario: Install WordPress from trunk | ||
Given I run `echo "DROP DATABASE IF EXISTS wordpress_behat_test" | mysql -u root` | ||
And I try `rm -fr /tmp/behat-wordpress-tests-lib` | ||
And I try `rm -fr /tmp/behat-wordpress` | ||
And I run `pwd` | ||
And save STDOUT as {WORK_DIR} | ||
And a WP install | ||
And I run `wp plugin path` | ||
And save STDOUT as {PLUGIN_DIR} | ||
|
||
When I run `WP_TESTS_DIR=/tmp/behat-wordpress-tests-lib WP_CORE_DIR=/tmp/behat-wordpress /usr/bin/env bash {WORK_DIR}/templates/install-wp-tests.sh wordpress_behat_test root '' localhost trunk` | ||
Then the return code should be 0 | ||
And the /tmp/behat-wordpress-tests-lib directory should contain: | ||
""" | ||
data | ||
""" | ||
And the /tmp/behat-wordpress-tests-lib directory should contain: | ||
""" | ||
includes | ||
""" | ||
And the /tmp/behat-wordpress-tests-lib directory should contain: | ||
""" | ||
wp-tests-config.php | ||
""" | ||
And the /tmp/behat-wordpress directory should contain: | ||
""" | ||
index.php | ||
license.txt | ||
readme.html | ||
wp-activate.php | ||
wp-admin | ||
wp-blog-header.php | ||
wp-comments-post.php | ||
wp-config-sample.php | ||
wp-content | ||
wp-cron.php | ||
wp-includes | ||
wp-links-opml.php | ||
wp-load.php | ||
wp-login.php | ||
wp-mail.php | ||
wp-settings.php | ||
wp-signup.php | ||
wp-trackback.php | ||
xmlrpc.php | ||
""" | ||
And the /tmp/behat-wordpress/wp-includes/version.php file should contain: | ||
""" | ||
-alpha- | ||
""" | ||
|
||
When I run `echo 'show databases' | mysql -u root` | ||
Then the return code should be 0 | ||
And STDOUT should contain: | ||
""" | ||
wordpress_behat_test | ||
""" | ||
|
||
When I run `wp scaffold plugin hello-world` | ||
Then the {PLUGIN_DIR}/hello-world/phpunit.xml.dist file should exist | ||
|
||
When I run `WP_TESTS_DIR=/tmp/behat-wordpress-tests-lib phpunit -c {PLUGIN_DIR}/hello-world/phpunit.xml.dist` | ||
Then the return code should be 0 | ||
|
||
Scenario: Install WordPress 3.7 and phpunit will not run | ||
Given I run `echo "DROP DATABASE IF EXISTS wordpress_behat_test" | mysql -u root` | ||
And I try `rm -fr /tmp/behat-wordpress-tests-lib` | ||
And I try `rm -fr /tmp/behat-wordpress` | ||
And I run `pwd` | ||
And save STDOUT as {WORK_DIR} | ||
|
||
When I run `WP_TESTS_DIR=/tmp/behat-wordpress-tests-lib WP_CORE_DIR=/tmp/behat-wordpress /usr/bin/env bash {WORK_DIR}/templates/install-wp-tests.sh wordpress_behat_test root '' localhost 3.7` | ||
Then the return code should be 0 | ||
And the /tmp/behat-wordpress-tests-lib directory should contain: | ||
""" | ||
data | ||
""" | ||
And the /tmp/behat-wordpress-tests-lib directory should contain: | ||
""" | ||
includes | ||
""" | ||
And the /tmp/behat-wordpress-tests-lib directory should contain: | ||
""" | ||
wp-tests-config.php | ||
""" | ||
And the /tmp/behat-wordpress directory should contain: | ||
""" | ||
index.php | ||
license.txt | ||
readme.html | ||
wp-activate.php | ||
wp-admin | ||
wp-blog-header.php | ||
wp-comments-post.php | ||
wp-config-sample.php | ||
wp-content | ||
wp-cron.php | ||
wp-includes | ||
wp-links-opml.php | ||
wp-load.php | ||
wp-login.php | ||
wp-mail.php | ||
wp-settings.php | ||
wp-signup.php | ||
wp-trackback.php | ||
xmlrpc.php | ||
""" | ||
And the /tmp/behat-wordpress/wp-includes/version.php file should contain: | ||
""" | ||
3.7 | ||
""" | ||
|
||
When I run `echo 'show databases' | mysql -u root` | ||
Then the return code should be 0 | ||
And STDOUT should contain: | ||
""" | ||
wordpress_behat_test | ||
""" |