Skip to content

Commit 40b98b5

Browse files
authored
Update theme tests to remove P2 and use TwentyTwelve (#336)
* Update theme tests to remove P2 and use TwentyTwelve * Use run instead on try in feature test
1 parent a951af1 commit 40b98b5

File tree

2 files changed

+52
-52
lines changed

2 files changed

+52
-52
lines changed

features/scaffold-block.feature

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Feature: WordPress block code scaffolding
55
Given I run `wp scaffold plugin movies`
66
And I run `wp plugin path movies --dir`
77
And save STDOUT as {PLUGIN_DIR}
8-
Given I run `wp theme install p2 --activate`
9-
And I run `wp theme path p2 --dir`
8+
Given I run `wp theme install twentytwelve --activate --force`
9+
And I run `wp theme path twentytwelve --dir`
1010
And save STDOUT as {THEME_DIR}
1111

1212

@@ -154,7 +154,7 @@ Feature: WordPress block code scaffolding
154154
"""
155155

156156
Scenario: Scaffold a block for a specific theme
157-
When I run `wp scaffold block intouchables --theme=p2`
157+
When I run `wp scaffold block intouchables --theme=twentytwelve`
158158
Then the {THEME_DIR}/blocks/intouchables.php file should exist
159159
And the {THEME_DIR}/blocks/intouchables/index.js file should exist
160160
And the {THEME_DIR}/blocks/intouchables/editor.css file should exist
@@ -166,7 +166,7 @@ Feature: WordPress block code scaffolding
166166

167167
Scenario: Plugin- or theme-specific functions are only used in the correct context
168168
When I run `wp scaffold block plugin-block --plugin=movies`
169-
And I run `wp scaffold block theme-block --theme=p2`
169+
And I run `wp scaffold block theme-block --theme=twentytwelve`
170170
Then the {PLUGIN_DIR}/blocks/plugin-block.php file should contain:
171171
"""
172172
plugins_url

features/scaffold-theme-tests.feature

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,45 @@ Feature: Scaffold theme unit tests
22

33
Background:
44
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`
77

88
When I run `wp theme path`
99
Then save STDOUT as {THEME_DIR}
1010

1111
@require-php-7.0 @less-than-php-7.2 @require-mysql
1212
Scenario: Scaffold theme tests
13-
When I run `wp scaffold theme-tests p2child`
13+
When I run `wp scaffold theme-tests t12child`
1414
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:
1616
"""
1717
bootstrap.php
1818
test-sample.php
1919
"""
20-
And the {THEME_DIR}/p2child/tests/bootstrap.php file should contain:
20+
And the {THEME_DIR}/t12child/tests/bootstrap.php file should contain:
2121
"""
2222
register_theme_directory( $theme_root );
2323
"""
24-
And the {THEME_DIR}/p2child/tests/bootstrap.php file should contain:
24+
And the {THEME_DIR}/t12child/tests/bootstrap.php file should contain:
2525
"""
26-
* @package P2child
26+
* @package T12child
2727
"""
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:
2929
"""
30-
* @package P2child
30+
* @package T12child
3131
"""
32-
And the {THEME_DIR}/p2child/bin directory should contain:
32+
And the {THEME_DIR}/t12child/bin directory should contain:
3333
"""
3434
install-wp-tests.sh
3535
"""
36-
And the {THEME_DIR}/p2child/phpunit.xml.dist file should contain:
36+
And the {THEME_DIR}/t12child/phpunit.xml.dist file should contain:
3737
"""
3838
<exclude>./tests/test-sample.php</exclude>
3939
"""
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:
4444
"""
4545
jobs:
4646
php56-build:
@@ -49,7 +49,7 @@ Feature: Scaffold theme unit tests
4949
- image: circleci/php:5.6
5050
- image: *mysql_image
5151
"""
52-
And the {THEME_DIR}/p2child/.circleci/config.yml file should contain:
52+
And the {THEME_DIR}/t12child/.circleci/config.yml file should contain:
5353
"""
5454
workflows:
5555
version: 2
@@ -63,27 +63,27 @@ Feature: Scaffold theme unit tests
6363
- php74-build
6464
"""
6565

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 ); }"`
6767
Then STDOUT should be:
6868
"""
6969
executable
7070
"""
7171

7272
# 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:
7474
"""
7575
<?php echo __FILE__ . " loaded.\n";
7676
"""
7777
# This throws a warning for the password provided via command line.
7878
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"`
7979

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`
8181
Then the return code should be 0
8282

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`
8484
Then STDOUT should contain:
8585
"""
86-
p2child/functions.php loaded.
86+
t12child/functions.php loaded.
8787
"""
8888
And STDOUT should contain:
8989
"""
@@ -94,10 +94,10 @@ Feature: Scaffold theme unit tests
9494
No tests executed!
9595
"""
9696

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`
9898
Then STDOUT should contain:
9999
"""
100-
p2child/functions.php loaded.
100+
t12child/functions.php loaded.
101101
"""
102102
And STDOUT should contain:
103103
"""
@@ -117,55 +117,55 @@ Feature: Scaffold theme unit tests
117117
And the return code should be 1
118118

119119
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`
121121
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:
124124
"""
125125
version: 2
126126
"""
127-
And the {THEME_DIR}/p2child/.circleci/config.yml file should contain:
127+
And the {THEME_DIR}/t12child/.circleci/config.yml file should contain:
128128
"""
129129
php56-build
130130
"""
131-
And the {THEME_DIR}/p2child/.circleci/config.yml file should contain:
131+
And the {THEME_DIR}/t12child/.circleci/config.yml file should contain:
132132
"""
133133
php70-build
134134
"""
135-
And the {THEME_DIR}/p2child/.circleci/config.yml file should contain:
135+
And the {THEME_DIR}/t12child/.circleci/config.yml file should contain:
136136
"""
137137
php71-build
138138
"""
139-
And the {THEME_DIR}/p2child/.circleci/config.yml file should contain:
139+
And the {THEME_DIR}/t12child/.circleci/config.yml file should contain:
140140
"""
141141
php72-build
142142
"""
143-
And the {THEME_DIR}/p2child/.circleci/config.yml file should contain:
143+
And the {THEME_DIR}/t12child/.circleci/config.yml file should contain:
144144
"""
145145
php73-build
146146
"""
147-
And the {THEME_DIR}/p2child/.circleci/config.yml file should contain:
147+
And the {THEME_DIR}/t12child/.circleci/config.yml file should contain:
148148
"""
149149
php74-build
150150
"""
151151

152152
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`
154154
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:
156156
"""
157157
MYSQL_DATABASE
158158
"""
159159

160160
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`
162162
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:
164164
"""
165165
pipelines:
166166
default:
167167
"""
168-
And the {THEME_DIR}/p2child/bitbucket-pipelines.yml file should contain:
168+
And the {THEME_DIR}/t12child/bitbucket-pipelines.yml file should contain:
169169
"""
170170
- step:
171171
image: php:5.6
@@ -175,7 +175,7 @@ Feature: Scaffold theme unit tests
175175
- docker-php-ext-install mysqli
176176
- apt-get update && apt-get install -y subversion --no-install-recommends
177177
"""
178-
And the {THEME_DIR}/p2child/bitbucket-pipelines.yml file should contain:
178+
And the {THEME_DIR}/t12child/bitbucket-pipelines.yml file should contain:
179179
"""
180180
- step:
181181
image: php:7.0
@@ -185,7 +185,7 @@ Feature: Scaffold theme unit tests
185185
- docker-php-ext-install mysqli
186186
- apt-get update && apt-get install -y subversion --no-install-recommends
187187
"""
188-
And the {THEME_DIR}/p2child/bitbucket-pipelines.yml file should contain:
188+
And the {THEME_DIR}/t12child/bitbucket-pipelines.yml file should contain:
189189
"""
190190
- step:
191191
image: php:7.1
@@ -195,7 +195,7 @@ Feature: Scaffold theme unit tests
195195
- docker-php-ext-install mysqli
196196
- apt-get update && apt-get install -y subversion --no-install-recommends
197197
"""
198-
And the {THEME_DIR}/p2child/bitbucket-pipelines.yml file should contain:
198+
And the {THEME_DIR}/t12child/bitbucket-pipelines.yml file should contain:
199199
"""
200200
- step:
201201
image: php:7.2
@@ -205,7 +205,7 @@ Feature: Scaffold theme unit tests
205205
- docker-php-ext-install mysqli
206206
- apt-get update && apt-get install -y subversion --no-install-recommends
207207
"""
208-
And the {THEME_DIR}/p2child/bitbucket-pipelines.yml file should contain:
208+
And the {THEME_DIR}/t12child/bitbucket-pipelines.yml file should contain:
209209
"""
210210
definitions:
211211
services:
@@ -233,36 +233,36 @@ Feature: Scaffold theme unit tests
233233
And the return code should be 1
234234

235235
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`
237237
Then STDERR should be:
238238
"""
239239
Error: Invalid theme directory specified. No such directory 'non-existent-dir'.
240240
"""
241241
And the return code should be 1
242242

243243
# 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`
245245
Then the return code should be 0
246246

247-
When I try `wp scaffold theme-tests p2`
247+
When I try `wp scaffold theme-tests twentytwelve`
248248
Then STDERR should be:
249249
"""
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'.
251251
"""
252252
And the return code should be 1
253253

254254
# 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`
256256
Then the return code should be 0
257257

258258
Scenario: Scaffold theme tests with a symbolic link
259259
# Temporarily move the whole theme dir and create a symbolic link to it.
260260
When I run `mv -f {THEME_DIR} {RUN_DIR}/alt-themes && ln -s {RUN_DIR}/alt-themes {THEME_DIR}`
261261
Then the return code should be 0
262262

263-
When I run `wp scaffold theme-tests p2`
263+
When I run `wp scaffold theme-tests twentytwelve`
264264
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:
266266
"""
267267
bootstrap.php
268268
"""

0 commit comments

Comments
 (0)