Skip to content

Commit c649bfa

Browse files
committed
minor #38004 [Translation] skip tests if required class does not exist (xabbuh)
This PR was merged into the 5.2-dev branch. Discussion ---------- [Translation] skip tests if required class does not exist | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | Commits ------- 427fffa skip tests if required class does not exist
2 parents 69f8eae + 427fffa commit c649bfa

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ protected function deleteTmpDir()
5959
*/
6060
public function testThatACacheIsUsed($debug)
6161
{
62+
if (!class_exists(\MessageFormatter::class)) {
63+
$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));
64+
}
65+
6266
$locale = 'any_locale';
6367
$format = 'some_format';
6468
$msgid = 'test';

src/Symfony/Component/Translation/Tests/TranslatorTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,10 @@ public function testTrans($expected, $id, $translation, $parameters, $locale, $d
373373
*/
374374
public function testTransICU(...$args)
375375
{
376+
if (!class_exists(\MessageFormatter::class)) {
377+
$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));
378+
}
379+
376380
$this->testTrans(...$args);
377381
}
378382

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy