aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2016-09-25 11:36:59 +0200
committerGitHub <noreply@github.com>2016-09-25 11:36:59 +0200
commit9d7dd6b0d2480d3efff5b0ab1461f2ef99bfd57a (patch)
tree18dfb21ca8e417343d844eb5f5f09fd6b9a11130
parent637aa17e6b52dd8021854a809053560a27caca72 (diff)
parent0e0102b6fcd17266f39dd63a808740d01ab9bd8a (diff)
downloadwallabag-9d7dd6b0d2480d3efff5b0ab1461f2ef99bfd57a.tar.gz
wallabag-9d7dd6b0d2480d3efff5b0ab1461f2ef99bfd57a.tar.zst
wallabag-9d7dd6b0d2480d3efff5b0ab1461f2ef99bfd57a.zip
Merge pull request #2306 from wallabag/redis-rabbit-check
Some checks about Redis & RabbitMQ
-rw-r--r--phpunit.xml.dist1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.da.yml3
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.de.yml3
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.en.yml3
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.es.yml3
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml3
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml3
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.it.yml3
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml3
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml3
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml3
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml3
-rw-r--r--src/Wallabag/ImportBundle/Controller/ImportController.php36
-rw-r--r--src/Wallabag/ImportBundle/Resources/views/Import/check_queue.html.twig16
-rw-r--r--tests/Wallabag/CoreBundle/WallabagCoreTestCase.php15
-rw-r--r--tests/Wallabag/ImportBundle/Controller/PocketControllerTest.php1
-rw-r--r--tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php1
-rw-r--r--tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php1
-rw-r--r--tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php1
19 files changed, 89 insertions, 16 deletions
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 38880908..3216b6ff 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -16,6 +16,7 @@
16 <php> 16 <php>
17 <ini name="error_reporting" value="-1" /> 17 <ini name="error_reporting" value="-1" />
18 <server name="KERNEL_DIR" value="app/" /> 18 <server name="KERNEL_DIR" value="app/" />
19 <env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
19 </php> 20 </php>
20 21
21 <filter> 22 <filter>
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
index 9f051edb..c6fcb355 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
@@ -432,6 +432,9 @@ flashes:
432 # failed_on_file: 'Error while processing import. Please verify your import file.' 432 # failed_on_file: 'Error while processing import. Please verify your import file.'
433 # summary: 'Import summary: %imported% imported, %skipped% already saved.' 433 # summary: 'Import summary: %imported% imported, %skipped% already saved.'
434 # summary_with_queue: 'Import summary: %queued% queued.' 434 # summary_with_queue: 'Import summary: %queued% queued.'
435 error:
436 # redis_enabled_not_installed: Redis is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check Redis configuration.
437 # rabbit_enabled_not_installed: RabbitMQ is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check RabbitMQ configuration.
435 developer: 438 developer:
436 notice: 439 notice:
437 # client_created: 'New client created.' 440 # client_created: 'New client created.'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
index cbfacd55..c0e82b59 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
@@ -432,6 +432,9 @@ flashes:
432 failed_on_file: 'Fehler während des Imports. Bitte überprüfe deine Import-Datei.' 432 failed_on_file: 'Fehler während des Imports. Bitte überprüfe deine Import-Datei.'
433 summary: 'Import-Zusammenfassung: %imported% importiert, %skipped% bereits gespeichert.' 433 summary: 'Import-Zusammenfassung: %imported% importiert, %skipped% bereits gespeichert.'
434 # summary_with_queue: 'Import summary: %queued% queued.' 434 # summary_with_queue: 'Import summary: %queued% queued.'
435 error:
436 # redis_enabled_not_installed: Redis is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check Redis configuration.
437 # rabbit_enabled_not_installed: RabbitMQ is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check RabbitMQ configuration.
435 developer: 438 developer:
436 notice: 439 notice:
437 client_created: 'Neuer Client erstellt.' 440 client_created: 'Neuer Client erstellt.'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
index 21e2405c..6f262209 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
@@ -434,6 +434,9 @@ flashes:
434 failed_on_file: 'Error while processing import. Please verify your import file.' 434 failed_on_file: 'Error while processing import. Please verify your import file.'
435 summary: 'Import summary: %imported% imported, %skipped% already saved.' 435 summary: 'Import summary: %imported% imported, %skipped% already saved.'
436 summary_with_queue: 'Import summary: %queued% queued.' 436 summary_with_queue: 'Import summary: %queued% queued.'
437 error:
438 redis_enabled_not_installed: Redis is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check Redis configuration.
439 rabbit_enabled_not_installed: RabbitMQ is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check RabbitMQ configuration.
437 developer: 440 developer:
438 notice: 441 notice:
439 client_created: 'New client %name% created.' 442 client_created: 'New client %name% created.'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
index 43f376d4..7b981069 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
@@ -432,6 +432,9 @@ flashes:
432 failed_on_file: 'Se ocurre un error por procesar importación. Por favor verifique su archivo importado.' 432 failed_on_file: 'Se ocurre un error por procesar importación. Por favor verifique su archivo importado.'
433 summary: 'Resúmen importado: %importado% importado, %saltados% ya guardado.' 433 summary: 'Resúmen importado: %importado% importado, %saltados% ya guardado.'
434 # summary_with_queue: 'Import summary: %queued% queued.' 434 # summary_with_queue: 'Import summary: %queued% queued.'
435 error:
436 # redis_enabled_not_installed: Redis is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check Redis configuration.
437 # rabbit_enabled_not_installed: RabbitMQ is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check RabbitMQ configuration.
435 developer: 438 developer:
436 notice: 439 notice:
437 client_created: 'Nuevo cliente creado.' 440 client_created: 'Nuevo cliente creado.'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
index 56418ef9..99fcc378 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
@@ -432,6 +432,9 @@ flashes:
432 failed_on_file: 'خطا هنگام پردازش پروندهٔ ورودی. آیا پروندهٔ درون‌ریزی شده سالم است؟' 432 failed_on_file: 'خطا هنگام پردازش پروندهٔ ورودی. آیا پروندهٔ درون‌ریزی شده سالم است؟'
433 summary: 'گزارش درون‌ریزی: %imported% وارد شد, %skipped% از قبل ذخیره شده بود.' 433 summary: 'گزارش درون‌ریزی: %imported% وارد شد, %skipped% از قبل ذخیره شده بود.'
434 # summary_with_queue: 'Import summary: %queued% queued.' 434 # summary_with_queue: 'Import summary: %queued% queued.'
435 error:
436 # redis_enabled_not_installed: Redis is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check Redis configuration.
437 # rabbit_enabled_not_installed: RabbitMQ is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check RabbitMQ configuration.
435 developer: 438 developer:
436 notice: 439 notice:
437 # client_created: 'New client created.' 440 # client_created: 'New client created.'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
index bde21866..dd82e7f5 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
@@ -434,6 +434,9 @@ flashes:
434 failed_on_file: "Erreur lors du traitement de l'import. Vérifier votre fichier." 434 failed_on_file: "Erreur lors du traitement de l'import. Vérifier votre fichier."
435 summary: "Rapport d'import: %imported% importés, %skipped% déjà présent." 435 summary: "Rapport d'import: %imported% importés, %skipped% déjà présent."
436 summary_with_queue: "Rapport d'import: %queued% en cours de traitement." 436 summary_with_queue: "Rapport d'import: %queued% en cours de traitement."
437 error:
438 redis_enabled_not_installed: Redis est activé pour les imports asynchrones mais <u>impossible de s'y connecter</u>. Vérifier la configuration de Redis.
439 rabbit_enabled_not_installed: RabbitMQ est activé pour les imports asynchrones mais <u>impossible de s'y connecter</u>. Vérifier la configuration de RabbitMQ.
437 developer: 440 developer:
438 notice: 441 notice:
439 client_created: 'Nouveau client %name% créé' 442 client_created: 'Nouveau client %name% créé'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
index 26bb31ba..d3ce30c9 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
@@ -431,6 +431,9 @@ flashes:
431 failed_on_file: 'Errore durante la processazione dei dati da importare. Verifica il tuo file di import.' 431 failed_on_file: 'Errore durante la processazione dei dati da importare. Verifica il tuo file di import.'
432 summary: 'Sommario di importazione: %imported% importati, %skipped% già salvati.' 432 summary: 'Sommario di importazione: %imported% importati, %skipped% già salvati.'
433 # summary_with_queue: 'Import summary: %queued% queued.' 433 # summary_with_queue: 'Import summary: %queued% queued.'
434 error:
435 # redis_enabled_not_installed: Redis is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check Redis configuration.
436 # rabbit_enabled_not_installed: RabbitMQ is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check RabbitMQ configuration.
434 developer: 437 developer:
435 notice: 438 notice:
436 client_created: 'Nuovo client creato.' 439 client_created: 'Nuovo client creato.'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
index c6818449..d040daea 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
@@ -432,6 +432,9 @@ flashes:
432 failed_on_file: "Errorr pendent du tractament de l'import. Mercés de verificar vòstre fichièr." 432 failed_on_file: "Errorr pendent du tractament de l'import. Mercés de verificar vòstre fichièr."
433 summary: "Rapòrt d'import: %imported% importats, %skipped% ja presents." 433 summary: "Rapòrt d'import: %imported% importats, %skipped% ja presents."
434 # summary_with_queue: 'Import summary: %queued% queued.' 434 # summary_with_queue: 'Import summary: %queued% queued.'
435 error:
436 # redis_enabled_not_installed: Redis is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check Redis configuration.
437 # rabbit_enabled_not_installed: RabbitMQ is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check RabbitMQ configuration.
435 developer: 438 developer:
436 notice: 439 notice:
437 client_created: 'Novèl client creat' 440 client_created: 'Novèl client creat'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
index 84f68138..a51ed1f2 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
@@ -432,6 +432,9 @@ flashes:
432 failed_on_file: 'Błąd podczas ptrzetwarzania pliku. Sprawdż swój importowany plik.' 432 failed_on_file: 'Błąd podczas ptrzetwarzania pliku. Sprawdż swój importowany plik.'
433 summary: 'Podsumowanie importu: %imported% zaimportowane, %skipped% już zapisane.' 433 summary: 'Podsumowanie importu: %imported% zaimportowane, %skipped% już zapisane.'
434 summary_with_queue: 'Podsumowanie importu: %queued% zakolejkowane.' 434 summary_with_queue: 'Podsumowanie importu: %queued% zakolejkowane.'
435 error:
436 # redis_enabled_not_installed: Redis is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check Redis configuration.
437 # rabbit_enabled_not_installed: RabbitMQ is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check RabbitMQ configuration.
435 developer: 438 developer:
436 notice: 439 notice:
437 client_created: 'Nowy klient utworzony.' 440 client_created: 'Nowy klient utworzony.'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
index 3d22e29d..de21f0b3 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
@@ -432,6 +432,9 @@ flashes:
432 # failed_on_file: 'Error while processing import. Please verify your import file.' 432 # failed_on_file: 'Error while processing import. Please verify your import file.'
433 # summary: 'Import summary: %imported% imported, %skipped% already saved.' 433 # summary: 'Import summary: %imported% imported, %skipped% already saved.'
434 # summary_with_queue: 'Import summary: %queued% queued.' 434 # summary_with_queue: 'Import summary: %queued% queued.'
435 error:
436 # redis_enabled_not_installed: Redis is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check Redis configuration.
437 # rabbit_enabled_not_installed: RabbitMQ is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check RabbitMQ configuration.
435 developer: 438 developer:
436 notice: 439 notice:
437 # client_created: 'New client created.' 440 # client_created: 'New client created.'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
index 5099b002..d4b7a7a2 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
@@ -432,6 +432,9 @@ flashes:
432 # failed_on_file: 'Error while processing import. Please verify your import file.' 432 # failed_on_file: 'Error while processing import. Please verify your import file.'
433 # summary: 'Import summary: %imported% imported, %skipped% already saved.' 433 # summary: 'Import summary: %imported% imported, %skipped% already saved.'
434 # summary_with_queue: 'Import summary: %queued% queued.' 434 # summary_with_queue: 'Import summary: %queued% queued.'
435 error:
436 # redis_enabled_not_installed: Redis is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check Redis configuration.
437 # rabbit_enabled_not_installed: RabbitMQ is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check RabbitMQ configuration.
435 developer: 438 developer:
436 notice: 439 notice:
437 # client_created: 'New client created.' 440 # client_created: 'New client created.'
diff --git a/src/Wallabag/ImportBundle/Controller/ImportController.php b/src/Wallabag/ImportBundle/Controller/ImportController.php
index ea4f7d7b..36a2a399 100644
--- a/src/Wallabag/ImportBundle/Controller/ImportController.php
+++ b/src/Wallabag/ImportBundle/Controller/ImportController.php
@@ -25,33 +25,41 @@ class ImportController extends Controller
25 { 25 {
26 $nbRedisMessages = null; 26 $nbRedisMessages = null;
27 $nbRabbitMessages = null; 27 $nbRabbitMessages = null;
28 $redisNotInstalled = false;
29 $rabbitNotInstalled = false;
28 30
29 if (!$this->get('security.authorization_checker')->isGranted('ROLE_SUPER_ADMIN')) { 31 if (!$this->get('security.authorization_checker')->isGranted('ROLE_SUPER_ADMIN')) {
30 return $this->render('WallabagImportBundle:Import:check_queue.html.twig', [ 32 return $this->render('WallabagImportBundle:Import:check_queue.html.twig');
31 'nbRedisMessages' => $nbRedisMessages,
32 'nbRabbitMessages' => $nbRabbitMessages,
33 ]);
34 } 33 }
35 34
36 if ($this->get('craue_config')->get('import_with_rabbitmq')) { 35 if ($this->get('craue_config')->get('import_with_rabbitmq')) {
37 $nbRabbitMessages = $this->getTotalMessageInRabbitQueue('pocket') 36 // in case rabbit is activated but not installed
38 + $this->getTotalMessageInRabbitQueue('readability') 37 try {
39 + $this->getTotalMessageInRabbitQueue('wallabag_v1') 38 $nbRabbitMessages = $this->getTotalMessageInRabbitQueue('pocket')
40 + $this->getTotalMessageInRabbitQueue('wallabag_v2') 39 + $this->getTotalMessageInRabbitQueue('readability')
41 ; 40 + $this->getTotalMessageInRabbitQueue('wallabag_v1')
41 + $this->getTotalMessageInRabbitQueue('wallabag_v2');
42 } catch (\Exception $e) {
43 $rabbitNotInstalled = true;
44 }
42 } elseif ($this->get('craue_config')->get('import_with_redis')) { 45 } elseif ($this->get('craue_config')->get('import_with_redis')) {
43 $redis = $this->get('wallabag_core.redis.client'); 46 $redis = $this->get('wallabag_core.redis.client');
44 47
45 $nbRedisMessages = $redis->llen('wallabag.import.pocket') 48 try {
46 + $redis->llen('wallabag.import.readability') 49 $nbRedisMessages = $redis->llen('wallabag.import.pocket')
47 + $redis->llen('wallabag.import.wallabag_v1') 50 + $redis->llen('wallabag.import.readability')
48 + $redis->llen('wallabag.import.wallabag_v2') 51 + $redis->llen('wallabag.import.wallabag_v1')
49 ; 52 + $redis->llen('wallabag.import.wallabag_v2');
53 } catch (\Exception $e) {
54 $redisNotInstalled = true;
55 }
50 } 56 }
51 57
52 return $this->render('WallabagImportBundle:Import:check_queue.html.twig', [ 58 return $this->render('WallabagImportBundle:Import:check_queue.html.twig', [
53 'nbRedisMessages' => $nbRedisMessages, 59 'nbRedisMessages' => $nbRedisMessages,
54 'nbRabbitMessages' => $nbRabbitMessages, 60 'nbRabbitMessages' => $nbRabbitMessages,
61 'redisNotInstalled' => $redisNotInstalled,
62 'rabbitNotInstalled' => $rabbitNotInstalled,
55 ]); 63 ]);
56 } 64 }
57 65
diff --git a/src/Wallabag/ImportBundle/Resources/views/Import/check_queue.html.twig b/src/Wallabag/ImportBundle/Resources/views/Import/check_queue.html.twig
index 7168ea35..a2633698 100644
--- a/src/Wallabag/ImportBundle/Resources/views/Import/check_queue.html.twig
+++ b/src/Wallabag/ImportBundle/Resources/views/Import/check_queue.html.twig
@@ -1,11 +1,23 @@
1{% if nbRedisMessages > 0 %} 1{% if nbRedisMessages is defined and nbRedisMessages > 0 %}
2 <script> 2 <script>
3 Materialize.toast('Messages in queue: {{ nbRedisMessages }}', 4000); 3 Materialize.toast('Messages in queue: {{ nbRedisMessages }}', 4000);
4 </script> 4 </script>
5{% endif %} 5{% endif %}
6 6
7{% if nbRabbitMessages > 0 %} 7{% if nbRabbitMessages is defined and nbRabbitMessages > 0 %}
8 <script> 8 <script>
9 Materialize.toast('Messages in queue: {{ nbRabbitMessages }}', 4000); 9 Materialize.toast('Messages in queue: {{ nbRabbitMessages }}', 4000);
10 </script> 10 </script>
11{% endif %} 11{% endif %}
12
13{% if redisNotInstalled is defined and redisNotInstalled %}
14 <div class="card-panel red darken-1 white-text">
15 {{ 'flashes.import.error.redis_enabled_not_installed'|trans|raw }}
16 </div>
17{% endif %}
18
19{% if rabbitNotInstalled is defined and rabbitNotInstalled %}
20 <div class="card-panel red darken-1 white-text">
21 {{ 'flashes.import.error.rabbit_enabled_not_installed'|trans|raw }}
22 </div>
23{% endif %}
diff --git a/tests/Wallabag/CoreBundle/WallabagCoreTestCase.php b/tests/Wallabag/CoreBundle/WallabagCoreTestCase.php
index c0055888..75b7ee0b 100644
--- a/tests/Wallabag/CoreBundle/WallabagCoreTestCase.php
+++ b/tests/Wallabag/CoreBundle/WallabagCoreTestCase.php
@@ -80,4 +80,19 @@ abstract class WallabagCoreTestCase extends WebTestCase
80 80
81 throw new \RuntimeException('No logged in User.'); 81 throw new \RuntimeException('No logged in User.');
82 } 82 }
83
84 /**
85 * Check if Redis is installed.
86 * If not, mark test as skip
87 */
88 protected function checkRedis()
89 {
90 try {
91 $this->client->getContainer()->get('wallabag_core.redis.client')->connect();
92 } catch (\Exception $e) {
93 $this->markTestSkipped(
94 'Redis is not installed/activated'
95 );
96 }
97 }
83} 98}
diff --git a/tests/Wallabag/ImportBundle/Controller/PocketControllerTest.php b/tests/Wallabag/ImportBundle/Controller/PocketControllerTest.php
index 35673261..7d6a300f 100644
--- a/tests/Wallabag/ImportBundle/Controller/PocketControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/PocketControllerTest.php
@@ -34,6 +34,7 @@ class PocketControllerTest extends WallabagCoreTestCase
34 34
35 public function testImportPocketWithRedisEnabled() 35 public function testImportPocketWithRedisEnabled()
36 { 36 {
37 $this->checkRedis();
37 $this->logInAs('admin'); 38 $this->logInAs('admin');
38 $client = $this->getClient(); 39 $client = $this->getClient();
39 40
diff --git a/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php
index 7b88d891..87ecb9d3 100644
--- a/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php
@@ -54,6 +54,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
54 54
55 public function testImportReadabilityWithRedisEnabled() 55 public function testImportReadabilityWithRedisEnabled()
56 { 56 {
57 $this->checkRedis();
57 $this->logInAs('admin'); 58 $this->logInAs('admin');
58 $client = $this->getClient(); 59 $client = $this->getClient();
59 60
diff --git a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php
index 98e85d45..3497c4b8 100644
--- a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php
@@ -54,6 +54,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
54 54
55 public function testImportWallabagWithRedisEnabled() 55 public function testImportWallabagWithRedisEnabled()
56 { 56 {
57 $this->checkRedis();
57 $this->logInAs('admin'); 58 $this->logInAs('admin');
58 $client = $this->getClient(); 59 $client = $this->getClient();
59 60
diff --git a/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php b/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php
index 74d61f9a..27d2d52b 100644
--- a/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php
@@ -54,6 +54,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
54 54
55 public function testImportWallabagWithRedisEnabled() 55 public function testImportWallabagWithRedisEnabled()
56 { 56 {
57 $this->checkRedis();
57 $this->logInAs('admin'); 58 $this->logInAs('admin');
58 $client = $this->getClient(); 59 $client = $this->getClient();
59 60