-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
43abfb5
commit da1acc7
Showing
2 changed files
with
37 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
Feature: Do global search/replace | ||
|
||
@require-mysql | ||
Scenario: Basic search/replace | ||
Given a WP install | ||
|
||
|
@@ -41,6 +42,7 @@ Feature: Do global search/replace | |
| wp_posts | post_content | 0 | SQL | | ||
|
||
|
||
@require-mysql | ||
Scenario: Multisite search/replace | ||
Given a WP multisite install | ||
And I run `wp site create --slug="foo" --title="foo" --email="[email protected]"` | ||
|
@@ -50,6 +52,7 @@ Feature: Do global search/replace | |
| wp_2_options | option_value | 4 | PHP | | ||
| wp_blogs | path | 1 | SQL | | ||
|
||
@require-mysql | ||
Scenario: Don't run on unregistered tables by default | ||
Given a WP install | ||
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 | |
wp_awesome | ||
""" | ||
|
||
@require-mysql | ||
Scenario: Run on unregistered, unprefixed tables with --all-tables flag | ||
Given a WP install | ||
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 | |
awesome_table | ||
""" | ||
|
||
@require-mysql | ||
Scenario: Run on all tables matching string with wildcard | ||
Given a WP install | ||
|
||
|
@@ -154,12 +159,14 @@ Feature: Do global search/replace | |
bar | ||
""" | ||
|
||
@require-mysql | ||
Scenario: Quiet search/replace | ||
Given a WP install | ||
|
||
When I run `wp search-replace foo bar --quiet` | ||
Then STDOUT should be empty | ||
|
||
@require-mysql | ||
Scenario: Verbose search/replace | ||
Given a WP install | ||
And I run `wp post create --post_title='Replace this text' --porcelain` | ||
|
@@ -202,6 +209,7 @@ Feature: Do global search/replace | |
""" | ||
And the return code should be 1 | ||
|
||
@require-mysql | ||
Scenario: Search and replace within theme mods | ||
Given a WP install | ||
And a setup-theme-mod.php file: | ||
|
@@ -231,6 +239,7 @@ Feature: Do global search/replace | |
| key | value | | ||
| header_image_data | {"url":"https:\/\/example.com\/foo.jpg"} | | ||
|
||
@require-mysql | ||
Scenario: Search and replace with quoted strings | ||
Given a WP install | ||
|
||
|
@@ -276,6 +285,7 @@ Feature: Do global search/replace | |
And STDOUT should be empty | ||
And the return code should be 0 | ||
|
||
@require-mysql | ||
Scenario: Search and replace a table that has a multi-column primary key | ||
Given a WP install | ||
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 | |
| https://newdomain.com | | | ||
| https://newdomain.com | --dry-run | | ||
|
||
@require-mysql | ||
Scenario Outline: Choose replacement method (PHP or MySQL/MariaDB) given proper flags or data. | ||
Given a WP install | ||
And I run `wp option get siteurl` | ||
|
@@ -324,6 +335,7 @@ Feature: Do global search/replace | |
| | PHP | SQL | | ||
| --precise | PHP | PHP | | ||
|
||
@require-mysql | ||
Scenario Outline: Ensure search and replace uses PHP (precise) mode when serialized data is found | ||
Given a WP install | ||
And I run `wp post create --post_content='<input>' --porcelain` | ||
|
@@ -346,6 +358,7 @@ Feature: Do global search/replace | |
| a:1:{s:3:"bar";s:3:"foo";} | | ||
| O:8:"stdClass":1:{s:1:"a";s:3:"foo";} | | ||
|
||
@require-mysql | ||
Scenario: Search replace with a regex flag | ||
Given a WP install | ||
|
||
|
@@ -371,6 +384,7 @@ Feature: Do global search/replace | |
https://BAXAMPLE.com | ||
""" | ||
|
||
@require-mysql | ||
Scenario: Search replace with a regex delimiter | ||
Given a WP install | ||
|
||
|
@@ -469,6 +483,7 @@ Feature: Do global search/replace | |
""" | ||
And the return code should be 1 | ||
|
||
@require-mysql | ||
Scenario: Formatting as count-only | ||
Given a WP install | ||
And I run `wp option set foo 'ALPHA.example.com'` | ||
|
@@ -498,6 +513,7 @@ Feature: Do global search/replace | |
0 | ||
""" | ||
|
||
@require-mysql | ||
Scenario: Search / replace should cater for field/table names that use reserved words or unusual characters | ||
Given a WP install | ||
And a esc_sql_ident.sql file: | ||
|
@@ -525,7 +541,7 @@ Feature: Do global search/replace | |
""" | ||
And STDERR should be empty | ||
|
||
@suppress_report__only_changes | ||
@require-mysql @suppress_report__only_changes | ||
Scenario: Suppress report or only report changes | ||
Given a WP install | ||
|
||
|
@@ -634,7 +650,7 @@ Feature: Do global search/replace | |
""" | ||
And STDERR should be empty | ||
|
||
@no_table__no_primary_key | ||
@require-mysql @no_table__no_primary_key | ||
Scenario: Deal with non-existent table and table with no primary keys | ||
Given a WP install | ||
|
||
|
@@ -684,6 +700,7 @@ Feature: Do global search/replace | |
""" | ||
And the return code should be 0 | ||
|
||
@require-mysql | ||
Scenario: Search / replace is case sensitive | ||
Given a WP install | ||
When I run `wp post create --post_title='Case Sensitive' --porcelain` | ||
|
@@ -717,6 +734,7 @@ Feature: Do global search/replace | |
""" | ||
And STDERR should be empty | ||
|
||
@require-mysql | ||
Scenario: Logging with simple replace | ||
Given a WP install | ||
|
||
|
@@ -932,6 +950,7 @@ Feature: Do global search/replace | |
Content_ab\1z__baz_1234567890_eb\1z__bez_1234567890_ib\1z__biz_1234567890_ob\1z__boz_1234567890_ub\1z__buz_ | ||
""" | ||
|
||
@require-mysql | ||
Scenario: Logging with prefixes and custom colors | ||
Given a WP install | ||
And I run `wp option set blogdescription 'Just another WordPress site'` | ||
|
@@ -1032,6 +1051,7 @@ Feature: Do global search/replace | |
And STDERR should be empty | ||
|
||
# Regression test for https://github.com/wp-cli/search-replace-command/issues/58 | ||
@require-mysql | ||
Scenario: The parameters --regex and --all-tables-with-prefix produce valid SQL | ||
Given a WP install | ||
And a test_db.sql file: | ||
|
@@ -1085,6 +1105,7 @@ Feature: Do global search/replace | |
""" | ||
|
||
# Regression test for https://github.com/wp-cli/search-replace-command/issues/68 | ||
@require-mysql | ||
Scenario: Incomplete classes are handled gracefully during (un)serialization | ||
|
||
Given a WP install | ||
|
@@ -1106,7 +1127,7 @@ Feature: Do global search/replace | |
a:1:{i:0;O:10:"CornFlakes":0:{}} | ||
""" | ||
|
||
@less-than-php-8.0 | ||
@require-mysql @less-than-php-8.0 | ||
Scenario: Warn and ignore type-hinted objects that have some error in deserialization (PHP < 8.0) | ||
Given a WP install | ||
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 | |
[field_count] => 2 | ||
""" | ||
|
||
@require-php-8.0 @less-than-php-8.1 | ||
@require-mysql @require-php-8.0 @less-than-php-8.1 | ||
Scenario: Warn and ignore type-hinted objects that have some error in deserialization (PHP 8.0) | ||
Given a WP install | ||
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 | |
[field_count] => 2 | ||
""" | ||
|
||
@require-php-8.1 | ||
@require-mysql @require-php-8.1 | ||
Scenario: Warn and ignore type-hinted objects that have some error in deserialization (PHP 8.1+) | ||
Given a WP install | ||
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 | |
Success: | ||
""" | ||
|
||
@require-mysql | ||
Scenario: Chunking a precise search and replace works without skipping lines | ||
Given a WP install | ||
And a create_sql_file.sh file: | ||
|
@@ -1323,6 +1345,7 @@ Feature: Do global search/replace | |
Success: Made 0 replacements. | ||
""" | ||
|
||
@require-mysql | ||
Scenario: Chunking a regex search and replace works without skipping lines | ||
Given a WP install | ||
And a create_sql_file.sh file: | ||
|