/** * Message should have notification data. * * @param \Jgut\Tify\Message $message * * @return bool */ private function shouldHaveNotification(Message $message) { static $notificationParams = ['title', 'body', 'icon', 'sound', 'tag', 'color', 'click_action', 'title_loc_key', 'title_loc_args', 'body_loc_key', 'body_loc_args']; foreach ($notificationParams as $parameter) { if ($message->hasParameter($parameter)) { return true; } } return false; }
public function testPayload() { $this->message->setPayload('first', true); self::assertTrue($this->message->hasPayload('first')); self::assertTrue($this->message->getPayload('first')); self::assertCount(1, $this->message->getPayloadData()); $this->message->setPayloadData(['second' => 'second', 'third' => 'third']); self::assertTrue($this->message->hasPayload('second')); self::assertCount(2, $this->message->getPayloadData()); }
/** * Message should have alert dictionary. * * @param \Jgut\Tify\Message $message * * @return bool */ private function shouldHaveAlert(Message $message) { static $alertParams = ['title', 'body', 'title-loc-key', 'title-loc-args', 'loc-key', 'loc-args', 'action-loc-key', 'launch-image']; foreach ($alertParams as $parameter) { if ($message->hasParameter($parameter)) { return true; } } return false; }