/** * Function to create an Event * * @param array $params name-value pair for an event * * @return array $event */ function eventCreate($params = null) { if ($params === null) { $params = array('title' => 'Annual CiviCRM meet', 'summary' => 'If you have any CiviCRM related issues or want to track where CiviCRM is heading, Sign up now', 'description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues', 'event_type_id' => 1, 'is_public' => 1, 'start_date' => 20081021, 'end_date' => 20081023, 'is_online_registration' => 1, 'registration_start_date' => 20080601, 'registration_end_date' => 20081015, 'max_participants' => 100, 'event_full_text' => 'Sorry! We are already full', 'is_monetory' => 0, 'is_active' => 1, 'is_show_location' => 0); } require_once 'api/v2/Event.php'; $event =& civicrm_event_create($params); return $event; }
/** * Test civicrm_event_search. Success expected. * return.offset and return.max_results test (CRM-5266) */ function testSearchWithOffsetAndMaxResults() { $maxEvents = 5; $events = array(); while ($maxEvents > 0) { $params = array('title' => 'Test Event' . $maxEvents, 'event_type_id' => 2, 'start_date' => 20081021); $events[$maxEvents] = civicrm_event_create($params); $maxEvents--; } $params = array('event_type_id' => 2, 'return.id' => 1, 'return.title' => 1, 'return.offset' => 2, 'return.max_results' => 2); $result =& civicrm_event_search($params); $this->assertEquals(count($result), 2, 'In line ' . __LINE__); }