33namespace OldSound \RabbitMqBundle \Tests \DependencyInjection ;
44
55use Symfony \Component \DependencyInjection \ContainerBuilder ;
6+ use Symfony \Component \DependencyInjection \Definition ;
67use Symfony \Component \DependencyInjection \ParameterBag \ParameterBag ;
78use Symfony \Component \Config \FileLocator ;
89use Symfony \Component \DependencyInjection \Loader \YamlFileLoader ;
@@ -130,6 +131,9 @@ public function testFooBinding()
130131 $ key = md5 (json_encode ($ binding ));
131132 $ name = sprintf ('old_sound_rabbit_mq.%s_binding ' , $ key );
132133 $ this ->assertTrue ($ container ->has ($ name ));
134+ $ definition = $ container ->getDefinition ($ name );
135+ $ this ->assertEquals ((string ) $ definition ->getArgument (0 ), 'old_sound_rabbit_mq.connection.default ' );
136+ $ this ->assertBindingMethodCalls ($ definition , $ binding );
133137 }
134138
135139 public function testMooBinding ()
@@ -149,8 +153,54 @@ public function testMooBinding()
149153 $ key = md5 (json_encode ($ binding ));
150154 $ name = sprintf ('old_sound_rabbit_mq.%s_binding ' , $ key );
151155 $ this ->assertTrue ($ container ->has ($ name ));
156+ $ definition = $ container ->getDefinition ($ name );
157+ $ this ->assertEquals ((string ) $ definition ->getArgument (0 ), 'old_sound_rabbit_mq.connection.default2 ' );
158+ $ this ->assertBindingMethodCalls ($ definition , $ binding );
152159 }
153160
161+ protected function assertBindingMethodCalls (Definition $ definition , $ binding )
162+ {
163+ $ this ->assertEquals (array (
164+ array (
165+ 'setArguments ' ,
166+ array (
167+ $ binding ['arguments ' ]
168+ )
169+ ),
170+ array (
171+ 'setDestination ' ,
172+ array (
173+ $ binding ['destination ' ]
174+ )
175+ ),
176+ array (
177+ 'setDestinationIsExchange ' ,
178+ array (
179+ $ binding ['destination_is_exchange ' ]
180+ )
181+ ),
182+ array (
183+ 'setExchange ' ,
184+ array (
185+ $ binding ['exchange ' ]
186+ )
187+ ),
188+ array (
189+ 'isNowait ' ,
190+ array (
191+ $ binding ['nowait ' ]
192+ )
193+ ),
194+ array (
195+ 'setRoutingKey ' ,
196+ array (
197+ $ binding ['routing_key ' ]
198+ )
199+ ),
200+ ),
201+ $ definition ->getMethodCalls ()
202+ );
203+ }
154204 public function testFooProducerDefinition ()
155205 {
156206 $ container = $ this ->getContainer ('test.yml ' );
0 commit comments