Avoid failing test for user who didn’t install Redis

This commit is contained in:
Jeremy Benoist 2016-09-24 19:57:59 +02:00
parent 13a522dfbd
commit 0e0102b6fc
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C
5 changed files with 19 additions and 0 deletions

View file

@ -80,4 +80,19 @@ abstract class WallabagCoreTestCase extends WebTestCase
throw new \RuntimeException('No logged in User.');
}
/**
* Check if Redis is installed.
* If not, mark test as skip
*/
protected function checkRedis()
{
try {
$this->client->getContainer()->get('wallabag_core.redis.client')->connect();
} catch (\Exception $e) {
$this->markTestSkipped(
'Redis is not installed/activated'
);
}
}
}

View file

@ -34,6 +34,7 @@ class PocketControllerTest extends WallabagCoreTestCase
public function testImportPocketWithRedisEnabled()
{
$this->checkRedis();
$this->logInAs('admin');
$client = $this->getClient();

View file

@ -54,6 +54,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
public function testImportReadabilityWithRedisEnabled()
{
$this->checkRedis();
$this->logInAs('admin');
$client = $this->getClient();

View file

@ -54,6 +54,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
public function testImportWallabagWithRedisEnabled()
{
$this->checkRedis();
$this->logInAs('admin');
$client = $this->getClient();

View file

@ -54,6 +54,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
public function testImportWallabagWithRedisEnabled()
{
$this->checkRedis();
$this->logInAs('admin');
$client = $this->getClient();