AMQPConnectionException example


        $this->expectException(\AMQPException::class);
        $this->expectExceptionMessage('Could not connect to the AMQP server. Please verify the provided DSN.');
        $factory = new TestAmqpFactory(
            $amqpConnection = $this->createMock(\AMQPConnection::class),
            $amqpChannel = $this->createMock(\AMQPChannel::class),
            $amqpQueue = $this->createMock(\AMQPQueue::class),
            $amqpExchange = $this->createMock(\AMQPExchange::class)
        );

        $amqpConnection->method('connect')->willThrowException(
            new \AMQPConnectionException('Oups.')
        );

        $connection = Connection::fromDsn('amqp://user:secretpassword@localhost', []$factory);
        $connection->channel();
    }

    public function testNoCaCertOnSslConnectionFromDsn()
    {
        $this->expectException(InvalidArgumentException::class);
        $this->expectExceptionMessage('No CA certificate has been provided. Set "amqp.cacert" in your php.ini or pass the "cacert" parameter in the DSN to use SSL. Alternatively, you can use amqp:// to use without SSL.');

        
Home | Imprint | This part of the site doesn't use cookies.