/**
  * @covers ::setContent
  * @covers ::getContent
  */
 public function testContent()
 {
     $notification = new Notification('title', 'content');
     $this->assertSame('content', $notification->getContent());
 }
예제 #2
0
 /**
  * Create post fields for API request based on provided notification object
  *
  * @param Notification $notification
  *
  * @return array<string,string> Post fields
  */
 private function createPostFields(Notification $notification)
 {
     /**
      * Required fields
      */
     $data = ['user_credentials' => $this->accessToken, 'notification[title]' => $notification->getTitle(), 'notification[long_message]' => $notification->getContent()];
     /**
      * Optional fields
      */
     if (!empty($this->getSourceName())) {
         $data['notification[source_name]'] = $this->getSourceName();
     }
     if (!empty($this->getIconUrl())) {
         $data['notification[icon_url]'] = $this->getIconUrl();
     }
     if (!empty($this->getSound())) {
         $data['notification[sound]'] = $this->getSound();
     }
     if (!empty($this->getOpenUrl())) {
         $data['notification[open_url]'] = $this->getOpenUrl();
     }
     return $data;
 }