public function testMutators() { $this->message->setTitle('message title'); self::assertTrue($this->message->hasParameter('title')); self::assertEquals('message title', $this->message->getParameter('title')); $this->message->setBody('message body'); self::assertTrue($this->message->hasParameter('body')); self::assertEquals('message body', $this->message->getParameter('body')); self::assertEquals('data_', $this->message->getPayloadPrefix()); $this->message->setPayloadPrefix(''); self::assertEquals('', $this->message->getPayloadPrefix()); }
/** * 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; }
/** * 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; }