Skip to content

Commit 96a2d33

Browse files
authored
Merge pull request #417 from tfirdaus/fix/new-theme-feature-tests
2 parents 5619a55 + 5e19ac6 commit 96a2d33

File tree

5 files changed

+110
-93
lines changed

5 files changed

+110
-93
lines changed

features/theme-delete.feature

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,34 @@ Feature: Delete WordPress themes
22

33
Background:
44
Given a WP install
5-
And I run `wp theme install p2`
5+
And I run `wp theme delete --all --force`
6+
And I run `wp theme install twentytwelve`
7+
And I run `wp theme install twentyeleven --activate`
68

79
Scenario: Delete an installed theme
8-
When I run `wp theme delete p2`
10+
When I run `wp theme delete twentytwelve`
911
Then STDOUT should be:
1012
"""
11-
Deleted 'p2' theme.
13+
Deleted 'twentytwelve' theme.
1214
Success: Deleted 1 of 1 themes.
1315
"""
1416
And the return code should be 0
1517

1618
Scenario: Delete an active theme
17-
When I run `wp theme activate p2`
19+
When I run `wp theme activate twentytwelve`
1820
Then STDOUT should not be empty
1921

20-
When I try `wp theme delete p2`
22+
When I try `wp theme delete twentytwelve`
2123
Then STDERR should be:
2224
"""
23-
Warning: Can't delete the currently active theme: p2
25+
Warning: Can't delete the currently active theme: twentytwelve
2426
Error: No themes deleted.
2527
"""
2628

27-
When I try `wp theme delete p2 --force`
29+
When I try `wp theme delete twentytwelve --force`
2830
Then STDOUT should contain:
2931
"""
30-
Deleted 'p2' theme.
32+
Deleted 'twentytwelve' theme.
3133
"""
3234

3335
Scenario: Delete all installed themes
@@ -108,7 +110,7 @@ Feature: Delete WordPress themes
108110
Then STDOUT should be empty
109111

110112
Scenario: Attempting to delete a theme that doesn't exist
111-
When I run `wp theme delete p2`
113+
When I run `wp theme delete twentytwelve`
112114
Then STDOUT should not be empty
113115

