diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml index 9448349f0..1225aa530 100644 --- a/src/Wallabag/CoreBundle/Resources/config/services.yml +++ b/src/Wallabag/CoreBundle/Resources/config/services.yml @@ -190,7 +190,7 @@ services: - "@security.token_storage" - "@router" - wallabag_core.redis.client: + Predis\Client: class: Predis\Client arguments: - diff --git a/src/Wallabag/ImportBundle/Controller/ImportController.php b/src/Wallabag/ImportBundle/Controller/ImportController.php index bf6344bb3..e823be519 100644 --- a/src/Wallabag/ImportBundle/Controller/ImportController.php +++ b/src/Wallabag/ImportBundle/Controller/ImportController.php @@ -2,6 +2,7 @@ namespace Wallabag\ImportBundle\Controller; +use Predis\Client; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\Routing\Annotation\Route; use Wallabag\ImportBundle\Import\ImportChain; @@ -51,7 +52,7 @@ class ImportController extends Controller $rabbitNotInstalled = true; } } elseif ($this->get('craue_config')->get('import_with_redis')) { - $redis = $this->get('wallabag_core.redis.client'); + $redis = $this->get(Client::class); try { $nbRedisMessages = $redis->llen('wallabag.import.pocket') diff --git a/src/Wallabag/ImportBundle/Resources/config/redis.yml b/src/Wallabag/ImportBundle/Resources/config/redis.yml index ddfd2d1e7..4673da6e4 100644 --- a/src/Wallabag/ImportBundle/Resources/config/redis.yml +++ b/src/Wallabag/ImportBundle/Resources/config/redis.yml @@ -4,7 +4,7 @@ services: wallabag_import.queue.redis.readability: class: Simpleue\Queue\RedisQueue arguments: - - "@wallabag_core.redis.client" + - '@Predis\Client' - "wallabag.import.readability" wallabag_import.producer.redis.readability: @@ -25,7 +25,7 @@ services: wallabag_import.queue.redis.instapaper: class: Simpleue\Queue\RedisQueue arguments: - - "@wallabag_core.redis.client" + - '@Predis\Client' - "wallabag.import.instapaper" wallabag_import.producer.redis.instapaper: @@ -46,7 +46,7 @@ services: wallabag_import.queue.redis.pinboard: class: Simpleue\Queue\RedisQueue arguments: - - "@wallabag_core.redis.client" + - '@Predis\Client' - "wallabag.import.pinboard" wallabag_import.producer.redis.pinboard: @@ -67,7 +67,7 @@ services: wallabag_import.queue.redis.delicious: class: Simpleue\Queue\RedisQueue arguments: - - "@wallabag_core.redis.client" + - '@Predis\Client' - "wallabag.import.delicious" wallabag_import.producer.redis.delicious: @@ -88,7 +88,7 @@ services: wallabag_import.queue.redis.pocket: class: Simpleue\Queue\RedisQueue arguments: - - "@wallabag_core.redis.client" + - '@Predis\Client' - "wallabag.import.pocket" wallabag_import.producer.redis.pocket: @@ -109,7 +109,7 @@ services: wallabag_import.queue.redis.wallabag_v1: class: Simpleue\Queue\RedisQueue arguments: - - "@wallabag_core.redis.client" + - '@Predis\Client' - "wallabag.import.wallabag_v1" wallabag_import.producer.redis.wallabag_v1: @@ -130,7 +130,7 @@ services: wallabag_import.queue.redis.wallabag_v2: class: Simpleue\Queue\RedisQueue arguments: - - "@wallabag_core.redis.client" + - '@Predis\Client' - "wallabag.import.wallabag_v2" wallabag_import.producer.redis.wallabag_v2: @@ -151,7 +151,7 @@ services: wallabag_import.queue.redis.elcurator: class: Simpleue\Queue\RedisQueue arguments: - - "@wallabag_core.redis.client" + - '@Predis\Client' - "wallabag.import.elcurator" wallabag_import.producer.redis.elcurator: @@ -172,7 +172,7 @@ services: wallabag_import.queue.redis.firefox: class: Simpleue\Queue\RedisQueue arguments: - - "@wallabag_core.redis.client" + - '@Predis\Client' - "wallabag.import.firefox" wallabag_import.producer.redis.firefox: @@ -193,7 +193,7 @@ services: wallabag_import.queue.redis.chrome: class: Simpleue\Queue\RedisQueue arguments: - - "@wallabag_core.redis.client" + - '@Predis\Client' - "wallabag.import.chrome" wallabag_import.producer.redis.chrome: diff --git a/tests/Wallabag/CoreBundle/WallabagCoreTestCase.php b/tests/Wallabag/CoreBundle/WallabagCoreTestCase.php index a4cd83e4a..c30666bab 100644 --- a/tests/Wallabag/CoreBundle/WallabagCoreTestCase.php +++ b/tests/Wallabag/CoreBundle/WallabagCoreTestCase.php @@ -164,7 +164,7 @@ abstract class WallabagCoreTestCase extends WebTestCase protected function checkRedis() { try { - $this->client->getContainer()->get('wallabag_core.redis.client')->connect(); + $this->client->getContainer()->get(\Predis\Client::class)->connect(); } catch (\Exception $e) { $this->markTestSkipped('Redis is not installed/activated'); } diff --git a/tests/Wallabag/ImportBundle/Command/RedisWorkerCommandTest.php b/tests/Wallabag/ImportBundle/Command/RedisWorkerCommandTest.php index 67ab757e2..2d8746194 100644 --- a/tests/Wallabag/ImportBundle/Command/RedisWorkerCommandTest.php +++ b/tests/Wallabag/ImportBundle/Command/RedisWorkerCommandTest.php @@ -3,6 +3,7 @@ namespace Tests\Wallabag\ImportBundle\Command; use M6Web\Component\RedisMock\RedisMockFactory; +use Predis\Client; use Symfony\Bundle\FrameworkBundle\Console\Application; use Symfony\Component\Console\Tester\CommandTester; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; @@ -51,7 +52,7 @@ class RedisWorkerCommandTest extends WallabagCoreTestCase $factory = new RedisMockFactory(); $redisMock = $factory->getAdapter('Predis\Client', true); - $application->getKernel()->getContainer()->set('wallabag_core.redis.client', $redisMock); + $application->getKernel()->getContainer()->set(Client::class, $redisMock); // put a fake message in the queue so the worker will stop after reading that message // instead of waiting for others diff --git a/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php index 50f2a6383..b1c2c3254 100644 --- a/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php @@ -2,6 +2,7 @@ namespace Tests\Wallabag\ImportBundle\Controller; +use Predis\Client; use Symfony\Component\HttpFoundation\File\UploadedFile; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; @@ -82,7 +83,7 @@ class ChromeControllerTest extends WallabagCoreTestCase $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); $this->assertStringContainsString('flashes.import.notice.summary', $body[0]); - $this->assertNotEmpty($client->getContainer()->get('wallabag_core.redis.client')->lpop('wallabag.import.chrome')); + $this->assertNotEmpty($client->getContainer()->get(Client::class)->lpop('wallabag.import.chrome')); $client->getContainer()->get('craue_config')->set('import_with_redis', 0); } diff --git a/tests/Wallabag/ImportBundle/Controller/DeliciousControllerTest.php b/tests/Wallabag/ImportBundle/Controller/DeliciousControllerTest.php index 1d14d1d8a..54ca9199f 100644 --- a/tests/Wallabag/ImportBundle/Controller/DeliciousControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/DeliciousControllerTest.php @@ -2,6 +2,7 @@ namespace Tests\Wallabag\ImportBundle\Controller; +use Predis\Client; use Symfony\Component\HttpFoundation\File\UploadedFile; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; @@ -82,7 +83,7 @@ class DeliciousControllerTest extends WallabagCoreTestCase $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); $this->assertStringContainsString('flashes.import.notice.summary', $body[0]); - $this->assertNotEmpty($client->getContainer()->get('wallabag_core.redis.client')->lpop('wallabag.import.delicious')); + $this->assertNotEmpty($client->getContainer()->get(Client::class)->lpop('wallabag.import.delicious')); $client->getContainer()->get('craue_config')->set('import_with_redis', 0); } diff --git a/tests/Wallabag/ImportBundle/Controller/ElcuratorControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ElcuratorControllerTest.php index a3dfe1750..ed702a245 100644 --- a/tests/Wallabag/ImportBundle/Controller/ElcuratorControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/ElcuratorControllerTest.php @@ -2,6 +2,7 @@ namespace Tests\Wallabag\ImportBundle\Controller; +use Predis\Client; use Symfony\Component\HttpFoundation\File\UploadedFile; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; @@ -83,7 +84,7 @@ class ElcuratorControllerTest extends WallabagCoreTestCase $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); $this->assertStringContainsString('flashes.import.notice.summary', $body[0]); - $this->assertNotEmpty($client->getContainer()->get('wallabag_core.redis.client')->lpop('wallabag.import.elcurator')); + $this->assertNotEmpty($client->getContainer()->get(Client::class)->lpop('wallabag.import.elcurator')); $client->getContainer()->get('craue_config')->set('import_with_redis', 0); } diff --git a/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php b/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php index 353618103..c3c9bf964 100644 --- a/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php @@ -2,6 +2,7 @@ namespace Tests\Wallabag\ImportBundle\Controller; +use Predis\Client; use Symfony\Component\HttpFoundation\File\UploadedFile; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; @@ -82,7 +83,7 @@ class FirefoxControllerTest extends WallabagCoreTestCase $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); $this->assertStringContainsString('flashes.import.notice.summary', $body[0]); - $this->assertNotEmpty($client->getContainer()->get('wallabag_core.redis.client')->lpop('wallabag.import.firefox')); + $this->assertNotEmpty($client->getContainer()->get(Client::class)->lpop('wallabag.import.firefox')); $client->getContainer()->get('craue_config')->set('import_with_redis', 0); } diff --git a/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php b/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php index 94aa3c664..f7739bc85 100644 --- a/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php @@ -2,6 +2,7 @@ namespace Tests\Wallabag\ImportBundle\Controller; +use Predis\Client; use Symfony\Component\HttpFoundation\File\UploadedFile; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; @@ -82,7 +83,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); $this->assertStringContainsString('flashes.import.notice.summary', $body[0]); - $this->assertNotEmpty($client->getContainer()->get('wallabag_core.redis.client')->lpop('wallabag.import.instapaper')); + $this->assertNotEmpty($client->getContainer()->get(Client::class)->lpop('wallabag.import.instapaper')); $client->getContainer()->get('craue_config')->set('import_with_redis', 0); } diff --git a/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php b/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php index 076dd7f97..ca2289d50 100644 --- a/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php @@ -2,6 +2,7 @@ namespace Tests\Wallabag\ImportBundle\Controller; +use Predis\Client; use Symfony\Component\HttpFoundation\File\UploadedFile; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; @@ -82,7 +83,7 @@ class PinboardControllerTest extends WallabagCoreTestCase $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); $this->assertStringContainsString('flashes.import.notice.summary', $body[0]); - $this->assertNotEmpty($client->getContainer()->get('wallabag_core.redis.client')->lpop('wallabag.import.pinboard')); + $this->assertNotEmpty($client->getContainer()->get(Client::class)->lpop('wallabag.import.pinboard')); $client->getContainer()->get('craue_config')->set('import_with_redis', 0); } diff --git a/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php index 8cd358e73..8c4689490 100644 --- a/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php @@ -2,6 +2,7 @@ namespace Tests\Wallabag\ImportBundle\Controller; +use Predis\Client; use Symfony\Component\HttpFoundation\File\UploadedFile; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; @@ -82,7 +83,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); $this->assertStringContainsString('flashes.import.notice.summary', $body[0]); - $this->assertNotEmpty($client->getContainer()->get('wallabag_core.redis.client')->lpop('wallabag.import.readability')); + $this->assertNotEmpty($client->getContainer()->get(Client::class)->lpop('wallabag.import.readability')); $client->getContainer()->get('craue_config')->set('import_with_redis', 0); } diff --git a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php index 373c5cdd1..eee358a18 100644 --- a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php @@ -2,6 +2,7 @@ namespace Tests\Wallabag\ImportBundle\Controller; +use Predis\Client; use Symfony\Component\HttpFoundation\File\UploadedFile; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; @@ -83,7 +84,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); $this->assertStringContainsString('flashes.import.notice.summary', $body[0]); - $this->assertNotEmpty($client->getContainer()->get('wallabag_core.redis.client')->lpop('wallabag.import.wallabag_v1')); + $this->assertNotEmpty($client->getContainer()->get(Client::class)->lpop('wallabag.import.wallabag_v1')); $client->getContainer()->get('craue_config')->set('import_with_redis', 0); } diff --git a/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php b/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php index 220415215..b36879732 100644 --- a/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php @@ -2,6 +2,7 @@ namespace Tests\Wallabag\ImportBundle\Controller; +use Predis\Client; use Symfony\Component\HttpFoundation\File\UploadedFile; use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; @@ -83,7 +84,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); $this->assertStringContainsString('flashes.import.notice.summary', $body[0]); - $this->assertNotEmpty($client->getContainer()->get('wallabag_core.redis.client')->lpop('wallabag.import.wallabag_v2')); + $this->assertNotEmpty($client->getContainer()->get(Client::class)->lpop('wallabag.import.wallabag_v2')); $client->getContainer()->get('craue_config')->set('import_with_redis', 0); }