Skip to content

Commit 32416f8

Browse files
authored
Merge pull request #60 from wp-cli/issue-73-wp_get_table_names
Adjust tests for wp_get_table_names changes.
2 parents 813977a + 306b4e3 commit 32416f8

File tree

2 files changed

+12
-29
lines changed

2 files changed

+12
-29
lines changed

features/search-replace-export.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ Feature: Search / replace with file export
213213
When I run `wp db query "SOURCE esc_sql_ident.sql;"`
214214
Then STDERR should be empty
215215

216-
When I run `wp search-replace 'v"vvvv_v' 'w"wwww_w' TABLE --export`
216+
When I run `wp search-replace 'v"vvvv_v' 'w"wwww_w' TABLE --export --all-tables`
217217
Then STDOUT should contain:
218218
"""
219219
INSERT INTO `TABLE` (`KEY`, `VALUES`, `single'double"quote`) VALUES
@@ -228,7 +228,7 @@ Feature: Search / replace with file export
228228
"""
229229
And STDERR should be empty
230230

231-
When I run `wp search-replace 'v"vvvv_v2' 'w"wwww_w2' TABLE --export --regex`
231+
When I run `wp search-replace 'v"vvvv_v2' 'w"wwww_w2' TABLE --export --regex --all-tables`
232232
Then STDOUT should contain:
233233
"""
234234
INSERT INTO `TABLE` (`KEY`, `VALUES`, `single'double"quote`) VALUES

features/search-replace.feature

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ Feature: Do global search/replace
271271
And I run `wp db query "INSERT INTO wp_multicol VALUES (1, 'foo', 'bar')"`
272272
And I run `wp db query "INSERT INTO wp_multicol VALUES (2, 'bar', 'foo')"`
273273

274-
When I run `wp search-replace bar replaced wp_multicol`
274+
When I run `wp search-replace bar replaced wp_multicol --all-tables`
275275
Then STDOUT should be a table containing rows:
276276
| Table | Column | Replacements | Type |
277277
| wp_multicol | name | 1 | SQL |
@@ -458,15 +458,15 @@ Feature: Do global search/replace
458458
When I run `wp db query "SOURCE esc_sql_ident.sql;"`
459459
Then STDERR should be empty
460460

461-
When I run `wp search-replace 'v"vvvv_v' 'w"wwww_w' TABLE --format=count`
461+
When I run `wp search-replace 'v"vvvv_v' 'w"wwww_w' TABLE --format=count --all-tables`
462462
Then STDOUT should be:
463463
"""
464464
6
465465
"""
466466
And STDERR should be empty
467467

468468
# Regex uses wpdb::update() which can't handle backticks in field names so avoid `back``tick` column.
469-
When I run `wp search-replace 'w"wwww_w' 'v"vvvv_v' TABLE --regex --include-columns='VALUES,single'\''double"quote' --format=count`
469+
When I run `wp search-replace 'w"wwww_w' 'v"vvvv_v' TABLE --regex --include-columns='VALUES,single'\''double"quote' --format=count --all-tables`
470470
Then STDOUT should be:
471471
"""
472472
4
@@ -586,33 +586,16 @@ Feature: Do global search/replace
586586
Scenario: Deal with non-existent table and table with no primary keys
587587
Given a WP install
588588

589-
When I run `wp search-replace foo bar no_such_table`
590-
Then STDOUT should contain:
591-
"""
592-
Success: Made 0 replacements.
593-
"""
594-
And STDOUT should end with a table containing rows:
595-
| Table | Column | Replacements | Type |
596-
| no_such_table | | skipped | |
597-
And STDERR should be empty
598-
599-
When I try `wp search-replace foo bar no_such_table --no-report`
600-
Then STDOUT should contain:
601-
"""
602-
Success: Made 0 replacements.
603-
"""
604-
And STDOUT should not contain:
605-
"""
606-
Table Column Replacements Type
607-
"""
589+
When I try `wp search-replace foo bar no_such_table --all-tables`
590+
Then STDOUT should be empty
608591
And STDERR should be:
609592
"""
610-
Warning: No such table 'no_such_table'.
593+
Error: Couldn't find any tables matching: no_such_table
611594
"""
612-
And the return code should be 0
595+
And the return code should be 1
613596

614597
When I run `wp db query "CREATE TABLE no_key ( awesome_stuff TEXT );"`
615-
And I run `wp search-replace foo bar no_key`
598+
And I run `wp search-replace foo bar no_key --all-tables`
616599
Then STDOUT should contain:
617600
"""
618601
Success: Made 0 replacements.
@@ -622,7 +605,7 @@ Feature: Do global search/replace
622605
| no_key | | skipped | |
623606
And STDERR should be empty
624607

625-
And I run `wp search-replace foo bar no_key --report-changed-only`
608+
And I run `wp search-replace foo bar no_key --report-changed-only --all-tables`
626609
Then STDOUT should contain:
627610
"""
628611
Success: Made 0 replacements.
@@ -634,7 +617,7 @@ Feature: Do global search/replace
634617
"""
635618
And STDERR should be empty
636619

637-
When I try `wp search-replace foo bar no_key --no-report`
620+
When I try `wp search-replace foo bar no_key --no-report --all-tables`
638621
Then STDOUT should contain:
639622
"""
640623
Success: Made 0 replacements.

0 commit comments

Comments
 (0)