Skip to content

Commit 5335a04

Browse files
committed
run install-wp-tests.sh in the scaffolded new plugin
1 parent decd726 commit 5335a04

File tree

1 file changed

+26
-25
lines changed

1 file changed

+26
-25
lines changed

features/install-wp-tests.feature

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
11
Feature: Scaffold install-wp-tests.sh tests
22

33
Scenario: Help should be displayed
4-
When I try `/usr/bin/env bash templates/install-wp-tests.sh`
4+
Given a WP install
5+
And I run `wp plugin path`
6+
And save STDOUT as {PLUGIN_DIR}
7+
And I run `wp scaffold plugin hello-world`
8+
9+
When I try `/usr/bin/env bash {PLUGIN_DIR}/hello-world/bin/install-wp-tests.sh`
510
Then STDOUT should contain:
611
"""
712
usage:
813
"""
914
And the return code should be 1
1015

1116
Scenario: Install latest version of WordPress
12-
Given I run `echo "DROP DATABASE IF EXISTS wordpress_behat_test" | mysql -u root`
13-
And I try `rm -fr /tmp/behat-wordpress-tests-lib`
14-
And I try `rm -fr /tmp/behat-wordpress`
15-
And I run `pwd`
16-
And save STDOUT as {WORK_DIR}
17-
And a WP install
17+
Given a WP install
1818
And I run `wp plugin path`
1919
And save STDOUT as {PLUGIN_DIR}
20+
And I run `wp scaffold plugin hello-world`
21+
And I run `echo "DROP DATABASE IF EXISTS wordpress_behat_test" | mysql -u root`
22+
And I try `rm -fr /tmp/behat-wordpress-tests-lib`
23+
And I try `rm -fr /tmp/behat-wordpress`
2024

21-
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`
25+
When I run `WP_TESTS_DIR=/tmp/behat-wordpress-tests-lib WP_CORE_DIR=/tmp/behat-wordpress /usr/bin/env bash {PLUGIN_DIR}/hello-world/bin/install-wp-tests.sh wordpress_behat_test root '' localhost latest`
2226
Then the return code should be 0
2327
And the /tmp/behat-wordpress-tests-lib directory should contain:
2428
"""
@@ -54,6 +58,7 @@ Feature: Scaffold install-wp-tests.sh tests
5458
wp-trackback.php
5559
xmlrpc.php
5660
"""
61+
And the {PLUGIN_DIR}/hello-world/phpunit.xml.dist file should exist
5762

5863
When I run `echo 'show databases' | mysql -u root`
5964
Then the return code should be 0
@@ -62,23 +67,19 @@ Feature: Scaffold install-wp-tests.sh tests
6267
wordpress_behat_test
6368
"""
6469

65-
When I run `wp scaffold plugin hello-world`
66-
Then the {PLUGIN_DIR}/hello-world/phpunit.xml.dist file should exist
67-
6870
When I run `WP_TESTS_DIR=/tmp/behat-wordpress-tests-lib phpunit -c {PLUGIN_DIR}/hello-world/phpunit.xml.dist`
6971
Then the return code should be 0
7072

7173
Scenario: Install WordPress from trunk
72-
Given I run `echo "DROP DATABASE IF EXISTS wordpress_behat_test" | mysql -u root`
73-
And I try `rm -fr /tmp/behat-wordpress-tests-lib`
74-
And I try `rm -fr /tmp/behat-wordpress`
75-
And I run `pwd`
76-
And save STDOUT as {WORK_DIR}
77-
And a WP install
74+
Given a WP install
7875
And I run `wp plugin path`
7976
And save STDOUT as {PLUGIN_DIR}
77+
And I run `wp scaffold plugin hello-world`
78+
And I run `echo "DROP DATABASE IF EXISTS wordpress_behat_test" | mysql -u root`
79+
And I try `rm -fr /tmp/behat-wordpress-tests-lib`
80+
And I try `rm -fr /tmp/behat-wordpress`
8081

81-
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`
82+
When I run `WP_TESTS_DIR=/tmp/behat-wordpress-tests-lib WP_CORE_DIR=/tmp/behat-wordpress /usr/bin/env bash {PLUGIN_DIR}/hello-world/bin/install-wp-tests.sh wordpress_behat_test root '' localhost trunk`
8283
Then the return code should be 0
8384
And the /tmp/behat-wordpress-tests-lib directory should contain:
8485
"""
@@ -118,6 +119,7 @@ Feature: Scaffold install-wp-tests.sh tests
118119
"""
119120
-alpha-
120121
"""
122+
And the {PLUGIN_DIR}/hello-world/phpunit.xml.dist file should exist
121123

122124
When I run `echo 'show databases' | mysql -u root`
123125
Then the return code should be 0
@@ -126,20 +128,19 @@ Feature: Scaffold install-wp-tests.sh tests
126128
wordpress_behat_test
127129
"""
128130

129-
When I run `wp scaffold plugin hello-world`
130-
Then the {PLUGIN_DIR}/hello-world/phpunit.xml.dist file should exist
131-
132131
When I run `WP_TESTS_DIR=/tmp/behat-wordpress-tests-lib phpunit -c {PLUGIN_DIR}/hello-world/phpunit.xml.dist`
133132
Then the return code should be 0
134133

135134
Scenario: Install WordPress 3.7 and phpunit will not run
136-
Given I run `echo "DROP DATABASE IF EXISTS wordpress_behat_test" | mysql -u root`
135+
Given a WP install
136+
And I run `wp plugin path`
137+
And save STDOUT as {PLUGIN_DIR}
138+
And I run `wp scaffold plugin hello-world`
139+
And I run `echo "DROP DATABASE IF EXISTS wordpress_behat_test" | mysql -u root`
137140
And I try `rm -fr /tmp/behat-wordpress-tests-lib`
138141
And I try `rm -fr /tmp/behat-wordpress`
139-
And I run `pwd`
140-
And save STDOUT as {WORK_DIR}
141142

142-
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`
143+
When I run `WP_TESTS_DIR=/tmp/behat-wordpress-tests-lib WP_CORE_DIR=/tmp/behat-wordpress /usr/bin/env bash {PLUGIN_DIR}/hello-world/bin/install-wp-tests.sh wordpress_behat_test root '' localhost 3.7`
143144
Then the return code should be 0
144145
And the /tmp/behat-wordpress-tests-lib directory should contain:
145146
"""

0 commit comments

Comments
 (0)