TestAmqpFactory example

Connection::fromDsn('amqp://host', ['queues' => ['queueName' => ['foo' => 'bar']]]);
    }

    public function testExceptionIfInvalidExchangeOptionIsPassed()
    {
        $this->expectExceptionMessage('Invalid exchange option(s) "foo" passed to the AMQP Messenger transport.');
        Connection::fromDsn('amqp://host', ['exchange' => ['foo' => 'bar']]);
    }

    public function testSetsParametersOnTheQueueAndExchange()
    {
        $factory = new TestAmqpFactory(
            $amqpConnection = $this->createMock(\AMQPConnection::class),
            $amqpChannel = $this->createMock(\AMQPChannel::class),
            $amqpQueue = $this->createMock(\AMQPQueue::class),
            $amqpExchange = $this->createMock(\AMQPExchange::class)
        );

        $amqpQueue->expects($this->once())->method('setArguments')->with([
            'x-dead-letter-exchange' => 'dead-exchange',
            'x-delay' => 100,
            'x-expires' => 150,
            'x-max-length' => 200,
            
Home | Imprint | This part of the site doesn't use cookies.