From 318fb2e72b4a8699dbc6266347f78a195a65ec94 Mon Sep 17 00:00:00 2001 From: Vlad Date: Sat, 4 Nov 2017 00:37:11 +0200 Subject: [PATCH] Add name to service in handler stack --- src/GuzzleBundleCachePlugin.php | 2 +- tests/GuzzleBundleCachePluginTest.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/GuzzleBundleCachePlugin.php b/src/GuzzleBundleCachePlugin.php index 843d075..348631f 100644 --- a/src/GuzzleBundleCachePlugin.php +++ b/src/GuzzleBundleCachePlugin.php @@ -44,7 +44,7 @@ public function loadForClient(array $config, ContainerBuilder $container, string $cacheMiddlewareExpression = new Expression(sprintf('service("%s")', $cacheMiddlewareDefinitionName)); - $handler->addMethodCall('push', [$cacheMiddlewareExpression]); + $handler->addMethodCall('push', [$cacheMiddlewareExpression, 'cache']); } } diff --git a/tests/GuzzleBundleCachePluginTest.php b/tests/GuzzleBundleCachePluginTest.php index 66a2608..09f1c3e 100644 --- a/tests/GuzzleBundleCachePluginTest.php +++ b/tests/GuzzleBundleCachePluginTest.php @@ -76,6 +76,8 @@ public function testLoadForClientWithNoStrategy() $this->assertTrue($container->hasDefinition('guzzle_bundle_cache_plugin.middleware.api_payment')); $this->assertCount(1, $handler->getMethodCalls()); + $this->assertTrue(isset($handler->getMethodCalls()[0][1][1]), 'No name provided for middleware'); + $this->assertEquals('cache', $handler->getMethodCalls()[0][1][1]); $clientMiddlewareDefinition = $container->getDefinition('guzzle_bundle_cache_plugin.middleware.api_payment'); $this->assertCount(0, $clientMiddlewareDefinition->getArguments());