Example #1
0
 public function testCreateEvent()
 {
     // Create the Event.
     $event = new Event($this->ews, ['eventName' => 'Banana shower of heavenly parents', 'eventType' => 'HUH', 'eventDistance' => '1000m', 'eventDistanceUOM' => '1000UOM', 'ageFrom' => 0, 'ageTo' => 100, 'ageCriteria' => 'Positive', 'gender' => 'male or female', 'waves' => [], 'sponsorshipPageCreationDuration' => '1m', 'defaultSiebelRegistrationStatus' => '']);
     $event->create();
     $this->assertEquals('Banana shower of heavenly parents', $event->getEventName());
     $this->assertEquals('HUH', $event->getEventType());
     $this->assertEquals('1000m', $event->getEventDistance());
     $this->assertEquals('1000UOM', $event->getEventDistanceUOM());
     $this->assertEquals(0, $event->getAgeFrom());
     $this->assertEquals(100, $event->getAgeTo());
     $this->assertEquals('Positive', $event->getAgeCriteria());
     $this->assertEquals('male or female', $event->getGender());
     $this->assertEquals([], $event->getWaves());
     $this->assertEquals('1m', $event->getSponsorshipPageCreationDuration());
     $this->assertEquals('', $event->getDefaultSiebelRegistrationStatus());
     // Get the request from the history
     $request = $this->history[0]['request'];
     // Assert that the request is made to the correct endpoint
     $this->assertRequestMethodSame('POST', $request);
     $this->assertRequestUriPathSame('api/v2/events.json', $request);
     // Test setting registrations (possibly code that is not required).
     $registration = new Registration($this->ews, [], $event);
     $event->setRegistrations([$registration]);
     $this->assertEquals([$registration], $event->getRegistrations());
 }