114116
When I try the previous command again
@@ -118,6 +120,6 @@ Feature: Delete WordPress themes
118120
"""
119121
And STDERR should be:
120122
"""
121-
Warning: The 'p2' theme could not be found.
123+
Warning: The 'twentytwelve' theme could not be found.
122124
"""
123125
And the return code should be 0

features/theme-install.feature

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,52 @@
11
Feature: Install WordPress themes
22

3-
Scenario: Return code is 1 when one or more theme installations fail
3+
Background:
44
Given a WP install
5+
And I run `wp theme delete --all --force`
56

6-
When I try `wp theme install p2 p2-not-a-theme`
7+
Scenario: Return code is 1 when one or more theme installations fail
8+
When I try `wp theme install twentytwelve twentytwelve-not-a-theme`
79
Then STDERR should contain:
810
"""
911
Warning:
1012
"""
1113
And STDERR should contain:
1214
"""
13-
p2-not-a-theme
15+
twentytwelve-not-a-theme
1416
"""
1517
And STDERR should contain:
1618
"""
1719
Error: Only installed 1 of 2 themes.
1820
"""
1921
And STDOUT should contain:
2022
"""
21-
Installing P2
23+
Installing Twenty Twelve
2224
"""
2325
And STDOUT should contain:
2426
"""
2527
Theme installed successfully.
2628
"""
2729
And the return code should be 1
2830

29-
When I try `wp theme install p2`
31+
When I try `wp theme install twentytwelve`
3032
Then STDOUT should be:
3133
"""
3234
Success: Theme already installed.
3335
"""
3436
And STDERR should be:
3537
"""
36-
Warning: p2: Theme already installed.
38+
Warning: twentytwelve: Theme already installed.
3739
"""
3840
And the return code should be 0
3941

40-
When I try `wp theme install p2-not-a-theme`
42+
When I try `wp theme install twentytwelve-not-a-theme`
4143
Then STDERR should contain:
4244
"""
4345
Warning:
4446
"""
4547
And STDERR should contain:
4648
"""
47-
p2-not-a-theme
49+
twentytwelve-not-a-theme
4850
"""
4951
And STDERR should contain:
5052
"""
@@ -88,20 +90,18 @@ Feature: Install WordPress themes
8890
"""
8991

9092
Scenario: Verify installed theme activation
91-
Given a WP install
92-
93-
When I run `wp theme install p2`
93+
When I run `wp theme install twentytwelve`
9494
Then STDOUT should not be empty
9595

96-
When I try `wp theme install p2 --activate`
96+
When I try `wp theme install twentytwelve --activate`
9797
Then STDERR should contain:
9898
"""
99-
Warning: p2: Theme already installed.
99+
Warning: twentytwelve: Theme already installed.
100100
"""
101101

102102
And STDOUT should contain:
103103
"""
104-
Activating 'p2'...
105-
Success: Switched to 'P2' theme.
104+
Activating 'twentytwelve'...
105+
Success: Switched to 'Twenty Twelve' theme.
106106
Success: Theme already installed.
107107
"""

features/theme-update.feature

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,18 @@ Feature: Update WordPress themes
1919

2020
Scenario: Install a theme, then update to a specific version of that theme
2121
Given a WP install
22+
And I run `wp theme delete --all --force`
2223

23-
When I run `wp theme install p2 --version=1.4.1`
24+
When I run `wp theme install twentytwelve --version=3.0`
2425
Then STDOUT should not be empty
2526

26-
When I run `wp theme update p2 --version=1.4.2`
27+
When I run `wp theme update twentytwelve --version=4.0`
2728
Then STDOUT should not be empty
2829

2930
When I run `wp theme list --fields=name,version`
3031
Then STDOUT should be a table containing rows:
31-
| name | version |
32-
| p2 | 1.4.2 |
32+
| name | version |
33+
| twentytwelve | 4.0 |
3334

3435
Scenario: Not giving a slug on update should throw an error unless --all given
3536
Given a WP install
@@ -51,7 +52,7 @@ Feature: Update WordPress themes
5152
"""
5253

5354
# One theme installed.
54-
Given I run `wp theme install p2 --version=1.4.2`
55+
Given I run `wp theme install moina --version=1.0.2`
5556

5657
When I try `wp theme update`
5758
Then the return code should be 1
@@ -74,7 +75,7 @@ Feature: Update WordPress themes
7475
"""
7576

7677
# Note: if given version then re-installs.
77-
When I run `wp theme update --version=1.4.2 --all`
78+
When I run `wp theme update --version=1.0.2 --all`
7879
Then STDOUT should contain:
7980
"""
8081
Success: Installed 1 of 1 themes.
@@ -103,17 +104,17 @@ Feature: Update WordPress themes
103104
"""
104105

105106
# Using version with all rarely makes sense and should probably error and do nothing.
106-
When I try `wp theme update --version=1.4.2 --all`
107+
When I try `wp theme update --version=1.0.3 --all`
107108
Then the return code should be 1
108109
And STDOUT should contain:
109110
"""
110111
Success: Installed 1 of 1 themes.
111112
"""
112113
And STDERR should be:
113114
"""
114-
Error: Can't find the requested theme's version 1.4.2 in the WordPress.org theme repository (HTTP code 404).
115+
Error: Can't find the requested theme's version 1.0.3 in the WordPress.org theme repository (HTTP code 404).
115116
"""
116-
117+
117118
Scenario: Error when both --minor and --patch are provided
118119
Given a WP install
119120

@@ -139,7 +140,7 @@ Feature: Update WordPress themes
139140
"""
140141
3.9
141142
"""
142-
143+
143144
Scenario: Update a theme to its latest patch release
144145
Given a WP install
145146
And I run `wp theme install --force twentytwelve --version=1.1`

0 commit comments

Comments
 (0)