Skip to content

Commit f22ba29

Browse files
committed
Add test that triggers the chunking offset failure
1 parent 9846c1a commit f22ba29

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

features/search-replace.feature

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,3 +1142,45 @@ Feature: Do global search/replace
11421142
"""
11431143
Success:
11441144
"""
1145+
1146+
Scenario: Chunking works without skipping lines
1147+
Given a WP install
1148+
And a create_sql_file.sh file:
1149+
"""
1150+
#!/bin/bash
1151+
echo "CREATE TABLE \`wp_123_test\` (\`key\` INT(5) UNSIGNED NOT NULL AUTO_INCREMENT, \`text\` TEXT, PRIMARY KEY (\`key\`) );" > test_db.sql
1152+
echo "INSERT INTO \`wp_123_test\` (\`text\`) VALUES" >> test_db.sql
1153+
index=1
1154+
while [[ $index -le 999 ]];
1155+
do
1156+
echo "('abc'),('abc'),('abc'),('abc'),('abc'),('abc'),('abc'),('abc'),('abc'),('abc')," >> test_db.sql
1157+
index=`expr $index + 1`
1158+
done
1159+
echo "('abc'),('abc'),('abc'),('abc'),('abc'),('abc'),('abc'),('abc'),('abc'),('abc');" >> test_db.sql
1160+
"""
1161+
And I run `bash create_sql_file.sh`
1162+
And I run `wp db query "SOURCE test_db.sql;"`
1163+
1164+
When I run `wp search-replace --dry-run 'abc' 'def' --all-tables-with-prefix --skip-columns=guid,domain --precise`
1165+
Then STDOUT should contain:
1166+
"""
1167+
Success: 10000 replacements to be made.
1168+
"""
1169+
1170+
When I run `wp search-replace 'abc' 'def' --all-tables-with-prefix --skip-columns=guid,domain --precise`
1171+
Then STDOUT should contain:
1172+
"""
1173+
Success: Made 10000 replacements.
1174+
"""
1175+
1176+
When I run `wp search-replace --dry-run 'abc' 'def' --all-tables-with-prefix --skip-columns=guid,domain --precise`
1177+
Then STDOUT should contain:
1178+
"""
1179+
Success: 0 replacements to be made.
1180+
"""
1181+
1182+
When I run `wp search-replace 'abc' 'def' --all-tables-with-prefix --skip-columns=guid,domain --precise`
1183+
Then STDOUT should contain:
1184+
"""
1185+
Success: Made 0 replacements.
1186+
"""

0 commit comments

Comments
 (0)