File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 1212
1313use Functional \Exceptions \InvalidArgumentException ;
1414use PHPUnit \Framework \MockObject \MockObject ;
15+ use PHPUnit \Runner \Version as PHPUnitVersion ;
1516
1617use function Functional \repeat ;
1718
@@ -48,11 +49,20 @@ public function testNegativeRepeatedTimes(): void
4849
4950 // See https://3v4l.org/Ms79G for message formats
5051 // See https://regex101.com/r/hTvW3o/1 for regex setup
51- $ this ->expectExceptionMessageMatches (
52- '/(Functional \\\\{closure} ' // PHP < 8.4
52+ if (\version_compare (PHPUnitVersion::id (), '9.0.0 ' , '>= ' ) >= 0 ) {
53+ // PHPUnit 10 changed the wording of the exception message
54+ $ this ->expectExceptionMessageMatches (
55+ '/(Functional \\\\{closure} ' // PHP < 8.4
5356 . '|{closure:Functional \\\\repeat\(\):[0-9]+}) ' // PHP 8.4+
5457 . '\(\) expects parameter 1 to be positive integer, negative integer given/ '
55- );
58+ );
59+ } else {
60+ $ this ->expectExceptionMessageRegExp (
61+ '/(Functional \\\\{closure} ' // PHP < 8.4
62+ . '|{closure:Functional \\\\repeat\(\):[0-9]+}) ' // PHP 8.4+
63+ . '\(\) expects parameter 1 to be positive integer, negative integer given/ '
64+ );
65+ }
5666
5767 repeat ([$ this ->repeated , 'foo ' ])(-1 );
5868 }
You can’t perform that action at this time.
0 commit comments