Skip to content

Commit 8cf2961

Browse files
committed
Fixed tests
1 parent d1b60cd commit 8cf2961

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

DependencyInjection/Compiler/ProviderPass.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ class ProviderPass implements CompilerPassInterface
2727
*/
2828
public function process(ContainerBuilder $container)
2929
{
30+
if (!$container->hasDefinition('florianv_swap.swap')) {
31+
return;
32+
}
33+
3034
$definition = $container->getDefinition('florianv_swap.swap');
3135

3236
foreach ($container->findTaggedServiceIds('florianv_swap.provider') as $id => $attributes) {

Tests/DependencyInjection/Compiler/ProviderPassTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ public function testProvidersAreAdded()
2121
$swapDefinition = $this->getMock('Symfony\Component\DependencyInjection\Definition');
2222
$containerBuilder = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder');
2323

24+
$containerBuilder
25+
->expects($this->once())
26+
->method('hasDefinition')
27+
->with('florianv_swap.swap')
28+
->will($this->returnValue(true))
29+
;
30+
2431
$containerBuilder
2532
->expects($this->once())
2633
->method('getDefinition')

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
"symfony/framework-bundle": "~2.2",
1717
"florianv/swap": "~1.0"
1818
},
19+
"require-dev": {
20+
"symfony/expression-language": "~2.4"
21+
},
1922
"autoload": {
2023
"psr-0": {
2124
"Florianv\\SwapBundle": ""

0 commit comments

Comments
 (0)