]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Avoid failing test for user who didn’t install Redis 2306/head
authorJeremy Benoist <jeremy.benoist@gmail.com>
Sat, 24 Sep 2016 17:57:59 +0000 (19:57 +0200)
committerJeremy Benoist <jeremy.benoist@gmail.com>
Sat, 24 Sep 2016 17:57:59 +0000 (19:57 +0200)
tests/Wallabag/CoreBundle/WallabagCoreTestCase.php
tests/Wallabag/ImportBundle/Controller/PocketControllerTest.php
tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php
tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php
tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php

index c0055888a255eaa44aa88d52f5630ff50e5c6147..75b7ee0bd4a110437cdd226455eea0dda7634304 100644 (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'
+            );
+        }
+    }
 }
index 356732610a17d77f8e08d155c4e980f9572fd5d6..7d6a300fb3fbdce2f7091a41f19e0e3fb4d04592 100644 (file)
@@ -34,6 +34,7 @@ class PocketControllerTest extends WallabagCoreTestCase
 
     public function testImportPocketWithRedisEnabled()
     {
+        $this->checkRedis();
         $this->logInAs('admin');
         $client = $this->getClient();
 
index 7b88d8917bd8d9ffb6c34a0e441002bf68ed117a..87ecb9d33cfa929620650f78582db2baf95df7bb 100644 (file)
@@ -54,6 +54,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
 
     public function testImportReadabilityWithRedisEnabled()
     {
+        $this->checkRedis();
         $this->logInAs('admin');
         $client = $this->getClient();
 
index 98e85d4539c75b2662a57e3aec8dabcb3db6c6a9..3497c4b825407cfaf1fffaca8b8a0520f0e2db7c 100644 (file)
@@ -54,6 +54,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
 
     public function testImportWallabagWithRedisEnabled()
     {
+        $this->checkRedis();
         $this->logInAs('admin');
         $client = $this->getClient();
 
index 74d61f9a255f49d3521ffd8a56dc7a4b4779d060..27d2d52b83f6c00073cde918ecbde62a7dd2420d 100644 (file)
@@ -54,6 +54,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
 
     public function testImportWallabagWithRedisEnabled()
     {
+        $this->checkRedis();
         $this->logInAs('admin');
         $client = $this->getClient();