55
66use Matthias \SymfonyDependencyInjectionTest \PhpUnit \AbstractExtensionTestCase ;
77use SimpleBus \AsynchronousBundle \DependencyInjection \SimpleBusAsynchronousExtension ;
8- use Symfony \Component \DependencyInjection \ContainerBuilder ;
98
109class SimpleBusAsynchronousExtensionTest extends AbstractExtensionTestCase
1110{
@@ -25,7 +24,7 @@ protected function getMinimalConfiguration()
2524 /**
2625 * @test
2726 */
28- public function it_uses_strategy_allways_by_default ()
27+ public function it_uses_strategy_always_by_default ()
2928 {
3029 $ this ->container ->setParameter ('kernel.bundles ' , ['SimpleBusCommandBusBundle ' =>true , 'SimpleBusEventBusBundle ' =>true ]);
3130 $ this ->load ();
@@ -43,7 +42,18 @@ public function it_uses_strategy_predefined_when_configured()
4342
4443 $ this ->assertContainerBuilderHasServiceDefinitionWithTag ('simple_bus.asynchronous.publishes_predefined_messages_middleware ' , 'event_bus_middleware ' , ['priority ' =>0 ]);
4544 }
46-
45+
46+ /**
47+ * @test
48+ * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
49+ * @expectedExceptionMessageRegExp ".*custom_strategy.*"
50+ */
51+ public function it_uses_custom_strategy_when_configured ()
52+ {
53+ $ this ->container ->setParameter ('kernel.bundles ' , ['SimpleBusCommandBusBundle ' =>true , 'SimpleBusEventBusBundle ' =>true ]);
54+ $ this ->load (['events ' =>['strategy ' =>['strategy_service_id ' =>'custom_strategy ' ]]]);
55+ }
56+
4757 /**
4858 * @test
4959 * @expectedException \LogicException
@@ -54,7 +64,7 @@ public function it_throws_exception_if_command_bus_bundle_is_missing()
5464 $ this ->container ->setParameter ('kernel.bundles ' , ['SimpleBusEventBusBundle ' =>true ]);
5565 $ this ->load (['events ' =>['strategy ' =>'predefined ' ]]);
5666 }
57-
67+
5868 /**
5969 * @test
6070 * @expectedException \LogicException
@@ -65,4 +75,4 @@ public function it_throws_exception_if_event_bus_bundle_is_missing()
6575 $ this ->container ->setParameter ('kernel.bundles ' , ['SimpleBusCommandBusBundle ' =>true ]);
6676 $ this ->load (['events ' =>['strategy ' =>'predefined ' ]]);
6777 }
68- }
78+ }
0 commit comments