@@ -2,45 +2,45 @@ Feature: Scaffold theme unit tests
2
2
3
3
Background :
4
4
Given a WP install
5
- And I run `wp theme install p2 `
6
- And I run `wp scaffold child-theme p2child --parent_theme=p2 `
5
+ And I try `wp theme install twentytwelve --force `
6
+ And I run `wp scaffold child-theme t12child --parent_theme=twentytwelve `
7
7
8
8
When I run `wp theme path`
9
9
Then save STDOUT as {THEME_DIR}
10
10
11
11
@require-php-7.0 @less-than-php-7.2 @require-mysql
12
12
Scenario : Scaffold theme tests
13
- When I run `wp scaffold theme-tests p2child `
13
+ When I run `wp scaffold theme-tests t12child `
14
14
Then STDOUT should not be empty
15
- And the {THEME_DIR}/p2child /tests directory should contain:
15
+ And the {THEME_DIR}/t12child /tests directory should contain:
16
16
"""
17
17
bootstrap.php
18
18
test-sample.php
19
19
"""
20
- And the {THEME_DIR}/p2child /tests/bootstrap.php file should contain:
20
+ And the {THEME_DIR}/t12child /tests/bootstrap.php file should contain:
21
21
"""
22
22
register_theme_directory( $theme_root );
23
23
"""
24
- And the {THEME_DIR}/p2child /tests/bootstrap.php file should contain:
24
+ And the {THEME_DIR}/t12child /tests/bootstrap.php file should contain:
25
25
"""
26
- * @package P2child
26
+ * @package T12child
27
27
"""
28
- And the {THEME_DIR}/p2child /tests/test-sample.php file should contain:
28
+ And the {THEME_DIR}/t12child /tests/test-sample.php file should contain:
29
29
"""
30
- * @package P2child
30
+ * @package T12child
31
31
"""
32
- And the {THEME_DIR}/p2child /bin directory should contain:
32
+ And the {THEME_DIR}/t12child /bin directory should contain:
33
33
"""
34
34
install-wp-tests.sh
35
35
"""
36
- And the {THEME_DIR}/p2child /phpunit.xml.dist file should contain:
36
+ And the {THEME_DIR}/t12child /phpunit.xml.dist file should contain:
37
37
"""
38
38
<exclude>./tests/test-sample.php</exclude>
39
39
"""
40
- And the {THEME_DIR}/p2child /.phpcs.xml.dist file should exist
41
- And the {THEME_DIR}/p2child /bitbucket-pipelines.yml file should not exist
42
- And the {THEME_DIR}/p2child /.gitlab-ci.yml file should not exist
43
- And the {THEME_DIR}/p2child /.circleci/config.yml file should contain:
40
+ And the {THEME_DIR}/t12child /.phpcs.xml.dist file should exist
41
+ And the {THEME_DIR}/t12child /bitbucket-pipelines.yml file should not exist
42
+ And the {THEME_DIR}/t12child /.gitlab-ci.yml file should not exist
43
+ And the {THEME_DIR}/t12child /.circleci/config.yml file should contain:
44
44
"""
45
45
jobs:
46
46
php56-build:
@@ -49,7 +49,7 @@ Feature: Scaffold theme unit tests
49
49
- image: circleci/php:5.6
50
50
- image: *mysql_image
51
51
"""
52
- And the {THEME_DIR}/p2child /.circleci/config.yml file should contain:
52
+ And the {THEME_DIR}/t12child /.circleci/config.yml file should contain:
53
53
"""
54
54
workflows:
55
55
version: 2
@@ -63,27 +63,27 @@ Feature: Scaffold theme unit tests
63
63
- php74-build
64
64
"""
65
65
66
- When I run `wp eval "if ( is_executable( '{THEME_DIR}/p2child /bin/install-wp-tests.sh' ) ) { echo 'executable'; } else { exit( 1 ); }" `
66
+ When I run `wp eval "if ( is_executable( '{THEME_DIR}/t12child /bin/install-wp-tests.sh' ) ) { echo 'executable'; } else { exit( 1 ); }" `
67
67
Then STDOUT should be:
68
68
"""
69
69
executable
70
70
"""
71
71
72
72
# Warning: overwriting generated functions.php file, so functions.php file loaded only tests beyond here...
73
- Given a wp-content/themes/p2child /functions.php file:
73
+ Given a wp-content/themes/t12child /functions.php file:
74
74
"""
75
75
<?php echo __FILE__ . " loaded.\n";
76
76
"""
77
77
# This throws a warning for the password provided via command line.
78
78
And I try `mysql -u{DB_USER} -p{DB_PASSWORD} -h{MYSQL_HOST} -P{MYSQL_PORT} --protocol=tcp -e "DROP DATABASE IF EXISTS wp_cli_test_scaffold" `
79
79
80
- And I try `WP_TESTS_DIR={RUN_DIR}/wordpress-tests-lib WP_CORE_DIR={RUN_DIR}/wordpress {THEME_DIR}/p2child /bin/install-wp-tests.sh wp_cli_test_scaffold {DB_USER} {DB_PASSWORD} {DB_HOST} latest`
80
+ And I try `WP_TESTS_DIR={RUN_DIR}/wordpress-tests-lib WP_CORE_DIR={RUN_DIR}/wordpress {THEME_DIR}/t12child /bin/install-wp-tests.sh wp_cli_test_scaffold {DB_USER} {DB_PASSWORD} {DB_HOST} latest`
81
81
Then the return code should be 0
82
82
83
- When I run `cd {THEME_DIR}/p2child ; WP_TESTS_DIR={RUN_DIR}/wordpress-tests-lib phpunit`
83
+ When I run `cd {THEME_DIR}/t12child ; WP_TESTS_DIR={RUN_DIR}/wordpress-tests-lib phpunit`
84
84
Then STDOUT should contain:
85
85
"""
86
- p2child /functions.php loaded.
86
+ t12child /functions.php loaded.
87
87
"""
88
88
And STDOUT should contain:
89
89
"""
@@ -94,10 +94,10 @@ Feature: Scaffold theme unit tests
94
94
No tests executed!
95
95
"""
96
96
97
- When I run `cd {THEME_DIR}/p2child ; WP_MULTISITE=1 WP_TESTS_DIR={RUN_DIR}/wordpress-tests-lib phpunit`
97
+ When I run `cd {THEME_DIR}/t12child ; WP_MULTISITE=1 WP_TESTS_DIR={RUN_DIR}/wordpress-tests-lib phpunit`
98
98
Then STDOUT should contain:
99
99
"""
100
- p2child /functions.php loaded.
100
+ t12child /functions.php loaded.
101
101
"""
102
102
And STDOUT should contain:
103
103
"""
@@ -117,55 +117,55 @@ Feature: Scaffold theme unit tests
117
117
And the return code should be 1
118
118
119
119
Scenario : Scaffold theme tests with Circle as the provider
120
- When I run `wp scaffold theme-tests p2child --ci=circle`
120
+ When I run `wp scaffold theme-tests t12child --ci=circle`
121
121
Then STDOUT should not be empty
122
- And the {THEME_DIR}/p2child /circle.yml file should not exist
123
- And the {THEME_DIR}/p2child /.circleci/config.yml file should contain:
122
+ And the {THEME_DIR}/t12child /circle.yml file should not exist
123
+ And the {THEME_DIR}/t12child /.circleci/config.yml file should contain:
124
124
"""
125
125
version: 2
126
126
"""
127
- And the {THEME_DIR}/p2child /.circleci/config.yml file should contain:
127
+ And the {THEME_DIR}/t12child /.circleci/config.yml file should contain:
128
128
"""
129
129
php56-build
130
130
"""
131
- And the {THEME_DIR}/p2child /.circleci/config.yml file should contain:
131
+ And the {THEME_DIR}/t12child /.circleci/config.yml file should contain:
132
132
"""
133
133
php70-build
134
134
"""
135
- And the {THEME_DIR}/p2child /.circleci/config.yml file should contain:
135
+ And the {THEME_DIR}/t12child /.circleci/config.yml file should contain:
136
136
"""
137
137
php71-build
138
138
"""
139
- And the {THEME_DIR}/p2child /.circleci/config.yml file should contain:
139
+ And the {THEME_DIR}/t12child /.circleci/config.yml file should contain:
140
140
"""
141
141
php72-build
142
142
"""
143
- And the {THEME_DIR}/p2child /.circleci/config.yml file should contain:
143
+ And the {THEME_DIR}/t12child /.circleci/config.yml file should contain:
144
144
"""
145
145
php73-build
146
146
"""
147
- And the {THEME_DIR}/p2child /.circleci/config.yml file should contain:
147
+ And the {THEME_DIR}/t12child /.circleci/config.yml file should contain:
148
148
"""
149
149
php74-build
150
150
"""
151
151
152
152
Scenario : Scaffold theme tests with Gitlab as the provider
153
- When I run `wp scaffold theme-tests p2child --ci=gitlab`
153
+ When I run `wp scaffold theme-tests t12child --ci=gitlab`
154
154
Then STDOUT should not be empty
155
- And the {THEME_DIR}/p2child /.gitlab-ci.yml file should contain:
155
+ And the {THEME_DIR}/t12child /.gitlab-ci.yml file should contain:
156
156
"""
157
157
MYSQL_DATABASE
158
158
"""
159
159
160
160
Scenario : Scaffold theme tests with Bitbucket Pipelines as the provider
161
- When I run `wp scaffold theme-tests p2child --ci=bitbucket`
161
+ When I run `wp scaffold theme-tests t12child --ci=bitbucket`
162
162
Then STDOUT should not be empty
163
- And the {THEME_DIR}/p2child /bitbucket-pipelines.yml file should contain:
163
+ And the {THEME_DIR}/t12child /bitbucket-pipelines.yml file should contain:
164
164
"""
165
165
pipelines:
166
166
default:
167
167
"""
168
- And the {THEME_DIR}/p2child /bitbucket-pipelines.yml file should contain:
168
+ And the {THEME_DIR}/t12child /bitbucket-pipelines.yml file should contain:
169
169
"""
170
170
- step:
171
171
image: php:5.6
@@ -175,7 +175,7 @@ Feature: Scaffold theme unit tests
175
175
- docker-php-ext-install mysqli
176
176
- apt-get update && apt-get install -y subversion --no-install-recommends
177
177
"""
178
- And the {THEME_DIR}/p2child /bitbucket-pipelines.yml file should contain:
178
+ And the {THEME_DIR}/t12child /bitbucket-pipelines.yml file should contain:
179
179
"""
180
180
- step:
181
181
image: php:7.0
@@ -185,7 +185,7 @@ Feature: Scaffold theme unit tests
185
185
- docker-php-ext-install mysqli
186
186
- apt-get update && apt-get install -y subversion --no-install-recommends
187
187
"""
188
- And the {THEME_DIR}/p2child /bitbucket-pipelines.yml file should contain:
188
+ And the {THEME_DIR}/t12child /bitbucket-pipelines.yml file should contain:
189
189
"""
190
190
- step:
191
191
image: php:7.1
@@ -195,7 +195,7 @@ Feature: Scaffold theme unit tests
195
195
- docker-php-ext-install mysqli
196
196
- apt-get update && apt-get install -y subversion --no-install-recommends
197
197
"""
198
- And the {THEME_DIR}/p2child /bitbucket-pipelines.yml file should contain:
198
+ And the {THEME_DIR}/t12child /bitbucket-pipelines.yml file should contain:
199
199
"""
200
200
- step:
201
201
image: php:7.2
@@ -205,7 +205,7 @@ Feature: Scaffold theme unit tests
205
205
- docker-php-ext-install mysqli
206
206
- apt-get update && apt-get install -y subversion --no-install-recommends
207
207
"""
208
- And the {THEME_DIR}/p2child /bitbucket-pipelines.yml file should contain:
208
+ And the {THEME_DIR}/t12child /bitbucket-pipelines.yml file should contain:
209
209
"""
210
210
definitions:
211
211
services:
@@ -233,36 +233,36 @@ Feature: Scaffold theme unit tests
233
233
And the return code should be 1
234
234
235
235
Scenario : Scaffold theme tests with invalid directory
236
- When I try `wp scaffold theme-tests p2 --dir=non-existent-dir`
236
+ When I try `wp scaffold theme-tests twentytwelve --dir=non-existent-dir`
237
237
Then STDERR should be:
238
238
"""
239
239
Error: Invalid theme directory specified. No such directory 'non-existent-dir'.
240
240
"""
241
241
And the return code should be 1
242
242
243
243
# Temporarily move.
244
- When I run `mv -f {THEME_DIR}/p2 {THEME_DIR}/hide-p2 && touch {THEME_DIR}/p2 `
244
+ When I run `mv -f {THEME_DIR}/twentytwelve {THEME_DIR}/hide-twentytwelve && touch {THEME_DIR}/twentytwelve `
245
245
Then the return code should be 0
246
246
247
- When I try `wp scaffold theme-tests p2 `
247
+ When I try `wp scaffold theme-tests twentytwelve `
248
248
Then STDERR should be:
249
249
"""
250
- Error: Invalid theme slug specified. No such target directory '{THEME_DIR}/p2 '.
250
+ Error: Invalid theme slug specified. No such target directory '{THEME_DIR}/twentytwelve '.
251
251
"""
252
252
And the return code should be 1
253
253
254
254
# Restore.
255
- When I run `rm -f {THEME_DIR}/p2 && mv -f {THEME_DIR}/hide-p2 {THEME_DIR}/p2 `
255
+ When I run `rm -f {THEME_DIR}/twentytwelve && mv -f {THEME_DIR}/hide-twentytwelve {THEME_DIR}/twentytwelve `
256
256
Then the return code should be 0
257
257
258
258
Scenario : Scaffold theme tests with a symbolic link
259
259
# Temporarily move the whole theme dir and create a symbolic link to it.
260
260
When I run `mv -f {THEME_DIR} {RUN_DIR}/alt-themes && ln -s {RUN_DIR}/alt-themes {THEME_DIR}`
261
261
Then the return code should be 0
262
262
263
- When I run `wp scaffold theme-tests p2 `
263
+ When I run `wp scaffold theme-tests twentytwelve `
264
264
Then STDOUT should not be empty
265
- And the {THEME_DIR}/p2 /tests directory should contain:
265
+ And the {THEME_DIR}/twentytwelve /tests directory should contain:
266
266
"""
267
267
bootstrap.php
268
268
"""
0 commit comments