Skip to content

Commit 3b58647

Browse files
authored
Merge pull request #3 from gregurco/add_service_name
Add name to service in handler stack
2 parents 326fba5 + ecd05e4 commit 3b58647

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/GuzzleBundleWssePlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function loadForClient(array $config, ContainerBuilder $container, string
4141

4242
$wsseExpression = new Expression(sprintf('service("%s").attach()', $wsseServiceName));
4343

44-
$handler->addMethodCall('push', [$wsseExpression]);
44+
$handler->addMethodCall('push', [$wsseExpression, 'wsse']);
4545
}
4646
}
4747

tests/GuzzleBundleWssePluginTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
99
use Symfony\Component\DependencyInjection\ContainerBuilder;
1010
use Symfony\Component\DependencyInjection\Definition;
11+
use Symfony\Component\ExpressionLanguage\Expression;
1112
use Symfony\Component\HttpKernel\Bundle\Bundle;
1213
use PHPUnit\Framework\TestCase;
1314

@@ -75,6 +76,11 @@ public function testLoadForClient()
7576

7677
$this->assertTrue($container->hasDefinition('guzzle_bundle_wsse_plugin.middleware.wsse.api_payment'));
7778
$this->assertCount(1, $handler->getMethodCalls());
79+
$this->assertCount(2, $handler->getMethodCalls()[0]);
80+
$this->assertEquals('push', $handler->getMethodCalls()[0][0]);
81+
$this->assertCount(2, $handler->getMethodCalls()[0][1]);
82+
$this->assertInstanceOf(Expression::class, $handler->getMethodCalls()[0][1][0]);
83+
$this->assertEquals('wsse', $handler->getMethodCalls()[0][1][1]);
7884

7985
$clientMiddlewareDefinition = $container->getDefinition('guzzle_bundle_wsse_plugin.middleware.wsse.api_payment');
8086
$this->assertCount(3, $clientMiddlewareDefinition->getArguments());

0 commit comments

Comments
 (0)