public function testAPSBadgeAddedOK() { $expected = array("aps" => array("badge" => 1)); $msg = new iOSMessage(); $msg->setAPSBadge(1); $this->assertEquals($expected, $msg->getMessageBody()); }
/** * @param Notification $notification * @param string $deviceToken * * @return iOSMessage */ protected function createMessage(Notification $notification, $deviceToken) { $pushNotification = new iOSMessage(); $pushNotification->setMessage($notification->getMessage()); $pushNotification->setDeviceIdentifier($deviceToken['token']); $pushNotification->setAPSSound('default'); $pushNotification->setAPSBadge($deviceToken['badge']); /* @TODO send extra data to the client or not foreach ($notification->getContent() as $key => $value) { $pushNotification->addCustomData($key, $value); } */ return $pushNotification; }