Skip to content

Commit

Permalink
Merge pull request #3 from gregurco/add_service_name
Browse files Browse the repository at this point in the history
Add name to service in handler stack
  • Loading branch information
gregurco committed Nov 6, 2017
2 parents 326fba5 + ecd05e4 commit 3b58647
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/GuzzleBundleWssePlugin.php
Expand Up @@ -41,7 +41,7 @@ public function loadForClient(array $config, ContainerBuilder $container, string

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

$handler->addMethodCall('push', [$wsseExpression]);
$handler->addMethodCall('push', [$wsseExpression, 'wsse']);
}
}

Expand Down
6 changes: 6 additions & 0 deletions tests/GuzzleBundleWssePluginTest.php
Expand Up @@ -8,6 +8,7 @@
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\ExpressionLanguage\Expression;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use PHPUnit\Framework\TestCase;

Expand Down Expand Up @@ -75,6 +76,11 @@ public function testLoadForClient()

$this->assertTrue($container->hasDefinition('guzzle_bundle_wsse_plugin.middleware.wsse.api_payment'));
$this->assertCount(1, $handler->getMethodCalls());
$this->assertCount(2, $handler->getMethodCalls()[0]);
$this->assertEquals('push', $handler->getMethodCalls()[0][0]);
$this->assertCount(2, $handler->getMethodCalls()[0][1]);
$this->assertInstanceOf(Expression::class, $handler->getMethodCalls()[0][1][0]);
$this->assertEquals('wsse', $handler->getMethodCalls()[0][1][1]);

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

0 comments on commit 3b58647

Please sign in to comment.