You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: features/search-replace.feature
+28-5Lines changed: 28 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
1
Feature: Do global search/replace
2
2
3
+
@require-mysql
3
4
Scenario: Basic search/replace
4
5
Given a WP install
5
6
@@ -41,6 +42,7 @@ Feature: Do global search/replace
41
42
| wp_posts | post_content | 0 | SQL |
42
43
43
44
45
+
@require-mysql
44
46
Scenario: Multisite search/replace
45
47
Given a WP multisite install
46
48
And I run `wp site create --slug="foo" --title="foo" --email="foo@example.com"`
@@ -50,6 +52,7 @@ Feature: Do global search/replace
50
52
| wp_2_options | option_value | 4 | PHP |
51
53
| wp_blogs | path | 1 | SQL |
52
54
55
+
@require-mysql
53
56
Scenario: Don't run on unregistered tables by default
54
57
Given a WP install
55
58
And I run `wp db query "CREATE TABLE wp_awesome ( id int(11) unsigned NOT NULL AUTO_INCREMENT, awesome_stuff TEXT, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;"`
@@ -66,6 +69,7 @@ Feature: Do global search/replace
66
69
wp_awesome
67
70
"""
68
71
72
+
@require-mysql
69
73
Scenario: Run on unregistered, unprefixed tables with --all-tables flag
70
74
Given a WP install
71
75
And I run `wp db query "CREATE TABLE awesome_table ( id int(11) unsigned NOT NULL AUTO_INCREMENT, awesome_stuff TEXT, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;"`
@@ -82,6 +86,7 @@ Feature: Do global search/replace
82
86
awesome_table
83
87
"""
84
88
89
+
@require-mysql
85
90
Scenario: Run on all tables matching string with wildcard
86
91
Given a WP install
87
92
@@ -154,12 +159,14 @@ Feature: Do global search/replace
154
159
bar
155
160
"""
156
161
162
+
@require-mysql
157
163
Scenario: Quiet search/replace
158
164
Given a WP install
159
165
160
166
When I run `wp search-replace foo bar --quiet`
161
167
Then STDOUT should be empty
162
168
169
+
@require-mysql
163
170
Scenario: Verbose search/replace
164
171
Given a WP install
165
172
And I run `wp post create --post_title='Replace this text' --porcelain`
@@ -202,6 +209,7 @@ Feature: Do global search/replace
202
209
"""
203
210
And the return code should be 1
204
211
212
+
@require-mysql
205
213
Scenario: Search and replace within theme mods
206
214
Given a WP install
207
215
And a setup-theme-mod.php file:
@@ -231,6 +239,7 @@ Feature: Do global search/replace
@@ -276,6 +285,7 @@ Feature: Do global search/replace
276
285
And STDOUT should be empty
277
286
And the return code should be 0
278
287
288
+
@require-mysql
279
289
Scenario: Search and replace a table that has a multi-column primary key
280
290
Given a WP install
281
291
And I run `wp db query "CREATE TABLE wp_multicol ( "id" bigint(20) NOT NULL AUTO_INCREMENT,"name" varchar(60) NOT NULL,"value" text NOT NULL,PRIMARY KEY ("id","name"),UNIQUE KEY "name" ("name") ) ENGINE=InnoDB DEFAULT CHARSET=utf8 "`
@@ -308,6 +318,7 @@ Feature: Do global search/replace
308
318
| https://newdomain.com | |
309
319
| https://newdomain.com | --dry-run |
310
320
321
+
@require-mysql
311
322
Scenario Outline: Choose replacement method (PHP or MySQL/MariaDB) given proper flags or data.
312
323
Given a WP install
313
324
And I run `wp option get siteurl`
@@ -324,6 +335,7 @@ Feature: Do global search/replace
324
335
| | PHP | SQL |
325
336
| --precise | PHP | PHP |
326
337
338
+
@require-mysql
327
339
Scenario Outline: Ensure search and replace uses PHP (precise) mode when serialized data is found
328
340
Given a WP install
329
341
And I run `wp post create --post_content='<input>' --porcelain`
@@ -346,6 +358,7 @@ Feature: Do global search/replace
346
358
| a:1:{s:3:"bar";s:3:"foo";} |
347
359
| O:8:"stdClass":1:{s:1:"a";s:3:"foo";} |
348
360
361
+
@require-mysql
349
362
Scenario: Search replace with a regex flag
350
363
Given a WP install
351
364
@@ -371,6 +384,7 @@ Feature: Do global search/replace
371
384
https://BAXAMPLE.com
372
385
"""
373
386
387
+
@require-mysql
374
388
Scenario: Search replace with a regex delimiter
375
389
Given a WP install
376
390
@@ -469,6 +483,7 @@ Feature: Do global search/replace
469
483
"""
470
484
And the return code should be 1
471
485
486
+
@require-mysql
472
487
Scenario: Formatting as count-only
473
488
Given a WP install
474
489
And I run `wp option set foo 'ALPHA.example.com'`
@@ -498,6 +513,7 @@ Feature: Do global search/replace
498
513
0
499
514
"""
500
515
516
+
@require-mysql
501
517
Scenario: Search / replace should cater for field/table names that use reserved words or unusual characters
502
518
Given a WP install
503
519
And a esc_sql_ident.sql file:
@@ -525,7 +541,7 @@ Feature: Do global search/replace
525
541
"""
526
542
And STDERR should be empty
527
543
528
-
@suppress_report__only_changes
544
+
@require-mysql@suppress_report__only_changes
529
545
Scenario: Suppress report or only report changes
530
546
Given a WP install
531
547
@@ -634,7 +650,7 @@ Feature: Do global search/replace
634
650
"""
635
651
And STDERR should be empty
636
652
637
-
@no_table__no_primary_key
653
+
@require-mysql@no_table__no_primary_key
638
654
Scenario: Deal with non-existent table and table with no primary keys
639
655
Given a WP install
640
656
@@ -684,6 +700,7 @@ Feature: Do global search/replace
684
700
"""
685
701
And the return code should be 0
686
702
703
+
@require-mysql
687
704
Scenario: Search / replace is case sensitive
688
705
Given a WP install
689
706
When I run `wp post create --post_title='Case Sensitive' --porcelain`
@@ -717,6 +734,7 @@ Feature: Do global search/replace
717
734
"""
718
735
And STDERR should be empty
719
736
737
+
@require-mysql
720
738
Scenario: Logging with simple replace
721
739
Given a WP install
722
740
@@ -932,6 +950,7 @@ Feature: Do global search/replace
And I run `wp option set blogdescription 'Just another WordPress site'`
@@ -1032,6 +1051,7 @@ Feature: Do global search/replace
1032
1051
And STDERR should be empty
1033
1052
1034
1053
# Regression test for https://github.com/wp-cli/search-replace-command/issues/58
1054
+
@require-mysql
1035
1055
Scenario: The parameters --regex and --all-tables-with-prefix produce valid SQL
1036
1056
Given a WP install
1037
1057
And a test_db.sql file:
@@ -1085,6 +1105,7 @@ Feature: Do global search/replace
1085
1105
"""
1086
1106
1087
1107
# Regression test for https://github.com/wp-cli/search-replace-command/issues/68
1108
+
@require-mysql
1088
1109
Scenario: Incomplete classes are handled gracefully during (un)serialization
1089
1110
1090
1111
Given a WP install
@@ -1106,7 +1127,7 @@ Feature: Do global search/replace
1106
1127
a:1:{i:0;O:10:"CornFlakes":0:{}}
1107
1128
"""
1108
1129
1109
-
@less-than-php-8.0
1130
+
@require-mysql@less-than-php-8.0
1110
1131
Scenario: Warn and ignore type-hinted objects that have some error in deserialization (PHP < 8.0)
1111
1132
Given a WP install
1112
1133
And I run `wp db query "INSERT INTO wp_options (option_name,option_value) VALUES ('cereal_isation','O:13:\"mysqli_result\":5:{s:13:\"current_field\";N;s:11:\"field_count\";N;s:7:\"lengths\";N;s:8:\"num_rows\";N;s:4:\"type\";N;}')"`
@@ -1147,7 +1168,7 @@ Feature: Do global search/replace
1147
1168
[field_count] => 2
1148
1169
"""
1149
1170
1150
-
@require-php-8.0@less-than-php-8.1
1171
+
@require-mysql@require-php-8.0@less-than-php-8.1
1151
1172
Scenario: Warn and ignore type-hinted objects that have some error in deserialization (PHP 8.0)
1152
1173
Given a WP install
1153
1174
And I run `wp db query "INSERT INTO wp_options (option_name,option_value) VALUES ('cereal_isation','O:13:\"mysqli_result\":5:{s:13:\"current_field\";N;s:11:\"field_count\";N;s:7:\"lengths\";N;s:8:\"num_rows\";N;s:4:\"type\";N;}')"`
@@ -1188,7 +1209,7 @@ Feature: Do global search/replace
1188
1209
[field_count] => 2
1189
1210
"""
1190
1211
1191
-
@require-php-8.1
1212
+
@require-mysql@require-php-8.1
1192
1213
Scenario: Warn and ignore type-hinted objects that have some error in deserialization (PHP 8.1+)
1193
1214
Given a WP install
1194
1215
And I run `wp db query "INSERT INTO wp_options (option_name,option_value) VALUES ('cereal_isation','O:13:\"mysqli_result\":5:{s:13:\"current_field\";N;s:11:\"field_count\";N;s:7:\"lengths\";N;s:8:\"num_rows\";N;s:4:\"type\";N;}')"`
@@ -1272,6 +1293,7 @@ Feature: Do global search/replace
1272
1293
Success:
1273
1294
"""
1274
1295
1296
+
@require-mysql
1275
1297
Scenario: Chunking a precise search and replace works without skipping lines
1276
1298
Given a WP install
1277
1299
And a create_sql_file.sh file:
@@ -1323,6 +1345,7 @@ Feature: Do global search/replace
1323
1345
Success: Made 0 replacements.
1324
1346
"""
1325
1347
1348
+
@require-mysql
1326
1349
Scenario: Chunking a regex search and replace works without skipping lines
0 commit comments