Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit eced97b

Browse files
committed
minor #18939 [FrameworkBundle] Skip redis cache pools test on failed connection (chalasr)
This PR was squashed before being merged into the 3.1 branch (closes #18939). Discussion ---------- [FrameworkBundle] Skip redis cache pools test on failed connection | Q | A | ------------- | --- | Branch? | 3.1 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Actually, running the FrameworkBundle tests suit leads to a failure that says: > 1) Symfony\Bundle\FrameworkBundle\Tests\Functional\CachePoolsTest::testRedisCachePools Symfony\Component\Cache\Exception\InvalidArgumentException: Redis connection failed: redis://localhost [...] [...]/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php:59 [...]/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php:30 So I propose to catch this specific exception in case of redis is not (locally) supported, in order to be sure that tests stay green. Commits ------- 0d349dd [FrameworkBundle] Skip redis cache pools test on failed connection
2 parents 60b83dc + 0d349dd commit eced97b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
1515
use Symfony\Component\Cache\Adapter\RedisAdapter;
16+
use Symfony\Component\Cache\Exception\InvalidArgumentException;
1617

1718
class CachePoolsTest extends WebTestCase
1819
{
@@ -33,6 +34,11 @@ public function testRedisCachePools()
3334
throw $e;
3435
}
3536
$this->markTestSkipped($e->getMessage());
37+
} catch (InvalidArgumentException $e) {
38+
if (0 !== strpos($e->getMessage(), 'Redis connection failed')) {
39+
throw $e;
40+
}
41+
$this->markTestSkipped($e->getMessage());
3642
}
3743
}
3844

0 commit comments

Comments
 (0)