Example #1
0
 /**
  * @expectedException \Stjornvisi\Notify\NotifyException
  * @expectedExceptionMessage No users found for event notification
  */
 public function testEveryBodyNotOk()
 {
     $mock = \Mockery::mock('\\Stjornvisi\\Lib\\QueueConnectionFactoryInterface')->shouldReceive('createConnection')->andReturn(\Mockery::mock('\\PhpAmqpLib\\Connection\\AMQPConnection')->shouldReceive(['channel' => \Mockery::mock()->shouldReceive('queue_declare', 'basic_publish', 'close')->getMock(), 'close' => ''])->getMock())->getMock();
     $logger = new Logger('test');
     $logger->pushHandler(new NullHandler());
     $notifier = new Event();
     $notifier->setDateStore($this->getDatabaseConnectionValues());
     $notifier->setData((object) ['data' => (object) ['event_id' => 1, 'user_id' => 1, 'recipients' => 'allir', 'test' => false, 'body' => '', 'subject' => '']]);
     $notifier->setLogger($logger);
     $notifier->setQueueConnectionFactory($mock);
     $this->assertInstanceOf('\\Stjornvisi\\Notify\\Event', $notifier->send());
 }