[Messenger] Adding exception to amqp transport in case amqp ext is not installed
This commit is contained in:
parent
e50d80870e
commit
f15e0e6a43
@ -28,6 +28,9 @@ class AmqpTransportFactoryTest extends TestCase
|
||||
$this->assertFalse($factory->supports('invalid-dsn', []));
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires extension amqp
|
||||
*/
|
||||
public function testItCreatesTheTransport()
|
||||
{
|
||||
$factory = new AmqpTransportFactory();
|
||||
|
@ -12,6 +12,7 @@
|
||||
namespace Symfony\Component\Messenger\Transport\AmqpExt;
|
||||
|
||||
use Symfony\Component\Messenger\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Messenger\Exception\LogicException;
|
||||
|
||||
/**
|
||||
* An AMQP connection.
|
||||
@ -60,6 +61,10 @@ class Connection
|
||||
|
||||
public function __construct(array $connectionOptions, array $exchangeOptions, array $queuesOptions, AmqpFactory $amqpFactory = null)
|
||||
{
|
||||
if (!\extension_loaded('amqp')) {
|
||||
throw new LogicException(sprintf('You cannot use the "%s" as the "amqp" extension is not installed.', __CLASS__));
|
||||
}
|
||||
|
||||
$this->connectionOptions = array_replace_recursive([
|
||||
'delay' => [
|
||||
'exchange_name' => 'delays',
|
||||
|
Reference in New Issue
Block a user