mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-12 16:14:08 +02:00
More amqp fixes
This commit is contained in:
@@ -42,6 +42,8 @@ class AmqpHandler extends AbstractProcessingHandler
|
|||||||
$this->exchangeName = $exchangeName;
|
$this->exchangeName = $exchangeName;
|
||||||
} elseif (!$exchange instanceof AMQPExchange) {
|
} elseif (!$exchange instanceof AMQPExchange) {
|
||||||
throw new \InvalidArgumentException('PhpAmqpLib\Channel\AMQPChannel or AMQPExchange instance required');
|
throw new \InvalidArgumentException('PhpAmqpLib\Channel\AMQPChannel or AMQPExchange instance required');
|
||||||
|
} elseif ($exchangeName) {
|
||||||
|
@trigger_error('The $exchangeName parameter can only be passed when using PhpAmqpLib, if using an AMQPExchange instance configure it beforehand', E_USER_DEPRECATED);
|
||||||
}
|
}
|
||||||
$this->exchange = $exchange;
|
$this->exchange = $exchange;
|
||||||
|
|
||||||
|
@@ -34,10 +34,6 @@ class AmqpHandlerTest extends TestCase
|
|||||||
$messages = [];
|
$messages = [];
|
||||||
|
|
||||||
$exchange = $this->getMock('AMQPExchange', ['publish', 'setName'], [], '', false);
|
$exchange = $this->getMock('AMQPExchange', ['publish', 'setName'], [], '', false);
|
||||||
$exchange->expects($this->once())
|
|
||||||
->method('setName')
|
|
||||||
->with('log')
|
|
||||||
;
|
|
||||||
$exchange->expects($this->any())
|
$exchange->expects($this->any())
|
||||||
->method('publish')
|
->method('publish')
|
||||||
->will($this->returnCallback(function ($message, $routing_key, $flags = 0, $attributes = []) use (&$messages) {
|
->will($this->returnCallback(function ($message, $routing_key, $flags = 0, $attributes = []) use (&$messages) {
|
||||||
@@ -45,7 +41,7 @@ class AmqpHandlerTest extends TestCase
|
|||||||
}))
|
}))
|
||||||
;
|
;
|
||||||
|
|
||||||
$handler = new AmqpHandler($exchange, 'log');
|
$handler = new AmqpHandler($exchange);
|
||||||
|
|
||||||
$record = $this->getRecord(Logger::WARNING, 'test', ['data' => new \stdClass, 'foo' => 34]);
|
$record = $this->getRecord(Logger::WARNING, 'test', ['data' => new \stdClass, 'foo' => 34]);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user