/** * @expectedException \Sonata\NotificationBundle\Exception\InvalidParameterException */ public function testInvalidType() { $logger = $this->getMock('Symfony\\Component\\HttpKernel\\Log\\LoggerInterface'); $message = new Message(); $message->setBody(array('level' => 'ERROR', 'message' => 'Alert - Area 52 get compromised!!')); $event = new ConsumerEvent($message); $consumer = new LoggerConsumer($logger); $consumer->process($event); }
/** * @dataProvider getBodyValues */ public function testGetValue($body, $names, $expected, $default) { $message = new Message(); $message->setBody($body); $this->assertEquals($expected, $message->getValue($names, $default)); }