Skip to content

Commit cbfbaf7

Browse files
committed
Fix regex invalid delimiter test for PHP 8.2
1 parent 6b195e3 commit cbfbaf7

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

features/search-replace.feature

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -396,14 +396,6 @@ Feature: Do global search/replace
396396
https://example.com
397397
"""
398398

399-
When I try `wp search-replace 'HTTPS://EXAMPLE.COM' 'https://example.jp/' wp_options --regex --regex-flags=i --regex-delimiter='1'`
400-
Then STDERR should be:
401-
"""
402-
Error: The regex '1HTTPS://EXAMPLE.COM1i' fails.
403-
preg_match(): Delimiter must not be alphanumeric or backslash.
404-
"""
405-
And the return code should be 1
406-
407399
When I try `wp search-replace 'regex error)' '' --regex`
408400
Then STDERR should contain:
409401
"""
@@ -464,6 +456,30 @@ Feature: Do global search/replace
464456
"""
465457
And the return code should be 1
466458

459+
@less-than-php-8.2
460+
Scenario: Search replace with an invalid regex delimiter
461+
Given a WP install
462+
463+
When I try `wp search-replace 'HTTPS://EXAMPLE.COM' 'https://example.jp/' wp_options --regex --regex-flags=i --regex-delimiter='1'`
464+
Then STDERR should be:
465+
"""
466+
Error: The regex '1HTTPS://EXAMPLE.COM1i' fails.
467+
preg_match(): Delimiter must not be alphanumeric or backslash.
468+
"""
469+
And the return code should be 1
470+
471+
@require-php-8.2
472+
Scenario: Search replace with an invalid regex delimiter
473+
Given a WP install
474+
475+
When I try `wp search-replace 'HTTPS://EXAMPLE.COM' 'https://example.jp/' wp_options --regex --regex-flags=i --regex-delimiter='1'`
476+
Then STDERR should be:
477+
"""
478+
Error: The regex '1HTTPS://EXAMPLE.COM1i' fails.
479+
preg_match(): Delimiter must not be alphanumeric, backslash, or NUL.
480+
"""
481+
And the return code should be 1
482+
467483
Scenario: Formatting as count-only
468484
Given a WP install
469485
And I run `wp option set foo 'ALPHA.example.com'`

0 commit comments

Comments
 (0)