private function addRequestParamForEvent(Notifications $notifications, $eventName, ParameterBag $params)
 {
     $event = $notifications->getNotificationEvent($eventName);
     if ($event->isActive()) {
         $params->set('events[' . $eventName . ']', 'true');
     } else {
         $params->set('events[' . $eventName . ']', 'false');
     }
 }
Exemple #2
0
 public function testSetNotifications()
 {
     $data = array('url' => 'http://example.com/panda_notification', 'events[video_created]' => 'false', 'events[video_encoded]' => 'true', 'events[encoding_progress]' => 'false', 'events[encoding_completed]' => 'false');
     $parameterBag = new ParameterBag();
     $parameterBag->set('url', 'http://example.com/panda_notification');
     $parameterBag->set('events[video_created]', 'false');
     $parameterBag->set('events[video_encoded]', 'true');
     $parameterBag->set('events[encoding_progress]', 'false');
     $parameterBag->set('events[encoding_completed]', 'false');
     $notifications = new Notifications();
     $notifications->setUrl('http://example.com/panda_notification');
     $this->validateRequest('put', '/notifications.json', $data);
     $this->validateTransformer('Notifications', 'toRequestParams', $parameterBag);
     $this->validateTransformer('Notifications', 'stringToNotifications');
     $this->cloud->setNotifications($notifications);
 }