NB jenkins is doing wierd things here so trying a small subset to see what jenkins does
* with civicrm_loc_block
*/
public function testCreateWithLocBlock() {
- $this->_contactId = Contact::createIndividual();
- //create test event record.
- $eventId = Event::create($this->_contactId);
+ $this->_contactId = $this->individualCreate();
+ $event = $this->eventCreate();
$params = array(
'address' => array(
'1' => array(
),
);
- $params['entity_id'] = $eventId;
+ $params['entity_id'] = $event['id'];
$params['entity_table'] = 'civicrm_event';
//create location block.
//update event record with location block id
$eventParams = array(
- 'id' => $eventId,
+ 'id' => $event['id'],
'loc_block_id' => $locBlockId,
);
//Now check DB for location block
$this->assertDBCompareValue('CRM_Event_DAO_Event',
- $eventId,
+ $event['id'],
'loc_block_id',
'id',
$locBlockId,
);
$this->assertDBCompareValues('CRM_Core_DAO_IM', $searchParams, $compareParams);
- //delete the location block
+ // Cleanup.
CRM_Core_BAO_Location::deleteLocBlock($locBlockId);
-
- //cleanup DB by deleting the record.
- Event::delete($eventId);
+ $this->eventDelete($event['id']);
$this->contactDelete($this->_contactId);
}
* created with various elements.
*/
public function testDeleteLocBlock() {
- $this->_contactId = Contact::createIndividual();
+ $this->_contactId = $this->individualCreate();
//create test event record.
- $eventId = Event::create($this->_contactId);
+ $event = $this->eventCreate();
$params['location'][1] = array(
'location_type_id' => 1,
'is_primary' => 1,
),
),
);
- $params['entity_id'] = $eventId;
+ $params['entity_id'] = $event['id'];
$params['entity_table'] = 'civicrm_event';
//create location block.
$locBlockId = CRM_Utils_Array::value('id', $location);
//update event record with location block id
$eventParams = array(
- 'id' => $eventId,
+ 'id' => $event['id'],
'loc_block_id' => $locBlockId,
);
CRM_Event_BAO_Event::add($eventParams);
);
//cleanup DB by deleting the record.
- Event::delete($eventId);
+ $this->eventDelete($event['id']);
$this->contactDelete($this->_contactId);
//Now check DB for Event
- $this->assertDBNull('CRM_Event_DAO_Event', $eventId, 'id', 'id',
+ $this->assertDBNull('CRM_Event_DAO_Event', $event['id'], 'id', 'id',
'Database check, Event deleted successfully.'
);
}
* get the values of various location elements
*/
public function testLocBlockgetValues() {
- $contactId = Contact::createIndividual();
+ $contactId = $this->individualCreate();
//create various element of location block
//like address, phone, email, openid, im.
* Add() method (create and update modes)
*/
public function testAdd() {
- $contactId = Contact::createIndividual();
+ $contactId = $this->individualCreate();
$this->assertDBRowExist('CRM_Contact_DAO_Contact', $contactId);
$openIdURL = "http://test-username.civicrm.org/";
* IfAllowedToLogin() method (set and reset allowed_to_login)
*/
public function testIfAllowedToLogin() {
- $contactId = Contact::createIndividual();
+ $contactId = $this->individualCreate();
$this->assertDBRowExist('CRM_Contact_DAO_Contact', $contactId);
$openIdURL = "http://test-username.civicrm.org/";
* AllOpenIDs() method - get all OpenIDs for the given contact
*/
public function testAllOpenIDs() {
- $contactId = Contact::createIndividual();
+ $contactId = $this->individualCreate();
$this->assertDBRowExist('CRM_Contact_DAO_Contact', $contactId);
// create first openid
* Add() method (create and update modes)
*/
public function testAdd() {
- $contactId = Contact::createIndividual();
+ $contactId = $this->individualCreate();
$params = array();
$params = array(
}
/**
- * AllPhones() method - get all Phones for our contact, with primary Phone first
+ * AllPhones() method - get all Phones for our contact, with primary Phone first.
*/
public function testAllPhones() {
$contactParams = array(
'first_name' => 'Alan',
'last_name' => 'Smith',
- 'phone-1' => '(415) 222-1011 x 221',
- 'phone-2' => '(415) 222-5432',
+ 'api.phone.create' => array('phone' => '(415) 222-1011 x 221', 'location_type_id' => 'Home'),
+ 'api.phone.create.1' => array('phone' => '(415) 222-5432', 'location_type_id' => 'Work'),
);
- $contactId = Contact::createIndividual($contactParams);
+ $contactId = $this->individualCreate($contactParams);
$Phones = CRM_Core_BAO_Phone::allPhones($contactId);
public function setUp() {
parent::setUp();
- $this->_contactId = Contact::createIndividual();
- $this->_eventId = Event::create($this->_contactId);
+ $this->_contactId = $this->individualCreate();
+ $event = $this->eventCreate();
+ $this->_eventId = $event['id'];
}
public function tearDown() {
public function setUp() {
parent::setUp();
- $this->_contactId = Contact::createIndividual();
- $this->_eventId = Event::create($this->_contactId);
+ $this->_contactId = $this->individualCreate();
+ $event = $this->eventCreate();
+ $this->_eventId = $event['id'];
}
/**
);
$this->contactDelete($this->_contactId);
- Event::delete($this->_eventId);
+ $this->eventDelete($this->_eventId);
}
/**
* GetValues() method (fetch value of participant)
*/
public function testgetValuesWithValidParams() {
- $participantId = Participant::create($this->_contactId, $this->_eventId);
+ $participantId = $this->participantCreate(array('contact_id' => $this->_contactId, 'event_id' => $this->_eventId));
$params = array('id' => $participantId);
$values = $ids = array();
'is_test' => 0,
'is_pay_later' => 0,
'event_id' => $this->_eventId,
- 'register_date' => date('Y-m-d') . " 00:00:00",
+ 'register_date' => '2007-02-19 00:00:00',
'role_id' => 1,
- 'status_id' => 1,
- 'source' => 'Event_' . $this->_eventId,
+ 'status_id' => 2,
+ 'source' => 'Wimbeldon',
'contact_id' => $this->_contactId,
'id' => $participantId,
'campaign_id' => NULL,
'discount_amount' => NULL,
'cart_id' => NULL,
'must_wait' => NULL,
- 'transferred_to_contact_id' => NULL, //CRM-16761
+ 'transferred_to_contact_id' => NULL,
);
foreach ($compareValues as $key => $value) {
}
}
- Participant::delete($participantId);
+ $this->participantDelete($participantId);
$this->contactDelete($this->_contactId);
- Event::delete($this->_eventId);
+ $this->eventDelete($this->_eventId);
}
/**
*/
public function testgetValuesWithoutValidParams() {
$params = $values = $ids = array();
- Participant::create($this->_contactId, $this->_eventId);
+ $this->participantCreate(array('contact_id' => $this->_contactId, 'event_id' => $this->_eventId));
$fetchParticipant = CRM_Event_BAO_Participant::getValues($params, $values, $ids);
$this->assertNull($fetchParticipant);
$this->contactDelete($this->_contactId);
- Event::delete($this->_eventId);
+ $this->eventDelete($this->_eventId);
}
/**
);
CRM_Event_BAO_Event::add($eventParams);
- $participantId = Participant::create($this->_contactId, $this->_eventId);
+ $participantId = $this->participantCreate(array('contact_id' => $this->_contactId, 'event_id' => $this->_eventId));
$eventFull = CRM_Event_BAO_Participant::eventFull($this->_eventId);
- $this->assertEquals($eventFull, 'This event is full.', 'Checking if Event is full.');
+ $this->assertEquals($eventFull, 'Sorry! We are already full', 'Checking if Event is full.');
- Participant::delete($participantId);
+ $this->participantDelete($participantId);
$this->contactDelete($this->_contactId);
- Event::delete($this->_eventId);
+ $this->eventDelete($this->_eventId);
}
/**
$this->assertNotEquals(count($importableFields), 0, 'Checking array not to be empty.');
$this->contactDelete($this->_contactId);
- Event::delete($this->_eventId);
+ $this->eventDelete($this->_eventId);
}
/**
* ParticipantDetails() method ( Checking the Participant Details )
*/
public function testparticipantDetails() {
- $participantId = Participant::create($this->_contactId, $this->_eventId);
- $params = array('name' => 'Doe, John', 'title' => 'Test Event');
+ $participant = $this->callAPISuccess('Participant', 'create', array('contact_id' => $this->_contactId, 'event_id' => $this->_eventId));
+ $params = array('name' => 'Anderson, Anthony', 'title' => 'Annual CiviCRM meet');
- $participantDetails = CRM_Event_BAO_Participant::participantDetails($participantId);
+ $participantDetails = CRM_Event_BAO_Participant::participantDetails($participant['id']);
$this->assertEquals(count($participantDetails), 3, 'Equating the array contains.');
$this->assertEquals($participantDetails['name'], $params['name'], 'Checking Name of Participant.');
$this->assertEquals($participantDetails['title'], $params['title'], 'Checking Event Title in which participant is enroled.');
- Participant::delete($participantId);
+ $this->participantDelete($participant['id']);
$this->contactDelete($this->_contactId);
- Event::delete($this->_eventId);
+ $this->eventDelete($this->_eventId);
}
/**
$this->assertDBNull('CRM_Event_BAO_Participant', $participant->id, 'contact_id', 'id', 'Check DB for deleted Participant.');
$this->contactDelete($this->_contactId);
- Event::delete($this->_eventId);
+ $this->eventDelete($this->_eventId);
}
/**
}
$params = array('event_id' => $this->_eventId, 'contact_id' => $this->_contactId);
- $checkDuplicate = CRM_Event_BAO_Participant::checkDuplicate($params, $duplicate);
+ CRM_Event_BAO_Participant::checkDuplicate($params, $duplicate);
$this->assertEquals(count($duplicate), 3, 'Equating the array contains with duplicate array.');
//Deleting all participant
for ($i = 0; $i < 3; $i++) {
- $partidel[] = Participant::delete($partiId[$i]);
+ $partidel[] = $this->participantDelete($partiId[$i]);
}
$this->contactDelete($this->_contactId);
- Event::delete($this->_eventId);
+ $this->eventDelete($this->_eventId);
}
/**
);
$this->contactDelete($this->_contactId);
- Event::delete($this->_eventId);
+ $this->eventDelete($this->_eventId);
}
/**
$this->assertNotEquals(count($exportableFields), 0, 'Checking array not to be empty.');
$this->contactDelete($this->_contactId);
- Event::delete($this->_eventId);
+ $this->eventDelete($this->_eventId);
}
/**
'id', 'Check DB for non-existence of Price Set.'
);
- Participant::delete($participant->id);
+ $this->participantDelete($participant->id);
$this->contactDelete($this->_contactId);
- Event::delete($eventId);
+ $this->eventDelete($eventId);
}
}
* Check method testcheckPermissionedLineItems()
*/
public function testcheckPermissionedLineItems() {
- $contactId = Contact::createIndividual();
+ $contactId = $this->individualCreate();
$paramsSet['title'] = 'Price Set' . substr(sha1(rand()), 0, 4);
$paramsSet['name'] = CRM_Utils_String::titleToVar($paramsSet['title']);
$paramsSet['is_active'] = TRUE;
* Test add()
*/
public function testadd() {
- $contactId = Contact::createIndividual();
+ $contactId = $this->individualCreate();
$params = array(
'contact_id' => $contactId,
* Test del()
*/
public function testdel() {
- $contactId = Contact::createIndividual();
+ $contactId = $this->individualCreate();
$params = array(
'contact_id' => $contactId,
* Test resetmodified()
*/
public function testresetmodifiedId() {
- $contactId = Contact::createIndividual();
+ $contactId = $this->individualCreate();
$params = array(
'contact_id' => $contactId,
public function testCreate() {
- $contactId = Contact::createIndividual();
+ $contactId = $this->individualCreate();
$params = array(
'contact_id' => $contactId,
$last_month = $now - (30 * 24 * 60 * 60);
$year_from_last_month = $last_month + (365 * 24 * 60 * 60);
- $contactId = Contact::createIndividual();
+ $contactId = $this->individualCreate();
$params = array(
'contact_id' => $contactId,
}
public function testRetrieve() {
- $contactId = Contact::createIndividual();
+ $contactId = $this->individualCreate();
$params = array(
'contact_id' => $contactId,
}
public function testActiveMembers() {
- $contactId = Contact::createIndividual();
+ $contactId = $this->individualCreate();
$params = array(
'contact_id' => $contactId,
}
public function testDeleteMembership() {
- $contactId = Contact::createIndividual();
+ $contactId = $this->individualCreate();
$params = array(
'contact_id' => $contactId,
}
public function testGetContactMembership() {
- $contactId = Contact::createIndividual();
+ $contactId = $this->individualCreate();
$params = array(
'contact_id' => $contactId,
* page id from the membership record
*/
public function testgetContributionPageId() {
- $contactId = Contact::createIndividual();
+ $contactId = $this->individualCreate();
$params = array(
'contact_id' => $contactId,
* type.
*/
public function testgetMembershipStarts() {
- $contactId = Contact::createIndividual();
+ $contactId = $this->individualCreate();
$params = array(
'contact_id' => $contactId,
* optionally for a specified date.
*/
public function testGetMembershipCount() {
- $contactId = Contact::createIndividual();
+ $contactId = $this->individualCreate();
$params = array(
'contact_id' => $contactId,