Exemplo n.º 1
0
 /**
  * Test: Create name, invalid sound
  *
  * @covers \Pushy\Sound\SoundFactory::createSound
  *
  * @expectedException \Exception
  */
 public function testCreateSoundInvalidSound()
 {
     SoundFactory::createSound('this_doesnt_exist');
 }
Exemplo n.º 2
0
 /**
  * Turn a LogEntry into a Pushy\Message
  * 
  * @param LogEntry $log
  * @return Pushy\Message
  */
 private function buildMessage(LogEntry $log)
 {
     $push_level = $this->translateLogLevel($log->level_code);
     $priority = Pushy\Priority\PriorityFactory::createPriority($push_level);
     if ($push_level == 2) {
         isset($this->options['retry']) && $priority->setRetry($this->options['retry']);
         isset($this->options['expire']) && $priority->setExpire($this->options['expire']);
     }
     $message = (new Pushy\Message(substr((string) $log, 0, 1024)))->setUser($this->user)->setPriority($priority);
     isset($this->options['title']) && $message->setTitle($this->options['title']);
     isset($this->options['url']) && $message->setUrl($this->options['url']);
     isset($this->options['url-title']) && $message->setUrlTitle($this->options['url-title']);
     isset($this->options['timestamp']) && $message->setTimestamp($this->options['timestamp']);
     isset($this->options['sound']) && $message->setSound(Pushy\Sound\SoundFactory::createSound($this->options['sound']));
     return $message;
 }