Skip to content

Commit 35e214e

Browse files
committed
test: add failing test to test against new replace keys feature flag
1 parent 3db2bb1 commit 35e214e

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

features/search-replace.feature

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,32 @@ Feature: Do global search/replace
303303
http:\/\/example.com
304304
"""
305305

306+
Scenario: Search and replace serialized array keys with --replace-keys
307+
Given a WP install
308+
And a setup-serialized-array-key.php file:
309+
"""
310+
<?php
311+
update_option( 'replace_key_option', array( 'sr-key-old' => 'value' ) );
312+
"""
313+
And I run `wp eval-file setup-serialized-array-key.php`
314+
315+
When I run `wp search-replace sr-key-old sr-key-new --dry-run`
316+
Then STDOUT should be a table containing rows:
317+
| Table | Column | Replacements | Type |
318+
| wp_options | option_value | 0 | PHP |
319+
320+
When I run `wp search-replace sr-key-old sr-key-new --replace-keys --dry-run`
321+
Then STDOUT should be a table containing rows:
322+
| Table | Column | Replacements | Type |
323+
| wp_options | option_value | 1 | PHP |
324+
325+
When I run `wp search-replace sr-key-old sr-key-new --replace-keys`
326+
And I run `wp option get replace_key_option --format=json`
327+
Then STDOUT should be JSON containing:
328+
"""
329+
{"sr-key-new":"value"}
330+
"""
331+
306332
When I run `wp search-replace 'http://newdomain.com' 'http://example.com' wp_posts --include-columns=post_content --precise`
307333
Then STDOUT should be a table containing rows:
308334
| Table | Column | Replacements | Type |

0 commit comments

Comments
 (0)