File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 |
You can’t perform that action at this time.
0 commit comments