@@ -2,6 +2,7 @@ Feature: Regenerate WordPress attachments
2
2
3
3
Background :
4
4
Given a WP install
5
+ And I try `wp theme install twentynineteen --activate`
5
6
6
7
Scenario : Regenerate all images while none exists
7
8
When I try `wp media regenerate --yes`
@@ -11,19 +12,23 @@ Feature: Regenerate WordPress attachments
11
12
"""
12
13
And the return code should be 0
13
14
15
+ @require-wp-5.3
14
16
Scenario : Regenerate all images default behavior
15
17
Given download:
16
18
| path | url |
17
19
| {CACHE_DIR }/large -image .jpg | http ://wp -cli .org /behat -data /large -image .jpg |
18
20
| {CACHE_DIR }/canola .jpg | http ://wp -cli .org /behat -data /canola .jpg |
21
+ | {CACHE_DIR }/white -150 -square .jpg | http ://wp -cli .org /behat -data /white -150 -square .jpg |
19
22
And I run `wp option update uploads_use_yearmonth_folders 0`
20
23
21
24
When I run `wp media import {CACHE_DIR}/large-image.jpg --title="My imported large attachment" --porcelain`
22
25
Then save STDOUT as {LARGE_ATTACHMENT_ID}
23
26
And the wp-content/uploads/large-image.jpg file should exist
27
+ And the wp-content/uploads/large-image-2560.jpg file should exist
24
28
And the wp-content/uploads/large-image-150x150.jpg file should exist
25
29
And the wp-content/uploads/large-image-300x225.jpg file should exist
26
30
And the wp-content/uploads/large-image-1024x768.jpg file should exist
31
+ And the wp-content/uploads/large-image-2048x1536.jpg file should exist
27
32
28
33
When I run `wp media import {CACHE_DIR}/canola.jpg --title="My imported medium attachment" --porcelain`
29
34
Then save STDOUT as {MEDIUM_ATTACHMENT_ID}
@@ -32,41 +37,76 @@ Feature: Regenerate WordPress attachments
32
37
And the wp-content/uploads/canola-300x225.jpg file should exist
33
38
And the wp-content/uploads/canola-1024x768.jpg file should not exist
34
39
40
+ When I run `wp media import {CACHE_DIR}/white-150-square.jpg --title="My imported small attachment" --porcelain`
41
+ Then save STDOUT as {SMALL_ATTACHMENT_ID}
42
+ And the wp-content/uploads/white-150-square.jpg file should exist
43
+ And the wp-content/uploads/white-150-square-150x150.jpg file should not exist
44
+ And the wp-content/uploads/white-150-square-300x300.jpg file should not exist
45
+ And the wp-content/uploads/white-150-square-1024x1024.jpg file should not exist
46
+
35
47
When I run `wp media regenerate --yes`
36
48
Then STDOUT should contain:
37
49
"""
38
- Found 2 images to regenerate.
50
+ Found 3 images to regenerate.
39
51
"""
40
52
And STDOUT should contain:
41
53
"""
42
- /2 Regenerated thumbnails for "My imported large attachment" (ID {LARGE_ATTACHMENT_ID})
54
+ /3 Regenerated thumbnails for "My imported large attachment" (ID {LARGE_ATTACHMENT_ID})
43
55
"""
44
56
And STDOUT should contain:
45
57
"""
46
- /2 Regenerated thumbnails for "My imported medium attachment" (ID {MEDIUM_ATTACHMENT_ID})
58
+ /3 Regenerated thumbnails for "My imported medium attachment" (ID {MEDIUM_ATTACHMENT_ID})
47
59
"""
48
60
And STDOUT should contain:
49
61
"""
50
- Success: Regenerated 2 of 2 images.
62
+ /3 Regenerated thumbnails for "My imported small attachment" (ID {SMALL_ATTACHMENT_ID})
63
+ """
64
+ And STDOUT should contain:
65
+ """
66
+ Success: Regenerated 3 of 3 images.
51
67
"""
52
68
And the wp-content/uploads/large-image.jpg file should exist
69
+ And the wp-content/uploads/large-image-2560.jpg file should exist
53
70
And the wp-content/uploads/large-image-150x150.jpg file should exist
54
71
And the wp-content/uploads/large-image-300x225.jpg file should exist
55
72
And the wp-content/uploads/large-image-1024x768.jpg file should exist
73
+ And the wp-content/uploads/large-image-2048x1536.jpg file should exist
56
74
And the wp-content/uploads/canola.jpg file should exist
57
75
And the wp-content/uploads/canola-150x150.jpg file should exist
58
76
And the wp-content/uploads/canola-300x225.jpg file should exist
59
77
And the wp-content/uploads/canola-1024x768.jpg file should not exist
78
+ And the wp-content/uploads/white-150-square.jpg file should exist
79
+ And the wp-content/uploads/white-150-square-150x150.jpg file should not exist
80
+ And the wp-content/uploads/white-150-square-300x300.jpg file should not exist
81
+ And the wp-content/uploads/white-150-square-1024x1024.jpg file should not exist
60
82
61
- # WP < 4.2 produced thumbnails duplicating original, https://core.trac.wordpress.org/ticket/31296
62
- # WP 5.3 alpha contains a bug where duplicate resizes are being stored: https://core.trac.wordpress.org/ticket/32437
63
- @require-wp-4.2 @less-than-wp-5.3
64
- Scenario : Regenerate all images default behavior
83
+ # Behavior changed with WordPress 5.3+, so we're adding separate tests for previous versions.
84
+ # Changes that impact this:
85
+ # https://core.trac.wordpress.org/ticket/43524
86
+ # https://core.trac.wordpress.org/ticket/47873
87
+ @less-than-wp-5.3
88
+ Scenario : Regenerate all images default behavior (pre-WP-5.3)
65
89
Given download:
66
90
| path | url |
91
+ | {CACHE_DIR }/large -image .jpg | http ://wp -cli .org /behat -data /large -image .jpg |
92
+ | {CACHE_DIR }/canola .jpg | http ://wp -cli .org /behat -data /canola .jpg |
67
93
| {CACHE_DIR }/white -150 -square .jpg | http ://wp -cli .org /behat -data /white -150 -square .jpg |
68
94
And I run `wp option update uploads_use_yearmonth_folders 0`
69
95
96
+ When I run `wp media import {CACHE_DIR}/large-image.jpg --title="My imported large attachment" --porcelain`
97
+ Then save STDOUT as {LARGE_ATTACHMENT_ID}
98
+ And the wp-content/uploads/large-image.jpg file should exist
99
+ And the wp-content/uploads/large-image-150x150.jpg file should exist
100
+ And the wp-content/uploads/large-image-300x225.jpg file should exist
101
+ And the wp-content/uploads/large-image-1024x768.jpg file should exist
102
+
103
+ When I run `wp media import {CACHE_DIR}/canola.jpg --title="My imported medium attachment" --porcelain`
104
+ Then save STDOUT as {MEDIUM_ATTACHMENT_ID}
105
+ And the wp-content/uploads/canola.jpg file should exist
106
+ And the wp-content/uploads/canola-150x150.jpg file should exist
107
+ And the wp-content/uploads/canola-300x225.jpg file should exist
108
+ And the wp-content/uploads/canola-1024x768.jpg file should not exist
109
+
70
110
When I run `wp media import {CACHE_DIR}/white-150-square.jpg --title="My imported small attachment" --porcelain`
71
111
Then save STDOUT as {SMALL_ATTACHMENT_ID}
72
112
And the wp-content/uploads/white-150-square.jpg file should exist
@@ -77,16 +117,32 @@ Feature: Regenerate WordPress attachments
77
117
When I run `wp media regenerate --yes`
78
118
Then STDOUT should contain:
79
119
"""
80
- Found 1 image to regenerate.
120
+ Found 3 images to regenerate.
81
121
"""
82
122
And STDOUT should contain:
83
123
"""
84
- 1/1 Regenerated thumbnails for "My imported small attachment" (ID {SMALL_ATTACHMENT_ID })
124
+ /3 Regenerated thumbnails for "My imported large attachment" (ID {LARGE_ATTACHMENT_ID })
85
125
"""
86
126
And STDOUT should contain:
87
127
"""
88
- Success: Regenerated 1 of 1 images.
128
+ /3 Regenerated thumbnails for "My imported medium attachment" (ID {MEDIUM_ATTACHMENT_ID})
129
+ """
130
+ And STDOUT should contain:
131
+ """
132
+ /3 Regenerated thumbnails for "My imported small attachment" (ID {SMALL_ATTACHMENT_ID})
133
+ """
134
+ And STDOUT should contain:
89
135
"""
136
+ Success: Regenerated 3 of 3 images.
137
+ """
138
+ And the wp-content/uploads/large-image.jpg file should exist
139
+ And the wp-content/uploads/large-image-150x150.jpg file should exist
140
+ And the wp-content/uploads/large-image-300x225.jpg file should exist
141
+ And the wp-content/uploads/large-image-1024x768.jpg file should exist
142
+ And the wp-content/uploads/canola.jpg file should exist
143
+ And the wp-content/uploads/canola-150x150.jpg file should exist
144
+ And the wp-content/uploads/canola-300x225.jpg file should exist
145
+ And the wp-content/uploads/canola-1024x768.jpg file should not exist
90
146
And the wp-content/uploads/white-150-square.jpg file should exist
91
147
And the wp-content/uploads/white-150-square-150x150.jpg file should not exist
92
148
And the wp-content/uploads/white-150-square-300x300.jpg file should not exist
0 commit comments