Skip to content

Commit 439483d

Browse files
committed
Add regression test
1 parent 813977a commit 439483d

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

features/search-replace.feature

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -994,3 +994,29 @@ Feature: Do global search/replace
994994
> Just another WP site
995995
"""
996996
And STDERR should be empty
997+
998+
# Regression test for https://github.com/wp-cli/search-replace-command/issues/58
999+
Scenario: The parameters --regex and --all-tables-with-prefix produce valid SQL
1000+
Given a WP install
1001+
And a test_db.sql file:
1002+
"""
1003+
DROP TABLE IF EXISTS `wp_123_test`;
1004+
CREATE TABLE `wp_123_test` (
1005+
`name` varchar(50),
1006+
`value` varchar(5000),
1007+
`created_at` datetime NOT NULL,
1008+
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1009+
PRIMARY KEY (`name`)
1010+
) ENGINE=InnoDB;
1011+
INSERT INTO `wp_123_test` VALUES ('test_val','off','2016-11-15 14:41:33','2016-11-15 21:41:33');
1012+
"""
1013+
1014+
When I run `wp db query "SOURCE test_db.sql;"`
1015+
Then STDERR should be empty
1016+
1017+
When I run `wp search-replace --dry-run --regex 'mytestdomain.com\/' 'mytestdomain2.com/' --all-tables-with-prefix --skip-columns=guid,domain`
1018+
Then STDERR should be empty
1019+
And STDOUT should contain:
1020+
"""
1021+
Success: 0 replacements to be made.
1022+
"""

0 commit comments

Comments
 (0)