Skip to content

Commit

Permalink
minor #18939 [FrameworkBundle] Skip redis cache pools test on failed …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
fabpot committed Jun 3, 2016
2 parents 60b83dc + 0d349dd commit eced97b
Showing 1 changed file with 6 additions and 0 deletions.
Expand Up @@ -13,6 +13,7 @@

use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\Cache\Adapter\RedisAdapter;
use Symfony\Component\Cache\Exception\InvalidArgumentException;

class CachePoolsTest extends WebTestCase
{
Expand All @@ -33,6 +34,11 @@ public function testRedisCachePools()
throw $e;
}
$this->markTestSkipped($e->getMessage());
} catch (InvalidArgumentException $e) {
if (0 !== strpos($e->getMessage(), 'Redis connection failed')) {
throw $e;
}
$this->markTestSkipped($e->getMessage());
}
}

Expand Down

0 comments on commit eced97b

Please sign in to comment.