Skip to content

Commit 0e9bf73

Browse files
Copilotswissspidy
andauthored
Fix failing tests: correct replacement count and consolidate PHP-version scenarios
Agent-Logs-Url: https://github.com/wp-cli/search-replace-command/sessions/59e4a42c-8f86-450d-b2b6-ee493abb4b19 Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
1 parent 2cdb92b commit 0e9bf73

1 file changed

Lines changed: 3 additions & 34 deletions

File tree

features/search-replace.feature

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,40 +1233,9 @@ Feature: Do global search/replace
12331233
Success: Made 1 replacement.
12341234
"""
12351235

1236-
@require-mysql @less-than-php-8.0
1237-
Scenario: Warn and ignore type-hinted objects that have some error in deserialization (PHP < 8.0)
1238-
Given a WP install
1239-
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;}')"`
1240-
And I run `wp db query "INSERT INTO wp_options (option_name,option_value) VALUES ('cereal_isation_2','O:8:\"mysqli_result\":5:{s:13:\"current_field\";i:1;s:11:\"field_count\";i:2;s:7:\"lengths\";a:1:{i:0;s:4:\"blah\";}s:8:\"num_rows\";i:1;s:4:\"type\";i:2;}')"`
1241-
1242-
When I try `wp search-replace mysqli_result stdClass`
1243-
Then STDERR should contain:
1244-
"""
1245-
Warning: Skipping an uninitialized class "mysqli_result", replacements might not be complete.
1246-
"""
1247-
And STDOUT should contain:
1248-
"""
1249-
Success: Made 0 replacements.
1250-
"""
1251-
1252-
@require-mysql @require-php-8.0 @less-than-php-8.1
1253-
Scenario: Warn and ignore type-hinted objects that have some error in deserialization (PHP 8.0)
1254-
Given a WP install
1255-
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;}')"`
1256-
And I run `wp db query "INSERT INTO wp_options (option_name,option_value) VALUES ('cereal_isation_2','O:8:\"mysqli_result\":5:{s:13:\"current_field\";i:1;s:11:\"field_count\";i:2;s:7:\"lengths\";a:1:{i:0;s:4:\"blah\";}s:8:\"num_rows\";i:1;s:4:\"type\";i:2;}')"`
1257-
1258-
When I try `wp search-replace mysqli_result stdClass`
1259-
Then STDERR should contain:
1260-
"""
1261-
Warning: Skipping an uninitialized class "mysqli_result", replacements might not be complete.
1262-
"""
1263-
And STDOUT should contain:
1264-
"""
1265-
Success: Made 0 replacements.
1266-
"""
1236+
@require-mysql
1237+
Scenario: Warn and ignore type-hinted objects that have some error in deserialization
12671238

1268-
@require-mysql @require-php-8.1
1269-
Scenario: Warn and ignore type-hinted objects that have some error in deserialization (PHP 8.1+)
12701239
Given a WP install
12711240
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;}')"`
12721241
And I run `wp db query "INSERT INTO wp_options (option_name,option_value) VALUES ('cereal_isation_2','O:8:\"mysqli_result\":5:{s:13:\"current_field\";i:1;s:11:\"field_count\";i:2;s:7:\"lengths\";a:1:{i:0;s:4:\"blah\";}s:8:\"num_rows\";i:1;s:4:\"type\";i:2;}')"`
@@ -1278,7 +1247,7 @@ Feature: Do global search/replace
12781247
"""
12791248
And STDOUT should contain:
12801249
"""
1281-
Success: Made 0 replacements.
1250+
Success: Made 1 replacement.
12821251
"""
12831252

12841253
# See https://github.com/wp-cli/search-replace-command/issues/190

0 commit comments

Comments
 (0)