1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace OldSound\RabbitMqBundle\Tests\DependencyInjection; |
4
|
|
|
|
5
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
6
|
|
|
use Symfony\Component\DependencyInjection\Definition; |
7
|
|
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; |
8
|
|
|
use Symfony\Component\Config\FileLocator; |
9
|
|
|
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; |
10
|
|
|
use OldSound\RabbitMqBundle\DependencyInjection\OldSoundRabbitMqExtension; |
11
|
|
|
use Symfony\Component\DependencyInjection\Reference; |
12
|
|
|
use PHPUnit\Framework\TestCase; |
13
|
|
|
|
14
|
|
|
class OldSoundRabbitMqExtensionTest extends TestCase |
15
|
|
|
{ |
16
|
|
|
public function testFooConnectionDefinition() |
17
|
|
|
{ |
18
|
|
|
$container = $this->getContainer('test.yml'); |
19
|
|
|
|
20
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.connection.foo_connection')); |
21
|
|
|
$definition = $container->getDefinition('old_sound_rabbit_mq.connection.foo_connection'); |
22
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.connection_factory.foo_connection')); |
23
|
|
|
$factory = $container->getDefinition('old_sound_rabbit_mq.connection_factory.foo_connection'); |
24
|
|
|
$this->assertEquals(array('old_sound_rabbit_mq.connection_factory.foo_connection', 'createConnection'), $definition->getFactory()); |
25
|
|
|
$this->assertEquals(array( |
26
|
|
|
'host' => 'foo_host', |
27
|
|
|
'port' => 123, |
28
|
|
|
'user' => 'foo_user', |
29
|
|
|
'password' => 'foo_password', |
30
|
|
|
'vhost' => '/foo', |
31
|
|
|
'lazy' => false, |
32
|
|
|
'connection_timeout' => 3, |
33
|
|
|
'read_write_timeout' => 3, |
34
|
|
|
'ssl_context' => array(), |
35
|
|
|
'keepalive' => false, |
36
|
|
|
'heartbeat' => 0, |
37
|
|
|
'use_socket' => false, |
38
|
|
|
'url' => '', |
39
|
|
|
'hosts' => [], |
40
|
|
|
), $factory->getArgument(1)); |
41
|
|
|
$this->assertEquals('%old_sound_rabbit_mq.connection.class%', $definition->getClass()); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
public function testSslConnectionDefinition() |
45
|
|
|
{ |
46
|
|
|
$container = $this->getContainer('test.yml'); |
47
|
|
|
|
48
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.connection.ssl_connection')); |
49
|
|
|
$definition = $container->getDefinition('old_sound_rabbit_mq.connection.ssl_connection'); |
50
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.connection_factory.ssl_connection')); |
51
|
|
|
$factory = $container->getDefinition('old_sound_rabbit_mq.connection_factory.ssl_connection'); |
52
|
|
|
$this->assertEquals(array('old_sound_rabbit_mq.connection_factory.ssl_connection', 'createConnection'), $definition->getFactory()); |
53
|
|
|
$this->assertEquals(array( |
54
|
|
|
'host' => 'ssl_host', |
55
|
|
|
'port' => 123, |
56
|
|
|
'user' => 'ssl_user', |
57
|
|
|
'password' => 'ssl_password', |
58
|
|
|
'vhost' => '/ssl', |
59
|
|
|
'lazy' => false, |
60
|
|
|
'connection_timeout' => 3, |
61
|
|
|
'read_write_timeout' => 3, |
62
|
|
|
'ssl_context' => array( |
63
|
|
|
'verify_peer' => false, |
64
|
|
|
), |
65
|
|
|
'keepalive' => false, |
66
|
|
|
'heartbeat' => 0, |
67
|
|
|
'use_socket' => false, |
68
|
|
|
'url' => '', |
69
|
|
|
'hosts' => [], |
70
|
|
|
), $factory->getArgument(1)); |
71
|
|
|
$this->assertEquals('%old_sound_rabbit_mq.connection.class%', $definition->getClass()); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
public function testLazyConnectionDefinition() |
75
|
|
|
{ |
76
|
|
|
$container = $this->getContainer('test.yml'); |
77
|
|
|
|
78
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.connection.lazy_connection')); |
79
|
|
|
$definition = $container->getDefinition('old_sound_rabbit_mq.connection.lazy_connection'); |
80
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.connection_factory.lazy_connection')); |
81
|
|
|
$factory = $container->getDefinition('old_sound_rabbit_mq.connection_factory.lazy_connection'); |
82
|
|
|
$this->assertEquals(array('old_sound_rabbit_mq.connection_factory.lazy_connection', 'createConnection'), $definition->getFactory()); |
83
|
|
|
$this->assertEquals(array( |
84
|
|
|
'host' => 'lazy_host', |
85
|
|
|
'port' => 456, |
86
|
|
|
'user' => 'lazy_user', |
87
|
|
|
'password' => 'lazy_password', |
88
|
|
|
'vhost' => '/lazy', |
89
|
|
|
'lazy' => true, |
90
|
|
|
'connection_timeout' => 3, |
91
|
|
|
'read_write_timeout' => 3, |
92
|
|
|
'ssl_context' => array(), |
93
|
|
|
'keepalive' => false, |
94
|
|
|
'heartbeat' => 0, |
95
|
|
|
'use_socket' => false, |
96
|
|
|
'url' => '', |
97
|
|
|
'hosts' => [], |
98
|
|
|
), $factory->getArgument(1)); |
99
|
|
|
$this->assertEquals('%old_sound_rabbit_mq.lazy.connection.class%', $definition->getClass()); |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
public function testDefaultConnectionDefinition() |
103
|
|
|
{ |
104
|
|
|
$container = $this->getContainer('test.yml'); |
105
|
|
|
|
106
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.connection.default')); |
107
|
|
|
$definition = $container->getDefinition('old_sound_rabbit_mq.connection.default'); |
108
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.connection_factory.default')); |
109
|
|
|
$factory = $container->getDefinition('old_sound_rabbit_mq.connection_factory.default'); |
110
|
|
|
$this->assertEquals(array('old_sound_rabbit_mq.connection_factory.default', 'createConnection'), $definition->getFactory()); |
111
|
|
|
$this->assertEquals(array( |
112
|
|
|
'host' => 'localhost', |
113
|
|
|
'port' => 5672, |
114
|
|
|
'user' => 'guest', |
115
|
|
|
'password' => 'guest', |
116
|
|
|
'vhost' => '/', |
117
|
|
|
'lazy' => false, |
118
|
|
|
'connection_timeout' => 3, |
119
|
|
|
'read_write_timeout' => 3, |
120
|
|
|
'ssl_context' => array(), |
121
|
|
|
'keepalive' => false, |
122
|
|
|
'heartbeat' => 0, |
123
|
|
|
'use_socket' => false, |
124
|
|
|
'url' => '', |
125
|
|
|
'hosts' => [], |
126
|
|
|
), $factory->getArgument(1)); |
127
|
|
|
$this->assertEquals('%old_sound_rabbit_mq.connection.class%', $definition->getClass()); |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
public function testSocketConnectionDefinition() |
131
|
|
|
{ |
132
|
|
|
$container = $this->getContainer('test.yml'); |
133
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.connection.socket_connection')); |
134
|
|
|
$definiton = $container->getDefinition('old_sound_rabbit_mq.connection.socket_connection'); |
135
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.connection_factory.socket_connection')); |
136
|
|
|
$this->assertEquals('%old_sound_rabbit_mq.socket_connection.class%', $definiton->getClass()); |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
public function testLazySocketConnectionDefinition() |
140
|
|
|
{ |
141
|
|
|
$container = $this->getContainer('test.yml'); |
142
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.connection.lazy_socket')); |
143
|
|
|
$definiton = $container->getDefinition('old_sound_rabbit_mq.connection.lazy_socket'); |
144
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.connection_factory.lazy_socket')); |
145
|
|
|
$this->assertEquals('%old_sound_rabbit_mq.lazy.socket_connection.class%', $definiton->getClass()); |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
public function testClusterConnectionDefinition() |
149
|
|
|
{ |
150
|
|
|
$container = $this->getContainer('test.yml'); |
151
|
|
|
|
152
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.connection.cluster_connection')); |
153
|
|
|
$definition = $container->getDefinition('old_sound_rabbit_mq.connection.cluster_connection'); |
154
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.connection_factory.cluster_connection')); |
155
|
|
|
$factory = $container->getDefinition('old_sound_rabbit_mq.connection_factory.cluster_connection'); |
156
|
|
|
$this->assertEquals(['old_sound_rabbit_mq.connection_factory.cluster_connection', 'createConnection'], $definition->getFactory()); |
157
|
|
|
$this->assertEquals([ |
158
|
|
|
'hosts' => [ |
159
|
|
|
[ |
160
|
|
|
'host' => 'cluster_host', |
161
|
|
|
'port' => 111, |
162
|
|
|
'user' => 'cluster_user', |
163
|
|
|
'password' => 'cluster_password', |
164
|
|
|
'vhost' => '/cluster', |
165
|
|
|
'url' => '' |
166
|
|
|
], |
167
|
|
|
[ |
168
|
|
|
'host' => 'localhost', |
169
|
|
|
'port' => 5672, |
170
|
|
|
'user' => 'guest', |
171
|
|
|
'password' => 'guest', |
172
|
|
|
'vhost' => '/', |
173
|
|
|
'url' => 'amqp://cluster_url_host:cluster_url_pass@host:10000/cluster_url_vhost' |
174
|
|
|
] |
175
|
|
|
], |
176
|
|
|
'host' => 'localhost', |
177
|
|
|
'port' => 5672, |
178
|
|
|
'user' => 'guest', |
179
|
|
|
'password' => 'guest', |
180
|
|
|
'vhost' => '/', |
181
|
|
|
'lazy' => false, |
182
|
|
|
'connection_timeout' => 3, |
183
|
|
|
'read_write_timeout' => 3, |
184
|
|
|
'ssl_context' => array(), |
185
|
|
|
'keepalive' => false, |
186
|
|
|
'heartbeat' => 0, |
187
|
|
|
'use_socket' => false, |
188
|
|
|
'url' => '', |
189
|
|
|
], $factory->getArgument(1)); |
190
|
|
|
$this->assertEquals('%old_sound_rabbit_mq.connection.class%', $definition->getClass()); |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
public function testFooBinding() |
194
|
|
|
{ |
195
|
|
|
$container = $this->getContainer('test.yml'); |
196
|
|
|
$binding = array( |
197
|
|
|
'arguments' => null, |
198
|
|
|
'class' => '%old_sound_rabbit_mq.binding.class%', |
199
|
|
|
'connection' => 'default', |
200
|
|
|
'exchange' => 'foo', |
201
|
|
|
'destination' => 'bar', |
202
|
|
|
'destination_is_exchange' => false, |
203
|
|
|
'nowait' => false, |
204
|
|
|
'routing_key' => 'baz', |
205
|
|
|
); |
206
|
|
|
ksort($binding); |
207
|
|
|
$key = md5(json_encode($binding)); |
208
|
|
|
$name = sprintf('old_sound_rabbit_mq.binding.%s', $key); |
209
|
|
|
$this->assertTrue($container->has($name)); |
210
|
|
|
$definition = $container->getDefinition($name); |
211
|
|
|
$this->assertEquals((string) $definition->getArgument(0), 'old_sound_rabbit_mq.connection.default'); |
212
|
|
|
$this->assertBindingMethodCalls($definition, $binding); |
213
|
|
|
} |
214
|
|
|
|
215
|
|
|
public function testMooBinding() |
216
|
|
|
{ |
217
|
|
|
$container = $this->getContainer('test.yml'); |
218
|
|
|
$binding = array( |
219
|
|
|
'arguments' => array('moo' => 'cow'), |
220
|
|
|
'class' => '%old_sound_rabbit_mq.binding.class%', |
221
|
|
|
'connection' => 'default2', |
222
|
|
|
'exchange' => 'moo', |
223
|
|
|
'destination' => 'cow', |
224
|
|
|
'destination_is_exchange' => true, |
225
|
|
|
'nowait' => true, |
226
|
|
|
'routing_key' => null, |
227
|
|
|
); |
228
|
|
|
ksort($binding); |
229
|
|
|
$key = md5(json_encode($binding)); |
230
|
|
|
$name = sprintf('old_sound_rabbit_mq.binding.%s', $key); |
231
|
|
|
$this->assertTrue($container->has($name)); |
232
|
|
|
$definition = $container->getDefinition($name); |
233
|
|
|
$this->assertEquals((string) $definition->getArgument(0), 'old_sound_rabbit_mq.connection.default2'); |
234
|
|
|
$this->assertBindingMethodCalls($definition, $binding); |
235
|
|
|
} |
236
|
|
|
|
237
|
|
|
protected function assertBindingMethodCalls(Definition $definition, $binding) |
238
|
|
|
{ |
239
|
|
|
$this->assertEquals(array( |
240
|
|
|
array( |
241
|
|
|
'setArguments', |
242
|
|
|
array( |
243
|
|
|
$binding['arguments'] |
244
|
|
|
) |
245
|
|
|
), |
246
|
|
|
array( |
247
|
|
|
'setDestination', |
248
|
|
|
array( |
249
|
|
|
$binding['destination'] |
250
|
|
|
) |
251
|
|
|
), |
252
|
|
|
array( |
253
|
|
|
'setDestinationIsExchange', |
254
|
|
|
array( |
255
|
|
|
$binding['destination_is_exchange'] |
256
|
|
|
) |
257
|
|
|
), |
258
|
|
|
array( |
259
|
|
|
'setExchange', |
260
|
|
|
array( |
261
|
|
|
$binding['exchange'] |
262
|
|
|
) |
263
|
|
|
), |
264
|
|
|
array( |
265
|
|
|
'isNowait', |
266
|
|
|
array( |
267
|
|
|
$binding['nowait'] |
268
|
|
|
) |
269
|
|
|
), |
270
|
|
|
array( |
271
|
|
|
'setRoutingKey', |
272
|
|
|
array( |
273
|
|
|
$binding['routing_key'] |
274
|
|
|
) |
275
|
|
|
), |
276
|
|
|
), |
277
|
|
|
$definition->getMethodCalls() |
278
|
|
|
); |
279
|
|
|
} |
280
|
|
|
public function testFooProducerDefinition() |
281
|
|
|
{ |
282
|
|
|
$container = $this->getContainer('test.yml'); |
283
|
|
|
|
284
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.foo_producer_producer')); |
285
|
|
|
$definition = $container->getDefinition('old_sound_rabbit_mq.foo_producer_producer'); |
286
|
|
|
$this->assertEquals((string) $definition->getArgument(0), 'old_sound_rabbit_mq.connection.foo_connection'); |
287
|
|
|
$this->assertEquals((string) $definition->getArgument(1), 'old_sound_rabbit_mq.channel.foo_producer'); |
288
|
|
|
$this->assertEquals(array( |
289
|
|
|
array( |
290
|
|
|
'setExchangeOptions', |
291
|
|
|
array( |
292
|
|
|
array( |
293
|
|
|
'name' => 'foo_exchange', |
294
|
|
|
'type' => 'direct', |
295
|
|
|
'passive' => true, |
296
|
|
|
'durable' => false, |
297
|
|
|
'auto_delete' => true, |
298
|
|
|
'internal' => true, |
299
|
|
|
'nowait' => true, |
300
|
|
|
'arguments' => null, |
301
|
|
|
'ticket' => null, |
302
|
|
|
'declare' => true, |
303
|
|
|
) |
304
|
|
|
) |
305
|
|
|
), |
306
|
|
|
array( |
307
|
|
|
'setQueueOptions', |
308
|
|
|
array( |
309
|
|
|
array( |
310
|
|
|
'name' => '', |
311
|
|
|
'declare' => false, |
312
|
|
|
) |
313
|
|
|
) |
314
|
|
|
) |
315
|
|
|
), |
316
|
|
|
$definition->getMethodCalls() |
317
|
|
|
); |
318
|
|
|
$this->assertEquals('My\Foo\Producer', $definition->getClass()); |
319
|
|
|
} |
320
|
|
|
|
321
|
|
|
/** |
322
|
|
|
* @group alias |
323
|
|
|
*/ |
324
|
|
|
public function testAliasedFooProducerDefinition() |
325
|
|
|
{ |
326
|
|
|
$container = $this->getContainer('test.yml'); |
327
|
|
|
|
328
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.foo_producer_producer')); |
329
|
|
|
$this->assertTrue($container->has('foo_producer_alias')); |
330
|
|
|
} |
331
|
|
|
|
332
|
|
|
public function testDefaultProducerDefinition() |
333
|
|
|
{ |
334
|
|
|
$container = $this->getContainer('test.yml'); |
335
|
|
|
|
336
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.default_producer_producer')); |
337
|
|
|
$definition = $container->getDefinition('old_sound_rabbit_mq.default_producer_producer'); |
338
|
|
|
$this->assertEquals((string) $definition->getArgument(0), 'old_sound_rabbit_mq.connection.default'); |
339
|
|
|
$this->assertEquals((string) $definition->getArgument(1), 'old_sound_rabbit_mq.channel.default_producer'); |
340
|
|
|
$this->assertEquals(array( |
341
|
|
|
array( |
342
|
|
|
'setExchangeOptions', |
343
|
|
|
array( |
344
|
|
|
array( |
345
|
|
|
'name' => 'default_exchange', |
346
|
|
|
'type' => 'direct', |
347
|
|
|
'passive' => false, |
348
|
|
|
'durable' => true, |
349
|
|
|
'auto_delete' => false, |
350
|
|
|
'internal' => false, |
351
|
|
|
'nowait' => false, |
352
|
|
|
'arguments' => null, |
353
|
|
|
'ticket' => null, |
354
|
|
|
'declare' => true, |
355
|
|
|
) |
356
|
|
|
) |
357
|
|
|
), |
358
|
|
|
array( |
359
|
|
|
'setQueueOptions', |
360
|
|
|
array( |
361
|
|
|
array( |
362
|
|
|
'name' => '', |
363
|
|
|
'declare' => false, |
364
|
|
|
) |
365
|
|
|
) |
366
|
|
|
) |
367
|
|
|
), |
368
|
|
|
$definition->getMethodCalls() |
369
|
|
|
); |
370
|
|
|
$this->assertEquals('%old_sound_rabbit_mq.producer.class%', $definition->getClass()); |
371
|
|
|
} |
372
|
|
|
|
373
|
|
|
public function testFooConsumerDefinition() |
374
|
|
|
{ |
375
|
|
|
$container = $this->getContainer('test.yml'); |
376
|
|
|
|
377
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.foo_consumer_consumer')); |
378
|
|
|
$definition = $container->getDefinition('old_sound_rabbit_mq.foo_consumer_consumer'); |
379
|
|
|
$this->assertEquals((string) $definition->getArgument(0), 'old_sound_rabbit_mq.connection.foo_connection'); |
380
|
|
|
$this->assertEquals((string) $definition->getArgument(1), 'old_sound_rabbit_mq.channel.foo_consumer'); |
381
|
|
|
$this->assertEquals(array( |
382
|
|
|
array( |
383
|
|
|
'setExchangeOptions', |
384
|
|
|
array( |
385
|
|
|
array( |
386
|
|
|
'name' => 'foo_exchange', |
387
|
|
|
'type' => 'direct', |
388
|
|
|
'passive' => true, |
389
|
|
|
'durable' => false, |
390
|
|
|
'auto_delete' => true, |
391
|
|
|
'internal' => true, |
392
|
|
|
'nowait' => true, |
393
|
|
|
'arguments' => null, |
394
|
|
|
'ticket' => null, |
395
|
|
|
'declare' => true, |
396
|
|
|
) |
397
|
|
|
) |
398
|
|
|
), |
399
|
|
|
array( |
400
|
|
|
'setQueueOptions', |
401
|
|
|
array( |
402
|
|
|
array( |
403
|
|
|
'name' => 'foo_queue', |
404
|
|
|
'passive' => true, |
405
|
|
|
'durable' => false, |
406
|
|
|
'exclusive' => true, |
407
|
|
|
'auto_delete' => true, |
408
|
|
|
'nowait' => true, |
409
|
|
|
'arguments' => null, |
410
|
|
|
'ticket' => null, |
411
|
|
|
'routing_keys' => array('android.#.upload', 'iphone.upload'), |
412
|
|
|
'declare' => true, |
413
|
|
|
) |
414
|
|
|
) |
415
|
|
|
), |
416
|
|
|
array( |
417
|
|
|
'setCallback', |
418
|
|
|
array(array(new Reference('foo.callback'), 'execute')) |
419
|
|
|
), |
420
|
|
|
array( |
421
|
|
|
'setTimeoutWait', |
422
|
|
|
array(3) |
423
|
|
|
) |
424
|
|
|
), |
425
|
|
|
$definition->getMethodCalls() |
426
|
|
|
); |
427
|
|
|
$this->assertEquals('%old_sound_rabbit_mq.consumer.class%', $definition->getClass()); |
428
|
|
|
} |
429
|
|
|
|
430
|
|
|
public function testDefaultConsumerDefinition() |
431
|
|
|
{ |
432
|
|
|
$container = $this->getContainer('test.yml'); |
433
|
|
|
|
434
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.default_consumer_consumer')); |
435
|
|
|
$definition = $container->getDefinition('old_sound_rabbit_mq.default_consumer_consumer'); |
436
|
|
|
$this->assertEquals((string) $definition->getArgument(0), 'old_sound_rabbit_mq.connection.default'); |
437
|
|
|
$this->assertEquals((string) $definition->getArgument(1), 'old_sound_rabbit_mq.channel.default_consumer'); |
438
|
|
|
$this->assertEquals(array( |
439
|
|
|
array( |
440
|
|
|
'setExchangeOptions', |
441
|
|
|
array( |
442
|
|
|
array( |
443
|
|
|
'name' => 'default_exchange', |
444
|
|
|
'type' => 'direct', |
445
|
|
|
'passive' => false, |
446
|
|
|
'durable' => true, |
447
|
|
|
'auto_delete' => false, |
448
|
|
|
'internal' => false, |
449
|
|
|
'nowait' => false, |
450
|
|
|
'arguments' => null, |
451
|
|
|
'ticket' => null, |
452
|
|
|
'declare' => true, |
453
|
|
|
) |
454
|
|
|
) |
455
|
|
|
), |
456
|
|
|
array( |
457
|
|
|
'setQueueOptions', |
458
|
|
|
array( |
459
|
|
|
array( |
460
|
|
|
'name' => 'default_queue', |
461
|
|
|
'passive' => false, |
462
|
|
|
'durable' => true, |
463
|
|
|
'exclusive' => false, |
464
|
|
|
'auto_delete' => false, |
465
|
|
|
'nowait' => false, |
466
|
|
|
'arguments' => null, |
467
|
|
|
'ticket' => null, |
468
|
|
|
'routing_keys' => array(), |
469
|
|
|
'declare' => true, |
470
|
|
|
) |
471
|
|
|
) |
472
|
|
|
), |
473
|
|
|
array( |
474
|
|
|
'setCallback', |
475
|
|
|
array(array(new Reference('default.callback'), 'execute')) |
476
|
|
|
) |
477
|
|
|
), |
478
|
|
|
$definition->getMethodCalls() |
479
|
|
|
); |
480
|
|
|
$this->assertEquals('%old_sound_rabbit_mq.consumer.class%', $definition->getClass()); |
481
|
|
|
} |
482
|
|
|
|
483
|
|
|
public function testConsumerWithQosOptions() |
484
|
|
|
{ |
485
|
|
|
$container = $this->getContainer('test.yml'); |
486
|
|
|
|
487
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.qos_test_consumer_consumer')); |
488
|
|
|
$definition = $container->getDefinition('old_sound_rabbit_mq.qos_test_consumer_consumer'); |
489
|
|
|
$methodCalls = $definition->getMethodCalls(); |
490
|
|
|
|
491
|
|
|
$setQosParameters = null; |
492
|
|
|
foreach ($methodCalls as $methodCall) { |
493
|
|
|
if ($methodCall[0] === 'setQosOptions') { |
494
|
|
|
$setQosParameters = $methodCall[1]; |
495
|
|
|
} |
496
|
|
|
} |
497
|
|
|
|
498
|
|
|
$this->assertIsArray($setQosParameters); |
499
|
|
|
$this->assertEquals( |
500
|
|
|
array( |
501
|
|
|
1024, |
502
|
|
|
1, |
503
|
|
|
true |
504
|
|
|
), |
505
|
|
|
$setQosParameters |
506
|
|
|
); |
507
|
|
|
} |
508
|
|
|
|
509
|
|
|
public function testMultipleConsumerDefinition() |
510
|
|
|
{ |
511
|
|
|
$container = $this->getContainer('test.yml'); |
512
|
|
|
|
513
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.multi_test_consumer_multiple')); |
514
|
|
|
$definition = $container->getDefinition('old_sound_rabbit_mq.multi_test_consumer_multiple'); |
515
|
|
|
$this->assertEquals(array( |
516
|
|
|
array( |
517
|
|
|
'setExchangeOptions', |
518
|
|
|
array( |
519
|
|
|
array( |
520
|
|
|
'name' => 'foo_multiple_exchange', |
521
|
|
|
'type' => 'direct', |
522
|
|
|
'passive' => false, |
523
|
|
|
'durable' => true, |
524
|
|
|
'auto_delete' => false, |
525
|
|
|
'internal' => false, |
526
|
|
|
'nowait' => false, |
527
|
|
|
'arguments' => null, |
528
|
|
|
'ticket' => null, |
529
|
|
|
'declare' => true, |
530
|
|
|
) |
531
|
|
|
) |
532
|
|
|
), |
533
|
|
|
array( |
534
|
|
|
'setQueues', |
535
|
|
|
array( |
536
|
|
|
array( |
537
|
|
|
'multi_test_1' => array( |
538
|
|
|
'name' => 'multi_test_1', |
539
|
|
|
'passive' => false, |
540
|
|
|
'durable' => true, |
541
|
|
|
'exclusive' => false, |
542
|
|
|
'auto_delete' => false, |
543
|
|
|
'nowait' => false, |
544
|
|
|
'arguments' => null, |
545
|
|
|
'ticket' => null, |
546
|
|
|
'routing_keys' => array(), |
547
|
|
|
'callback' => array(new Reference('foo.multiple_test1.callback'), 'execute'), |
548
|
|
|
'declare' => true, |
549
|
|
|
), |
550
|
|
|
'foo_bar_2' => array( |
551
|
|
|
'name' => 'foo_bar_2', |
552
|
|
|
'passive' => true, |
553
|
|
|
'durable' => false, |
554
|
|
|
'exclusive' => true, |
555
|
|
|
'auto_delete' => true, |
556
|
|
|
'nowait' => true, |
557
|
|
|
'arguments' => null, |
558
|
|
|
'ticket' => null, |
559
|
|
|
'routing_keys' => array( |
560
|
|
|
'android.upload', |
561
|
|
|
'iphone.upload' |
562
|
|
|
), |
563
|
|
|
'callback' => array(new Reference('foo.multiple_test2.callback'), 'execute'), |
564
|
|
|
'declare' => true, |
565
|
|
|
) |
566
|
|
|
) |
567
|
|
|
) |
568
|
|
|
), |
569
|
|
|
array( |
570
|
|
|
'setQueuesProvider', |
571
|
|
|
array( |
572
|
|
|
new Reference('foo.queues_provider') |
573
|
|
|
) |
574
|
|
|
), |
575
|
|
|
array( |
576
|
|
|
'setTimeoutWait', |
577
|
|
|
array(3) |
578
|
|
|
) |
579
|
|
|
), |
580
|
|
|
$definition->getMethodCalls() |
581
|
|
|
); |
582
|
|
|
} |
583
|
|
|
|
584
|
|
|
public function testDynamicConsumerDefinition() |
585
|
|
|
{ |
586
|
|
|
$container = $this->getContainer('test.yml'); |
587
|
|
|
|
588
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.foo_dyn_consumer_dynamic')); |
589
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.bar_dyn_consumer_dynamic')); |
590
|
|
|
|
591
|
|
|
$definition = $container->getDefinition('old_sound_rabbit_mq.foo_dyn_consumer_dynamic'); |
592
|
|
|
$this->assertEquals(array( |
593
|
|
|
array( |
594
|
|
|
'setExchangeOptions', |
595
|
|
|
array( |
596
|
|
|
array( |
597
|
|
|
'name' => 'foo_dynamic_exchange', |
598
|
|
|
'type' => 'direct', |
599
|
|
|
'passive' => false, |
600
|
|
|
'durable' => true, |
601
|
|
|
'auto_delete' => false, |
602
|
|
|
'internal' => false, |
603
|
|
|
'nowait' => false, |
604
|
|
|
'declare' => true, |
605
|
|
|
'arguments' => NULL, |
606
|
|
|
'ticket' => NULL, |
607
|
|
|
) |
608
|
|
|
) |
609
|
|
|
), |
610
|
|
|
array( |
611
|
|
|
'setCallback', |
612
|
|
|
array( |
613
|
|
|
array(new Reference('foo.dynamic.callback'), 'execute') |
614
|
|
|
) |
615
|
|
|
), |
616
|
|
|
array( |
617
|
|
|
'setQueueOptionsProvider', |
618
|
|
|
array( |
619
|
|
|
new Reference('foo.dynamic.provider') |
620
|
|
|
) |
621
|
|
|
) |
622
|
|
|
), |
623
|
|
|
$definition->getMethodCalls() |
624
|
|
|
); |
625
|
|
|
} |
626
|
|
|
|
627
|
|
|
public function testFooAnonConsumerDefinition() |
628
|
|
|
{ |
629
|
|
|
$container = $this->getContainer('test.yml'); |
630
|
|
|
|
631
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.foo_anon_consumer_anon')); |
632
|
|
|
$definition = $container->getDefinition('old_sound_rabbit_mq.foo_anon_consumer_anon'); |
633
|
|
|
$this->assertEquals((string) $definition->getArgument(0), 'old_sound_rabbit_mq.connection.foo_connection'); |
634
|
|
|
$this->assertEquals((string) $definition->getArgument(1), 'old_sound_rabbit_mq.channel.foo_anon_consumer'); |
635
|
|
|
$this->assertEquals(array( |
636
|
|
|
array( |
637
|
|
|
'setExchangeOptions', |
638
|
|
|
array( |
639
|
|
|
array( |
640
|
|
|
'name' => 'foo_anon_exchange', |
641
|
|
|
'type' => 'direct', |
642
|
|
|
'passive' => true, |
643
|
|
|
'durable' => false, |
644
|
|
|
'auto_delete' => true, |
645
|
|
|
'internal' => true, |
646
|
|
|
'nowait' => true, |
647
|
|
|
'arguments' => null, |
648
|
|
|
'ticket' => null, |
649
|
|
|
'declare' => true, |
650
|
|
|
) |
651
|
|
|
) |
652
|
|
|
), |
653
|
|
|
array( |
654
|
|
|
'setCallback', |
655
|
|
|
array(array(new Reference('foo_anon.callback'), 'execute')) |
656
|
|
|
) |
657
|
|
|
), |
658
|
|
|
$definition->getMethodCalls() |
659
|
|
|
); |
660
|
|
|
$this->assertEquals('%old_sound_rabbit_mq.anon_consumer.class%', $definition->getClass()); |
661
|
|
|
} |
662
|
|
|
|
663
|
|
|
public function testDefaultAnonConsumerDefinition() |
664
|
|
|
{ |
665
|
|
|
$container = $this->getContainer('test.yml'); |
666
|
|
|
|
667
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.default_anon_consumer_anon')); |
668
|
|
|
$definition = $container->getDefinition('old_sound_rabbit_mq.default_anon_consumer_anon'); |
669
|
|
|
$this->assertEquals((string) $definition->getArgument(0), 'old_sound_rabbit_mq.connection.default'); |
670
|
|
|
$this->assertEquals((string) $definition->getArgument(1), 'old_sound_rabbit_mq.channel.default_anon_consumer'); |
671
|
|
|
$this->assertEquals(array( |
672
|
|
|
array( |
673
|
|
|
'setExchangeOptions', |
674
|
|
|
array( |
675
|
|
|
array( |
676
|
|
|
'name' => 'default_anon_exchange', |
677
|
|
|
'type' => 'direct', |
678
|
|
|
'passive' => false, |
679
|
|
|
'durable' => true, |
680
|
|
|
'auto_delete' => false, |
681
|
|
|
'internal' => false, |
682
|
|
|
'nowait' => false, |
683
|
|
|
'arguments' => null, |
684
|
|
|
'ticket' => null, |
685
|
|
|
'declare' => true, |
686
|
|
|
) |
687
|
|
|
) |
688
|
|
|
), |
689
|
|
|
array( |
690
|
|
|
'setCallback', |
691
|
|
|
array(array(new Reference('default_anon.callback'), 'execute')) |
692
|
|
|
) |
693
|
|
|
), |
694
|
|
|
$definition->getMethodCalls() |
695
|
|
|
); |
696
|
|
|
$this->assertEquals('%old_sound_rabbit_mq.anon_consumer.class%', $definition->getClass()); |
697
|
|
|
} |
698
|
|
|
|
699
|
|
|
public function testFooRpcClientDefinition() |
700
|
|
|
{ |
701
|
|
|
$container = $this->getContainer('rpc-clients.yml'); |
702
|
|
|
|
703
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.foo_client_rpc')); |
704
|
|
|
$definition = $container->getDefinition('old_sound_rabbit_mq.foo_client_rpc'); |
705
|
|
|
$this->assertEquals((string) $definition->getArgument(0), 'old_sound_rabbit_mq.connection.foo_connection'); |
706
|
|
|
$this->assertEquals((string) $definition->getArgument(1), 'old_sound_rabbit_mq.channel.foo_client'); |
707
|
|
|
$this->assertEquals( |
708
|
|
|
array( |
709
|
|
|
array('initClient', array(true)), |
710
|
|
|
array('setUnserializer', array('json_decode')), |
711
|
|
|
array('setDirectReplyTo', array(true)), |
712
|
|
|
), |
713
|
|
|
$definition->getMethodCalls() |
714
|
|
|
); |
715
|
|
|
$this->assertEquals('%old_sound_rabbit_mq.rpc_client.class%', $definition->getClass()); |
716
|
|
|
} |
717
|
|
|
|
718
|
|
|
public function testDefaultRpcClientDefinition() |
719
|
|
|
{ |
720
|
|
|
$container = $this->getContainer('rpc-clients.yml'); |
721
|
|
|
|
722
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.default_client_rpc')); |
723
|
|
|
$definition = $container->getDefinition('old_sound_rabbit_mq.default_client_rpc'); |
724
|
|
|
$this->assertEquals((string) $definition->getArgument(0), 'old_sound_rabbit_mq.connection.default'); |
725
|
|
|
$this->assertEquals((string) $definition->getArgument(1), 'old_sound_rabbit_mq.channel.default_client'); |
726
|
|
|
$this->assertEquals( |
727
|
|
|
array( |
728
|
|
|
array('initClient', array(true)), |
729
|
|
|
array('setUnserializer', array('unserialize')), |
730
|
|
|
array('setDirectReplyTo', array(false)), |
731
|
|
|
), |
732
|
|
|
$definition->getMethodCalls() |
733
|
|
|
); |
734
|
|
|
$this->assertFalse($definition->isLazy()); |
735
|
|
|
$this->assertEquals('%old_sound_rabbit_mq.rpc_client.class%', $definition->getClass()); |
736
|
|
|
} |
737
|
|
|
|
738
|
|
|
public function testLazyRpcClientDefinition() |
739
|
|
|
{ |
740
|
|
|
$container = $this->getContainer('rpc-clients.yml'); |
741
|
|
|
|
742
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.lazy_client_rpc')); |
743
|
|
|
$definition = $container->getDefinition('old_sound_rabbit_mq.lazy_client_rpc'); |
744
|
|
|
$this->assertEquals((string) $definition->getArgument(0), 'old_sound_rabbit_mq.connection.default'); |
745
|
|
|
$this->assertEquals((string) $definition->getArgument(1), 'old_sound_rabbit_mq.channel.lazy_client'); |
746
|
|
|
$this->assertEquals( |
747
|
|
|
array( |
748
|
|
|
array('initClient', array(true)), |
749
|
|
|
array('setUnserializer', array('unserialize')), |
750
|
|
|
array('setDirectReplyTo', array(false)), |
751
|
|
|
), |
752
|
|
|
$definition->getMethodCalls() |
753
|
|
|
); |
754
|
|
|
$this->assertTrue($definition->isLazy()); |
755
|
|
|
$this->assertEquals('%old_sound_rabbit_mq.rpc_client.class%', $definition->getClass()); |
756
|
|
|
} |
757
|
|
|
|
758
|
|
|
public function testFooRpcServerDefinition() |
759
|
|
|
{ |
760
|
|
|
$container = $this->getContainer('test.yml'); |
761
|
|
|
|
762
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.foo_server_server')); |
763
|
|
|
$definition = $container->getDefinition('old_sound_rabbit_mq.foo_server_server'); |
764
|
|
|
$this->assertEquals((string) $definition->getArgument(0), 'old_sound_rabbit_mq.connection.foo_connection'); |
765
|
|
|
$this->assertEquals((string) $definition->getArgument(1), 'old_sound_rabbit_mq.channel.foo_server'); |
766
|
|
|
$this->assertEquals(array( |
767
|
|
|
array('initServer', array('foo_server')), |
768
|
|
|
array('setCallback', array(array(new Reference('foo_server.callback'), 'execute'))), |
769
|
|
|
array('setSerializer', array('json_encode')), |
770
|
|
|
), |
771
|
|
|
$definition->getMethodCalls() |
772
|
|
|
); |
773
|
|
|
$this->assertEquals('%old_sound_rabbit_mq.rpc_server.class%', $definition->getClass()); |
774
|
|
|
} |
775
|
|
|
|
776
|
|
|
public function testDefaultRpcServerDefinition() |
777
|
|
|
{ |
778
|
|
|
$container = $this->getContainer('test.yml'); |
779
|
|
|
|
780
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.default_server_server')); |
781
|
|
|
$definition = $container->getDefinition('old_sound_rabbit_mq.default_server_server'); |
782
|
|
|
$this->assertEquals((string) $definition->getArgument(0), 'old_sound_rabbit_mq.connection.default'); |
783
|
|
|
$this->assertEquals((string) $definition->getArgument(1), 'old_sound_rabbit_mq.channel.default_server'); |
784
|
|
|
$this->assertEquals(array( |
785
|
|
|
array('initServer', array('default_server')), |
786
|
|
|
array('setCallback', array(array(new Reference('default_server.callback'), 'execute'))), |
787
|
|
|
array('setSerializer', array('serialize')), |
788
|
|
|
), |
789
|
|
|
$definition->getMethodCalls() |
790
|
|
|
); |
791
|
|
|
$this->assertEquals('%old_sound_rabbit_mq.rpc_server.class%', $definition->getClass()); |
792
|
|
|
} |
793
|
|
|
|
794
|
|
|
public function testRpcServerWithQueueOptionsDefinition() |
795
|
|
|
{ |
796
|
|
|
$container = $this->getContainer('test.yml'); |
797
|
|
|
|
798
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.server_with_queue_options_server')); |
799
|
|
|
$definition = $container->getDefinition('old_sound_rabbit_mq.server_with_queue_options_server'); |
800
|
|
|
$this->assertEquals((string) $definition->getArgument(0), 'old_sound_rabbit_mq.connection.default'); |
801
|
|
|
$this->assertEquals((string) $definition->getArgument(1), 'old_sound_rabbit_mq.channel.server_with_queue_options'); |
802
|
|
|
$this->assertEquals(array( |
803
|
|
|
array('initServer', array('server_with_queue_options')), |
804
|
|
|
array('setCallback', array(array(new Reference('server_with_queue_options.callback'), 'execute'))), |
805
|
|
|
array('setQueueOptions', array(array( |
806
|
|
|
'name' => 'server_with_queue_options-queue', |
807
|
|
|
'passive' => false, |
808
|
|
|
'durable' => true, |
809
|
|
|
'exclusive' => false, |
810
|
|
|
'auto_delete' => false, |
811
|
|
|
'nowait' => false, |
812
|
|
|
'arguments' => null, |
813
|
|
|
'ticket' => null, |
814
|
|
|
'routing_keys' => array(), |
815
|
|
|
'declare' => true, |
816
|
|
|
))), |
817
|
|
|
array('setSerializer', array('serialize')), |
818
|
|
|
), |
819
|
|
|
$definition->getMethodCalls() |
820
|
|
|
); |
821
|
|
|
$this->assertEquals('%old_sound_rabbit_mq.rpc_server.class%', $definition->getClass()); |
822
|
|
|
} |
823
|
|
|
|
824
|
|
|
public function testRpcServerWithExchangeOptionsDefinition() |
825
|
|
|
{ |
826
|
|
|
$container = $this->getContainer('test.yml'); |
827
|
|
|
|
828
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.server_with_exchange_options_server')); |
829
|
|
|
$definition = $container->getDefinition('old_sound_rabbit_mq.server_with_exchange_options_server'); |
830
|
|
|
$this->assertEquals((string) $definition->getArgument(0), 'old_sound_rabbit_mq.connection.default'); |
831
|
|
|
$this->assertEquals((string) $definition->getArgument(1), 'old_sound_rabbit_mq.channel.server_with_exchange_options'); |
832
|
|
|
$this->assertEquals(array( |
833
|
|
|
array('initServer', array('server_with_exchange_options')), |
834
|
|
|
array('setCallback', array(array(new Reference('server_with_exchange_options.callback'), 'execute'))), |
835
|
|
|
array('setExchangeOptions', array(array( |
836
|
|
|
'name' => 'exchange', |
837
|
|
|
'type' => 'topic', |
838
|
|
|
'passive' => false, |
839
|
|
|
'durable' => true, |
840
|
|
|
'auto_delete' => false, |
841
|
|
|
'internal' => null, |
842
|
|
|
'nowait' => false, |
843
|
|
|
'declare' => true, |
844
|
|
|
'arguments' => null, |
845
|
|
|
'ticket' => null, |
846
|
|
|
))), |
847
|
|
|
array('setSerializer', array('serialize')), |
848
|
|
|
), |
849
|
|
|
$definition->getMethodCalls() |
850
|
|
|
); |
851
|
|
|
$this->assertEquals('%old_sound_rabbit_mq.rpc_server.class%', $definition->getClass()); |
852
|
|
|
} |
853
|
|
|
|
854
|
|
|
public function testHasCollectorWhenChannelsExist() |
855
|
|
|
{ |
856
|
|
|
$container = $this->getContainer('collector.yml'); |
857
|
|
|
|
858
|
|
|
$this->assertTrue($container->has('old_sound_rabbit_mq.data_collector')); |
859
|
|
|
$definition = $container->getDefinition('old_sound_rabbit_mq.data_collector'); |
860
|
|
|
|
861
|
|
|
$this->assertEquals(array( |
862
|
|
|
new Reference('old_sound_rabbit_mq.channel.default_producer'), |
863
|
|
|
new Reference('old_sound_rabbit_mq.channel.default_consumer'), |
864
|
|
|
), |
865
|
|
|
$definition->getArgument(0) |
866
|
|
|
); |
867
|
|
|
} |
868
|
|
|
|
869
|
|
|
public function testHasNoCollectorWhenNoChannelsExist() |
870
|
|
|
{ |
871
|
|
|
$container = $this->getContainer('no_collector.yml'); |
872
|
|
|
$this->assertFalse($container->has('old_sound_rabbit_mq.data_collector')); |
873
|
|
|
} |
874
|
|
|
|
875
|
|
|
public function testCollectorCanBeDisabled() |
876
|
|
|
{ |
877
|
|
|
$container = $this->getContainer('collector_disabled.yml'); |
878
|
|
|
$this->assertFalse($container->has('old_sound_rabbit_mq.data_collector')); |
879
|
|
|
} |
880
|
|
|
|
881
|
|
|
public function testExchangeArgumentsAreArray() |
882
|
|
|
{ |
883
|
|
|
$container = $this->getContainer('exchange_arguments.yml'); |
884
|
|
|
|
885
|
|
|
$definition = $container->getDefinition('old_sound_rabbit_mq.producer_producer'); |
886
|
|
|
$calls = $definition->getMethodCalls(); |
887
|
|
|
$this->assertEquals('setExchangeOptions', $calls[0][0]); |
888
|
|
|
$options = $calls[0][1]; |
889
|
|
|
$this->assertEquals(array('name' => 'bar'), $options[0]['arguments']); |
890
|
|
|
|
891
|
|
|
$definition = $container->getDefinition('old_sound_rabbit_mq.consumer_consumer'); |
892
|
|
|
$calls = $definition->getMethodCalls(); |
893
|
|
|
$this->assertEquals('setExchangeOptions', $calls[0][0]); |
894
|
|
|
$options = $calls[0][1]; |
895
|
|
|
$this->assertEquals(array('name' => 'bar'), $options[0]['arguments']); |
896
|
|
|
} |
897
|
|
|
|
898
|
|
|
public function testProducerWithoutExplicitExchangeOptionsConnectsToAMQPDefault() |
899
|
|
|
{ |
900
|
|
|
$container = $this->getContainer('no_exchange_options.yml'); |
901
|
|
|
|
902
|
|
|
$definition = $container->getDefinition('old_sound_rabbit_mq.producer_producer'); |
903
|
|
|
$calls = $definition->getMethodCalls(); |
904
|
|
|
$this->assertEquals('setExchangeOptions', $calls[0][0]); |
905
|
|
|
$options = $calls[0][1]; |
906
|
|
|
|
907
|
|
|
$this->assertEquals('', $options[0]['name']); |
908
|
|
|
$this->assertEquals('direct', $options[0]['type']); |
909
|
|
|
$this->assertEquals(false, $options[0]['declare']); |
910
|
|
|
$this->assertEquals(true, $options[0]['passive']); |
911
|
|
|
} |
912
|
|
|
|
913
|
|
|
public function testProducersWithLogger() |
914
|
|
|
{ |
915
|
|
|
$container = $this->getContainer('config_with_enable_logger.yml'); |
916
|
|
|
$definition = $container->getDefinition('old_sound_rabbit_mq.default_consumer_consumer'); |
917
|
|
|
$this->assertTrue( |
918
|
|
|
$definition->hasTag('monolog.logger'), 'service should be marked for logger' |
919
|
|
|
); |
920
|
|
|
} |
921
|
|
|
|
922
|
|
|
private function getContainer($file, $debug = false) |
923
|
|
|
{ |
924
|
|
|
$container = new ContainerBuilder(new ParameterBag(array('kernel.debug' => $debug))); |
925
|
|
|
$container->registerExtension(new OldSoundRabbitMqExtension()); |
926
|
|
|
|
927
|
|
|
$locator = new FileLocator(__DIR__.'/Fixtures'); |
928
|
|
|
$loader = new YamlFileLoader($container, $locator); |
929
|
|
|
$loader->load($file); |
930
|
|
|
|
931
|
|
|
$container->getCompilerPassConfig()->setOptimizationPasses(array()); |
932
|
|
|
$container->getCompilerPassConfig()->setRemovingPasses(array()); |
933
|
|
|
$container->compile(); |
934
|
|
|
|
935
|
|
|
return $container; |
936
|
|
|
} |
937
|
|
|
} |
938
|
|
|
|