-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from M6Web/fix/normalize-keys-queue-arguments
disabled normalize keys for queue arguments
- Loading branch information
Showing
6 changed files
with
147 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
m6_web_amqp: | ||
connections: | ||
default: | ||
host: 'localhost' | ||
port: 5672 | ||
timeout: 2 | ||
login: 'guest' | ||
password: 'guest' | ||
vhost: '/' | ||
lazy: true | ||
producers: | ||
producer_1: | ||
connection: default | ||
exchange_options: | ||
name: 'exchange_1' | ||
type: direct | ||
routing_keys: ['super_routing_key'] | ||
producer_2: | ||
connection: default | ||
exchange_options: | ||
name: 'exchange_2' | ||
type: direct | ||
routing_keys: ['super_routing_key'] | ||
queue_options: | ||
name: 'ha.queue_exchange_2' | ||
arguments: | ||
x-message-ttl: 1000 | ||
consumers: | ||
consumer_1: | ||
connection: default | ||
exchange_options: | ||
name: 'exchange_1' | ||
queue_options: | ||
name: 'ha.queue_exchange_1' | ||
routing_keys: ['super_routing_key'] | ||
arguments: | ||
x-dead-letter-exchange: 'exchange_2' |
86 changes: 86 additions & 0 deletions
86
src/AmqpBundle/Tests/Units/DependencyInjection/M6WebAmqpExtension.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?php | ||
namespace M6Web\Bundle\AmqpBundle\Tests\Units\DependencyInjection; | ||
|
||
use M6Web\Bundle\AmqpBundle\DependencyInjection\M6WebAmqpExtension as Base; | ||
|
||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\Config\FileLocator; | ||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; | ||
|
||
use atoum\test; | ||
|
||
/** | ||
* Class M6WebAmqpExtension | ||
* | ||
* @package M6Web\Bundle\AmqpBundle\Tests\Units\DependencyInjection | ||
*/ | ||
class M6WebAmqpExtension extends test | ||
{ | ||
protected function getContainerForConfiguration($fixtureName) | ||
{ | ||
$extension = new Base(); | ||
|
||
$parameterBag = new ParameterBag(array('kernel.debug' => true)); | ||
$container = new ContainerBuilder($parameterBag); | ||
$container->set('event_dispatcher', new \mock\Symfony\Component\EventDispatcher\EventDispatcherInterface()); | ||
$container->registerExtension($extension); | ||
|
||
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../../Fixtures/')); | ||
$loader->load($fixtureName.'.yml'); | ||
|
||
return $container; | ||
} | ||
|
||
public function testQueueArgumentsConfig() | ||
{ | ||
$container = $this->getContainerForConfiguration('queue-arguments-config'); | ||
$container->compile(); | ||
|
||
// test producer queue options | ||
$this | ||
->boolean($container->has('m6_web_amqp.producer.producer_2')) | ||
->isTrue() | ||
->array($queueOptions = $container->getDefinition('m6_web_amqp.producer.producer_2')->getArgument(3)) | ||
->hasSize(6) | ||
->string($queueOptions['name']) | ||
->isEqualTo('ha.queue_exchange_2') | ||
->array($arguments = $queueOptions['arguments']) | ||
->hasSize(1) | ||
->hasKey('x-message-ttl') | ||
->contains(1000) | ||
->boolean($queueOptions['passive']) | ||
->isFalse() | ||
->boolean($queueOptions['durable']) | ||
->isTrue() | ||
->boolean($queueOptions['auto_delete']) | ||
->isFalse() | ||
->array($queueOptions['routing_keys']) | ||
->isEmpty() | ||
; | ||
|
||
// test consumer queue options | ||
$this | ||
->boolean($container->has('m6_web_amqp.consumer.consumer_1')) | ||
->isTrue() | ||
->array($queueOptions = $container->getDefinition('m6_web_amqp.consumer.consumer_1')->getArgument(3)) | ||
->hasSize(7) | ||
->string($queueOptions['name']) | ||
->isEqualTo('ha.queue_exchange_1') | ||
->array($arguments = $queueOptions['arguments']) | ||
->hasSize(1) | ||
->hasKey('x-dead-letter-exchange') | ||
->contains('exchange_2') | ||
->boolean($queueOptions['passive']) | ||
->isFalse() | ||
->boolean($queueOptions['durable']) | ||
->isTrue() | ||
->boolean($queueOptions['auto_delete']) | ||
->isFalse() | ||
->array($queueOptions['routing_keys']) | ||
->hasSize(1) | ||
->contains('super_routing_key') | ||
; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters