Skip to content

Commit 105e5af

Browse files
committed
account for error message changes in PHP 8.5
1 parent c0938cd commit 105e5af

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Tests/Transliterator/EmojiTransliteratorTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ public static function provideLocaleTest(): iterable
109109
public function testTransliterateWithInvalidLocale()
110110
{
111111
$this->expectException(\IntlException::class);
112-
$this->expectExceptionMessage('transliterator_create: unable to open ICU transliterator with id "emoji-invalid"');
112+
113+
$this->expectExceptionMessage(\sprintf('%s: unable to open ICU transliterator with id "emoji-invalid":', \PHP_VERSION_ID >= 80500 ? 'Transliterator::create()' : 'transliterator_create'));
113114

114115
EmojiTransliterator::create('invalid');
115116
}
@@ -133,7 +134,7 @@ public function testNotUtf8()
133134
$this->iniSet('intl.use_exceptions', 0);
134135

135136
$this->assertFalse($tr->transliterate("Not \xE9 UTF-8"));
136-
$this->assertSame('String conversion of string to UTF-16 failed: U_INVALID_CHAR_FOUND', intl_get_error_message());
137+
$this->assertSame(\sprintf('%sString conversion of string to UTF-16 failed: U_INVALID_CHAR_FOUND', \PHP_VERSION_ID >= 80500 ? 'Transliterator::transliterate(): ' : ''), intl_get_error_message());
137138

138139
$this->iniSet('intl.use_exceptions', 1);
139140

@@ -150,12 +151,12 @@ public function testBadOffsets()
150151
$this->iniSet('intl.use_exceptions', 0);
151152

152153
$this->assertFalse($tr->transliterate('Abc', 1, 5));
153-
$this->assertSame('transliterator_transliterate: Neither "start" nor the "end" arguments can exceed the number of UTF-16 code units (in this case, 3): U_ILLEGAL_ARGUMENT_ERROR', intl_get_error_message());
154+
$this->assertSame(\sprintf('%s: Neither "start" nor the "end" arguments can exceed the number of UTF-16 code units (in this case, 3): U_ILLEGAL_ARGUMENT_ERROR', \PHP_VERSION_ID >= 80500 ? 'Transliterator::transliterate()' : 'transliterator_transliterate'), intl_get_error_message());
154155

155156
$this->iniSet('intl.use_exceptions', 1);
156157

157158
$this->expectException(\IntlException::class);
158-
$this->expectExceptionMessage('transliterator_transliterate: Neither "start" nor the "end" arguments can exceed the number of UTF-16 code units (in this case, 3)');
159+
$this->expectExceptionMessage(\sprintf('%s: Neither "start" nor the "end" arguments can exceed the number of UTF-16 code units (in this case, 3)', \PHP_VERSION_ID >= 80500 ? 'Transliterator::transliterate()' : 'transliterator_transliterate'));
159160

160161
$this->assertFalse($tr->transliterate('Abc', 1, 5));
161162
}

0 commit comments

Comments
 (0)