Skip to content

[Translation] skip tests if required class does not exist #38004

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ protected function deleteTmpDir()
*/
public function testThatACacheIsUsed($debug)
{
if (!class_exists(\MessageFormatter::class)) {
$this->markTestSkipped(sprintf('Skipping test as the required "%s" class does not exist. Consider installing the "intl" PHP extension or the "symfony/polyfill-intl-messageformatter" package.', \MessageFormatter::class));
}

$locale = 'any_locale';
$format = 'some_format';
$msgid = 'test';
Expand Down
4 changes: 4 additions & 0 deletions src/Symfony/Component/Translation/Tests/TranslatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,10 @@ public function testTrans($expected, $id, $translation, $parameters, $locale, $d
*/
public function testTransICU(...$args)
{
if (!class_exists(\MessageFormatter::class)) {
$this->markTestSkipped(sprintf('Skipping test as the required "%s" class does not exist. Consider installing the "intl" PHP extension or the "symfony/polyfill-intl-messageformatter" package.', \MessageFormatter::class));
}

$this->testTrans(...$args);
}

Expand Down