minor #37642 [Lock][Cache] Fix Redis tests (jderusse)
This PR was merged into the 3.4 branch.
Discussion
----------
[Lock][Cache] Fix Redis tests
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | /
| License | MIT
| Doc PR | /
In branch 3.4, travis started a redis-server container and tests run correctly.
Starting from 4.4, the travis test suite don't start the server anymore, which is not an issue for 4.4's tests because tests are skiped.
The issue is when branch 4.4 run the 3.4's test suite to check if component changes in 4.4 does not affect 3.4. in that case, the 3.4 tests suite is run without redise-server.
see https://travis-ci.org/github/symfony/symfony/jobs/711062047 for example
This PR replace the error handler (didn't worked) by catching the exception in a similar way than https://github.com/symfony/symfony/pull/36647
Commits
-------
f524c85161
Fix Redis tests
This commit is contained in:
commit
b4bc6fecb5
@ -33,9 +33,10 @@ abstract class AbstractRedisAdapterTest extends AdapterTestCase
|
|||||||
if (!\extension_loaded('redis')) {
|
if (!\extension_loaded('redis')) {
|
||||||
self::markTestSkipped('Extension redis required.');
|
self::markTestSkipped('Extension redis required.');
|
||||||
}
|
}
|
||||||
if (!@((new \Redis())->connect(getenv('REDIS_HOST')))) {
|
try {
|
||||||
$e = error_get_last();
|
(new \Redis())->connect(getenv('REDIS_HOST'));
|
||||||
self::markTestSkipped($e['message']);
|
} catch (\Exception $e) {
|
||||||
|
self::markTestSkipped($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,9 +33,10 @@ abstract class AbstractRedisCacheTest extends CacheTestCase
|
|||||||
if (!\extension_loaded('redis')) {
|
if (!\extension_loaded('redis')) {
|
||||||
self::markTestSkipped('Extension redis required.');
|
self::markTestSkipped('Extension redis required.');
|
||||||
}
|
}
|
||||||
if (!@((new \Redis())->connect(getenv('REDIS_HOST')))) {
|
try {
|
||||||
$e = error_get_last();
|
(new \Redis())->connect(getenv('REDIS_HOST'));
|
||||||
self::markTestSkipped($e['message']);
|
} catch (\Exception $e) {
|
||||||
|
self::markTestSkipped($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,9 +23,10 @@ class RedisArrayStoreTest extends AbstractRedisStoreTest
|
|||||||
if (!class_exists('RedisArray')) {
|
if (!class_exists('RedisArray')) {
|
||||||
self::markTestSkipped('The RedisArray class is required.');
|
self::markTestSkipped('The RedisArray class is required.');
|
||||||
}
|
}
|
||||||
if (!@((new \Redis())->connect(getenv('REDIS_HOST')))) {
|
try {
|
||||||
$e = error_get_last();
|
(new \Redis())->connect(getenv('REDIS_HOST'));
|
||||||
self::markTestSkipped($e['message']);
|
} catch (\Exception $e) {
|
||||||
|
self::markTestSkipped($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,9 +20,10 @@ class RedisStoreTest extends AbstractRedisStoreTest
|
|||||||
{
|
{
|
||||||
public static function setUpBeforeClass()
|
public static function setUpBeforeClass()
|
||||||
{
|
{
|
||||||
if (!@((new \Redis())->connect(getenv('REDIS_HOST')))) {
|
try {
|
||||||
$e = error_get_last();
|
(new \Redis())->connect(getenv('REDIS_HOST'));
|
||||||
self::markTestSkipped($e['message']);
|
} catch (\Exception $e) {
|
||||||
|
self::markTestSkipped($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user