public function testFacadeProvidesDataFromRequestAndCollectsResponses()
 {
     $session = new FakeWebServiceUserSession(123);
     $timezone = 'America/Chicago';
     $session->Timezone = $timezone;
     $request = new ReservationRequest();
     $endDate = Date::Parse('2012-11-20 05:30', 'UTC');
     $endDateUserTz = $endDate->ToTimezone($timezone);
     $startDate = Date::Parse('2012-11-18 02:30', 'UTC');
     $startDateUserTz = $startDate->ToTimezone($timezone);
     $repeatTerminationDate = Date::Parse('2012-12-13', 'UTC');
     $repeatTerminationUserTz = $repeatTerminationDate->ToTimezone($timezone);
     $accessoryId = 8912;
     $quantity = 1232;
     $attributeId = 3393;
     $attributeValue = '23232';
     $description = 'reservation description';
     $invitees = array(9, 8);
     $participants = array(99, 88);
     $repeatInterval = 1;
     $repeatMonthlyType = null;
     $repeatType = RepeatType::Weekly;
     $repeatWeekdays = array(0, 4, 5);
     $resourceId = 122;
     $resources = array(22, 23, 33);
     $title = 'reservation title';
     $userId = 1;
     $startReminderValue = 15;
     $startReminderInterval = ReservationReminderInterval::Minutes;
     $endReminderValue = 2;
     $endReminderInterval = ReservationReminderInterval::Hours;
     $request->accessories = array(new ReservationAccessoryRequest($accessoryId, $quantity));
     $request->customAttributes = array(new AttributeValueRequest($attributeId, $attributeValue));
     $request->description = $description;
     $request->endDateTime = $endDate->ToIso();
     $request->invitees = $invitees;
     $request->participants = $participants;
     $recurrence = new RecurrenceRequestResponse($repeatType, $repeatInterval, $repeatMonthlyType, $repeatWeekdays, $repeatTerminationDate->ToIso());
     $request->recurrenceRule = $recurrence;
     $request->resourceId = $resourceId;
     $request->resources = $resources;
     $request->startDateTime = $startDate->ToIso();
     $request->title = $title;
     $request->userId = $userId;
     $request->startReminder = new ReminderRequestResponse($startReminderValue, $startReminderInterval);
     $request->endReminder = new ReminderRequestResponse($endReminderValue, $endReminderInterval);
     $facade = new ReservationRequestResponseFacade($request, $session);
     $referenceNumber = uniqid();
     $errors = array('error', 'error2');
     $facade->SetReferenceNumber($referenceNumber);
     $facade->SetErrors($errors);
     $facade->SetRequiresApproval(true);
     $accessories = array(AccessoryFormElement::Create($accessoryId, $quantity));
     $attributes = array(new AttributeFormElement($attributeId, $attributeValue));
     $this->assertEquals($accessories, $facade->GetAccessories());
     $this->assertEquals(array(), $facade->GetAttachments());
     $this->assertEquals($attributes, $facade->GetAttributes());
     $this->assertEquals($description, $facade->GetDescription());
     $this->assertEquals($endDateUserTz->Format('Y-m-d'), $facade->GetEndDate());
     $this->assertEquals($endDateUserTz->Format('H:i'), $facade->GetEndTime());
     $this->assertEquals($invitees, $facade->GetInvitees());
     $this->assertEquals($participants, $facade->GetParticipants());
     $this->assertEquals($repeatInterval, $facade->GetRepeatInterval());
     $this->assertEquals($repeatMonthlyType, $facade->GetRepeatMonthlyType());
     $this->assertEquals($repeatType, $facade->GetRepeatType());
     $this->assertEquals($repeatWeekdays, $facade->GetRepeatWeekdays());
     $this->assertEquals($repeatTerminationUserTz->Format('Y-m-d'), $facade->GetRepeatTerminationDate());
     $this->assertEquals($resourceId, $facade->GetResourceId());
     $this->assertEquals($resources, $facade->GetResources());
     $this->assertEquals($startDateUserTz->Format('Y-m-d'), $facade->GetStartDate());
     $this->assertEquals($startDateUserTz->Format('H:i'), $facade->GetStartTime());
     $this->assertEquals($title, $facade->GetTitle());
     $this->assertEquals($userId, $facade->GetUserId());
     $this->assertTrue($facade->HasStartReminder());
     $this->assertTrue($facade->HasEndReminder());
     $this->assertEquals($startReminderValue, $facade->GetStartReminderValue());
     $this->assertEquals($startReminderInterval, $facade->GetStartReminderInterval());
     $this->assertEquals($endReminderValue, $facade->GetEndReminderValue());
     $this->assertEquals($endReminderInterval, $facade->GetEndReminderInterval());
     $this->assertEquals($referenceNumber, $facade->ReferenceNumber());
     $this->assertEquals($errors, $facade->Errors());
     $this->assertEquals(true, $facade->RequiresApproval());
 }
 public function GetAccessories()
 {
     $accessories = array();
     if (!empty($this->request->accessories) && is_array($this->request->accessories)) {
         foreach ($this->request->accessories as $accessory) {
             $accessories[] = AccessoryFormElement::Create($accessory->accessoryId, $accessory->quantityRequested);
         }
     }
     return $accessories;
 }