Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- use OldSound\RabbitMqBundle\RabbitMq\Consumer;
- use PhpAmqpLib\Message\AMQPMessage;
- class AsyncEventsTest extends \AppBundle\Tests\IntegrationTest\AbstractIntegrationTest
- {
- use RabbitConsumerTest;
- protected function setUp()
- {
- parent::setUp();
- $this->mqRoutingKey = 'project.created';
- $this->mqExchangeOptions = ['name' => 'app-events', 'type' => 'direct'];
- $this->mqQueueOptions = ['name' => 'app-project-create'];
- }
- public function testItProducesAndConsumes()
- {
- $this->bootKernel();
- $message = uniqid('some_body', true);
- $this->getProducer()->publish($message, 'project.created');
- static::assertSame($message, $this->consumeMessage()->getBody());
- }
- protected function getProducer()
- {
- return static::$kernel->getContainer()->get('old_sound_rabbit_mq.app_events_producer');
- }
- /**
- * @return object|\PhpAmqpLib\Connection\AMQPConnection
- */
- private function getConnection()
- {
- return static::$kernel->getContainer()->get('old_sound_rabbit_mq.connection.default');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement