Skip to content

Commit f9a606e

Browse files
authored
Merge pull request #167 from wp-cli/fix/use-https-example-com
Adapt feature test to use HTTPS with example.com
2 parents 220b635 + cc4c589 commit f9a606e

File tree

2 files changed

+37
-35
lines changed

2 files changed

+37
-35
lines changed

features/search-replace-export.feature

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ Feature: Search / replace with file export
22

33
Scenario: Search / replace export to STDOUT
44
Given a WP install
5+
And I run `echo ' '`
6+
And save STDOUT as {SPACE}
57

68
When I run `wp search-replace example.com example.net --export`
79
Then STDOUT should contain:
@@ -11,13 +13,13 @@ Feature: Search / replace with file export
1113
"""
1214
And STDOUT should contain:
1315
"""
14-
('1', 'siteurl', 'http://example.net', 'yes'),
16+
('1', 'siteurl', 'https://example.net', 'yes'),
1517
"""
1618

1719
When I run `wp option get home`
1820
Then STDOUT should be:
1921
"""
20-
http://example.com
22+
https://example.com
2123
"""
2224

2325
When I run `wp search-replace example.com example.net --skip-tables=wp_options --export`
@@ -47,15 +49,15 @@ Feature: Search / replace with file export
4749
When I run `wp search-replace example.com example.net --skip-columns=option_value --export`
4850
Then STDOUT should contain:
4951
"""
50-
INSERT INTO `wp_options` (`option_id`, `option_name`, `option_value`, `autoload`) VALUES
51-
('1', 'siteurl', 'http://example.com', 'yes'),
52+
INSERT INTO `wp_options` (`option_id`, `option_name`, `option_value`, `autoload`) VALUES{SPACE}
53+
('1', 'siteurl', 'https://example.com', 'yes'),
5254
"""
5355

5456
When I run `wp search-replace example.com example.net --skip-columns=option_value --export --export_insert_size=1`
5557
Then STDOUT should contain:
5658
"""
57-
('1', 'siteurl', 'http://example.com', 'yes');
58-
INSERT INTO `wp_options` (`option_id`, `option_name`, `option_value`, `autoload`) VALUES
59+
('1', 'siteurl', 'https://example.com', 'yes');
60+
INSERT INTO `wp_options` (`option_id`, `option_name`, `option_value`, `autoload`) VALUES{SPACE}
5961
"""
6062

6163
When I run `wp search-replace foo bar --export | tail -n 1`
@@ -71,13 +73,13 @@ Feature: Search / replace with file export
7173
When I run `wp option get home`
7274
Then STDOUT should be:
7375
"""
74-
http://example.net
76+
https://example.net
7577
"""
7678

7779
Scenario: Search / replace export to file
7880
Given a WP install
7981
And I run `wp post generate --count=100`
80-
And I run `wp option add example_url http://example.com`
82+
And I run `wp option add example_url https://example.com`
8183

8284
When I run `wp search-replace example.com example.net --export=wordpress.sql`
8385
Then STDOUT should contain:
@@ -96,7 +98,7 @@ Feature: Search / replace with file export
9698
When I run `wp option get home`
9799
Then STDOUT should be:
98100
"""
99-
http://example.com
101+
https://example.com
100102
"""
101103

102104
When I run `wp site empty --yes`
@@ -112,13 +114,13 @@ Feature: Search / replace with file export
112114
When I run `wp option get home`
113115
Then STDOUT should be:
114116
"""
115-
http://example.net
117+
https://example.net
116118
"""
117119

118120
When I run `wp option get example_url`
119121
Then STDOUT should be:
120122
"""
121-
http://example.net
123+
https://example.net
122124
"""
123125

124126
When I run `wp post list --format=count`

features/search-replace.feature

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,14 @@ Feature: Do global search/replace
207207
And a setup-theme-mod.php file:
208208
"""
209209
<?php
210-
set_theme_mod( 'header_image_data', (object) array( 'url' => 'http://subdomain.example.com/foo.jpg' ) );
210+
set_theme_mod( 'header_image_data', (object) array( 'url' => 'https://subdomain.example.com/foo.jpg' ) );
211211
"""
212212
And I run `wp eval-file setup-theme-mod.php`
213213

214214
When I run `wp theme mod get header_image_data`
215215
Then STDOUT should be a table containing rows:
216-
| key | value |
217-
| header_image_data | {"url":"http:\/\/subdomain.example.com\/foo.jpg"} |
216+
| key | value |
217+
| header_image_data | {"url":"https:\/\/subdomain.example.com\/foo.jpg"} |
218218

219219
When I run `wp search-replace subdomain.example.com example.com --no-recurse-objects`
220220
Then STDOUT should be a table containing rows:
@@ -228,32 +228,32 @@ Feature: Do global search/replace
228228

229229
When I run `wp theme mod get header_image_data`
230230
Then STDOUT should be a table containing rows:
231-
| key | value |
232-
| header_image_data | {"url":"http:\/\/example.com\/foo.jpg"} |
231+
| key | value |
232+
| header_image_data | {"url":"https:\/\/example.com\/foo.jpg"} |
233233

234234
Scenario: Search and replace with quoted strings
235235
Given a WP install
236236

237-
When I run `wp post create --post_content='<a href="http://apple.com">Apple</a>' --porcelain`
237+
When I run `wp post create --post_content='<a href="https://apple.com">Apple</a>' --porcelain`
238238
Then save STDOUT as {POST_ID}
239239

240240
When I run `wp post get {POST_ID} --field=content`
241241
Then STDOUT should be:
242242
"""
243-
<a href="http://apple.com">Apple</a>
243+
<a href="https://apple.com">Apple</a>
244244
"""
245245

246-
When I run `wp search-replace '<a href="http://apple.com">Apple</a>' '<a href="http://google.com">Google</a>' --dry-run`
246+
When I run `wp search-replace '<a href="https://apple.com">Apple</a>' '<a href="https://google.com">Google</a>' --dry-run`
247247
Then STDOUT should be a table containing rows:
248248
| Table | Column | Replacements | Type |
249249
| wp_posts | post_content | 1 | SQL |
250250

251-
When I run `wp search-replace '<a href="http://apple.com">Apple</a>' '<a href="http://google.com">Google</a>'`
251+
When I run `wp search-replace '<a href="https://apple.com">Apple</a>' '<a href="https://google.com">Google</a>'`
252252
Then STDOUT should be a table containing rows:
253253
| Table | Column | Replacements | Type |
254254
| wp_posts | post_content | 1 | SQL |
255255

256-
When I run `wp search-replace '<a href="http://google.com">Google</a>' '<a href="http://apple.com">Apple</a>' --dry-run`
256+
When I run `wp search-replace '<a href="https://google.com">Google</a>' '<a href="https://apple.com">Apple</a>' --dry-run`
257257
Then STDOUT should contain:
258258
"""
259259
1 replacement to be made.
@@ -262,7 +262,7 @@ Feature: Do global search/replace
262262
When I run `wp post get {POST_ID} --field=content`
263263
Then STDOUT should be:
264264
"""
265-
<a href="http://google.com">Google</a>
265+
<a href="https://google.com">Google</a>
266266
"""
267267

268268
Scenario: Search and replace with the same terms
@@ -303,16 +303,16 @@ Feature: Do global search/replace
303303
| wp_posts | guid | 20 | SQL |
304304

305305
Examples:
306-
| replacement | flags |
307-
| {SITEURL}/subdir | |
308-
| http://newdomain.com | |
309-
| http://newdomain.com | --dry-run |
306+
| replacement | flags |
307+
| {SITEURL}/subdir | |
308+
| https://newdomain.com | |
309+
| https://newdomain.com | --dry-run |
310310

311311
Scenario Outline: Choose replacement method (PHP or MySQL/MariaDB) given proper flags or data.
312312
Given a WP install
313313
And I run `wp option get siteurl`
314314
And save STDOUT as {SITEURL}
315-
When I run `wp search-replace <flags> {SITEURL} http://wordpress.org`
315+
When I run `wp search-replace <flags> {SITEURL} https://wordpress.org`
316316

317317
Then STDOUT should be a table containing rows:
318318
| Table | Column | Replacements | Type |
@@ -357,7 +357,7 @@ Feature: Do global search/replace
357357
When I run `wp option get home`
358358
Then STDOUT should be:
359359
"""
360-
http://example.com
360+
https://example.com
361361
"""
362362

363363
When I run `wp search-replace 'EXAMPLE.com' 'BAXAMPLE.com' wp_options --regex --regex-flags=i`
@@ -368,38 +368,38 @@ Feature: Do global search/replace
368368
When I run `wp option get home`
369369
Then STDOUT should be:
370370
"""
371-
http://BAXAMPLE.com
371+
https://BAXAMPLE.com
372372
"""
373373

374374
Scenario: Search replace with a regex delimiter
375375
Given a WP install
376376

377-
When I run `wp search-replace 'HTTP://EXAMPLE.COM' 'http://example.jp/' wp_options --regex --regex-flags=i --regex-delimiter='#'`
377+
When I run `wp search-replace 'HTTPS://EXAMPLE.COM' 'https://example.jp/' wp_options --regex --regex-flags=i --regex-delimiter='#'`
378378
Then STDOUT should be a table containing rows:
379379
| Table | Column | Replacements | Type |
380380
| wp_options | option_value | 2 | PHP |
381381

382382
When I run `wp option get home`
383383
Then STDOUT should be:
384384
"""
385-
http://example.jp
385+
https://example.jp
386386
"""
387387

388-
When I run `wp search-replace 'http://example.jp/' 'http://example.com/' wp_options --regex-delimiter='/'`
388+
When I run `wp search-replace 'https://example.jp/' 'https://example.com/' wp_options --regex-delimiter='/'`
389389
Then STDOUT should be a table containing rows:
390390
| Table | Column | Replacements | Type |
391391
| wp_options | option_value | 2 | PHP |
392392

393393
When I run `wp option get home`
394394
Then STDOUT should be:
395395
"""
396-
http://example.com
396+
https://example.com
397397
"""
398398

399-
When I try `wp search-replace 'HTTP://EXAMPLE.COM' 'http://example.jp/' wp_options --regex --regex-flags=i --regex-delimiter='1'`
399+
When I try `wp search-replace 'HTTPS://EXAMPLE.COM' 'https://example.jp/' wp_options --regex --regex-flags=i --regex-delimiter='1'`
400400
Then STDERR should be:
401401
"""
402-
Error: The regex '1HTTP://EXAMPLE.COM1i' fails.
402+
Error: The regex '1HTTPS://EXAMPLE.COM1i' fails.
403403
preg_match(): Delimiter must not be alphanumeric or backslash.
404404
"""
405405
And the return code should be 1

0 commit comments

Comments
 (0)