@@ -2,6 +2,7 @@ Feature: Regenerate WordPress attachments
22
33 Background :
44 Given a WP install
5+ And I try `wp theme install twentynineteen --activate`
56
67 Scenario : Regenerate all images while none exists
78 When I try `wp media regenerate --yes`
@@ -11,19 +12,23 @@ Feature: Regenerate WordPress attachments
1112 """
1213 And the return code should be 0
1314
15+ @require-wp-5.3
1416 Scenario : Regenerate all images default behavior
1517 Given download:
1618 | path | url |
1719 | {CACHE_DIR }/large -image .jpg | http ://wp -cli .org /behat -data /large -image .jpg |
1820 | {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 |
1922 And I run `wp option update uploads_use_yearmonth_folders 0`
2023
2124 When I run `wp media import {CACHE_DIR}/large-image.jpg --title="My imported large attachment" --porcelain`
2225 Then save STDOUT as {LARGE_ATTACHMENT_ID}
2326 And the wp-content/uploads/large-image.jpg file should exist
27+ And the wp-content/uploads/large-image-2560.jpg file should exist
2428 And the wp-content/uploads/large-image-150x150.jpg file should exist
2529 And the wp-content/uploads/large-image-300x225.jpg file should exist
2630 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
2732
2833 When I run `wp media import {CACHE_DIR}/canola.jpg --title="My imported medium attachment" --porcelain`
2934 Then save STDOUT as {MEDIUM_ATTACHMENT_ID}
@@ -32,41 +37,76 @@ Feature: Regenerate WordPress attachments
3237 And the wp-content/uploads/canola-300x225.jpg file should exist
3338 And the wp-content/uploads/canola-1024x768.jpg file should not exist
3439
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+
3547 When I run `wp media regenerate --yes`
3648 Then STDOUT should contain:
3749 """
38- Found 2 images to regenerate.
50+ Found 3 images to regenerate.
3951 """
4052 And STDOUT should contain:
4153 """
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})
4355 """
4456 And STDOUT should contain:
4557 """
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})
4759 """
4860 And STDOUT should contain:
4961 """
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.
5167 """
5268 And the wp-content/uploads/large-image.jpg file should exist
69+ And the wp-content/uploads/large-image-2560.jpg file should exist
5370 And the wp-content/uploads/large-image-150x150.jpg file should exist
5471 And the wp-content/uploads/large-image-300x225.jpg file should exist
5572 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
5674 And the wp-content/uploads/canola.jpg file should exist
5775 And the wp-content/uploads/canola-150x150.jpg file should exist
5876 And the wp-content/uploads/canola-300x225.jpg file should exist
5977 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
6082
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)
6589 Given download:
6690 | 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 |
6793 | {CACHE_DIR }/white -150 -square .jpg | http ://wp -cli .org /behat -data /white -150 -square .jpg |
6894 And I run `wp option update uploads_use_yearmonth_folders 0`
6995
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+
70110 When I run `wp media import {CACHE_DIR}/white-150-square.jpg --title="My imported small attachment" --porcelain`
71111 Then save STDOUT as {SMALL_ATTACHMENT_ID}
72112 And the wp-content/uploads/white-150-square.jpg file should exist
@@ -77,16 +117,32 @@ Feature: Regenerate WordPress attachments
77117 When I run `wp media regenerate --yes`
78118 Then STDOUT should contain:
79119 """
80- Found 1 image to regenerate.
120+ Found 3 images to regenerate.
81121 """
82122 And STDOUT should contain:
83123 """
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 })
85125 """
86126 And STDOUT should contain:
87127 """
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:
89135 """
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
90146 And the wp-content/uploads/white-150-square.jpg file should exist
91147 And the wp-content/uploads/white-150-square-150x150.jpg file should not exist
92148 And the wp-content/uploads/white-150-square-300x300.jpg file should not exist
0 commit comments