/** * @param LoggerInterface $logger * @param Notification $notification * @param bool $success * @param array $context * @return bool */ public function logToFile(LoggerInterface $logger, Notification $notification, $success = true, array $context = []) { $data = ['receivers' => $notification->getDevices(), 'content' => $notification->getContent(), 'data' => $notification->getData()]; $data = array_merge($data, $context); if ($success) { $logger->info('Pushmessage sent', $data); } else { $logger->error('Error sending pushmessage', $data); } return true; }
/** * Test method for the <tt>getData()</tt> and <tt>setData($data)</tt> functions. */ public function testGetSetData() { $notification = new Notification(); $this->assertNull($notification->getData()); $data = array('field0' => 'field0_value', 'field1' => 'field1_value'); $this->assertSame($notification, $notification->setData($data)); $data = $notification->getData(); $this->assertCount(2, $data); $this->assertEquals('field0_value', $data['field0']); $this->assertEquals('field1_value', $data['field1']); }