From bdfef5f03589778dcf50f052f3d4c83f45815280 Mon Sep 17 00:00:00 2001 From: Michael D Johnson Date: Mon, 9 Dec 2024 00:57:10 -0600 Subject: [PATCH] Fix message matching in RepeatTest::testNegativeRepeatedtimes PHP 8.4 has changed the format of __FUNCTION__ for closures, at least. --- tests/Functional/RepeatTest.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/Functional/RepeatTest.php b/tests/Functional/RepeatTest.php index 9ab5e8a4..b58ee698 100644 --- a/tests/Functional/RepeatTest.php +++ b/tests/Functional/RepeatTest.php @@ -45,8 +45,13 @@ public function test(): void public function testNegativeRepeatedTimes(): void { $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage( - 'Functional\{closure}() expects parameter 1 to be positive integer, negative integer given' + + // See https://3v4l.org/Ms79G for message formats + // See https://regex101.com/r/hTvW3o/1 for regex setup + $this->expectExceptionMessageMatches( + '/(Functional\\\\{closure}' // PHP < 8.4 + . '|{closure:Functional\\\\repeat\(\):[0-9]+})' // PHP 8.4+ + . '\(\) expects parameter 1 to be positive integer, negative integer given/' ); repeat([$this->repeated, 'foo'])(-1);