Skip to content

Commit b4e3bca

Browse files
committed
minor symfony#61303 [Translation] account for error message changes in PHP 8.5 (xabbuh)
This PR was merged into the 7.3 branch. Discussion ---------- [Translation] account for error message changes in PHP 8.5 | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | | License | MIT related to php/php-src#19196, following symfony#61300 Commits ------- 4cbcf78 account for error message changes in PHP 8.5
2 parents 511e764 + 4cbcf78 commit b4e3bca

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

src/Symfony/Component/Translation/Tests/Command/TranslationLintCommandTest.php

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,33 @@ public function testLintMalformedIcuTranslations()
108108
fr messages No
109109
-------- ---------- --------
110110
EOF, $display);
111-
$this->assertStringContainsString(<<<EOF
111+
$this->assertStringContainsString(\sprintf(<<<EOF
112112
Errors for locale "en" and domain "messages"
113113
--------------------------------------------
114114
115115
Translation key "num_of_apples" is invalid:
116116
117-
[ERROR] Invalid message format (error #65807): msgfmt_create: message formatter creation failed:
117+
[ERROR] Invalid message format (error #65807): %s: message formatter creation failed:
118+
U_DEFAULT_KEYWORD_MISSING
119+
EOF, \PHP_VERSION_ID >= 80500 ? 'MessageFormatter::__construct()' : 'msgfmt_create'), $display);
120+
121+
if (\PHP_VERSION_ID >= 80500) {
122+
$this->assertStringContainsString(<<<EOF
123+
Errors for locale "fr" and domain "messages"
124+
--------------------------------------------
125+
126+
Translation key "hello_name" is invalid:
127+
128+
[ERROR] Invalid message format (error #65799): MessageFormatter::__construct(): pattern syntax error (parse error at
129+
offset 9, after "Bonjour {", before or at "name !"): U_PATTERN_SYNTAX_ERROR
130+
131+
Translation key "num_of_apples" is invalid:
132+
133+
[ERROR] Invalid message format (error #65807): MessageFormatter::__construct(): message formatter creation failed:
118134
U_DEFAULT_KEYWORD_MISSING
119135
EOF, $display);
120-
$this->assertStringContainsString(<<<EOF
136+
} else {
137+
$this->assertStringContainsString(<<<EOF
121138
Errors for locale "fr" and domain "messages"
122139
--------------------------------------------
123140
@@ -131,6 +148,7 @@ public function testLintMalformedIcuTranslations()
131148
[ERROR] Invalid message format (error #65807): msgfmt_create: message formatter creation failed:
132149
U_DEFAULT_KEYWORD_MISSING
133150
EOF, $display);
151+
}
134152
}
135153

136154
private function createCommand(Translator $translator, array $enabledLocales): Command

0 commit comments

Comments
 (0)