NB jenkins is doing wierd things here so trying a small subset to see what jenkins does
/**
- * Take sort name of contact during
- * Update multiple memberships
+ * Checkup sort name function.
*/
- public function testsortName() {
- $contactId = Contact::createIndividual();
+ public function testSortName() {
+ $contactId = $this->individualCreate();
$params = array(
'contact_id' => $contactId,
'membership_type_id' => $this->_membershipTypeID,
- 'join_date' => date('Ymd', strtotime('2006-01-21')),
- 'start_date' => date('Ymd', strtotime('2006-01-21')),
- 'end_date' => date('Ymd', strtotime('2006-12-21')),
+ 'join_date' => '2006-01-21',
+ 'start_date' => '2006-01-21',
+ 'end_date' => '2006-12-21',
'source' => 'Payment',
'is_override' => 1,
'status_id' => $this->_membershipStatusID,
);
- $ids = array();
-
- CRM_Member_BAO_Membership::create($params, $ids);
-
- $membershipId = $this->assertDBNotNull('CRM_Member_BAO_Membership', $contactId, 'id',
- 'contact_id', 'Database check for created membership.'
- );
- CRM_Member_BAO_Membership::sortName($membershipId);
+ $membership = $this->callAPISuccess('Membership', 'create', $params);
- $this->assertDBCompareValue('CRM_Contact_DAO_Contact', $contactId, 'sort_name', 'id', 'Doe, John',
- 'Database check for sort name record.'
- );
+ $this->assertEquals('Anderson, Anthony', CRM_Member_BAO_Membership::sortName($membership['id']));
- $this->membershipDelete($membershipId);
+ $this->membershipDelete($membership['id']);
$this->contactDelete($contactId);
}
* Delete related memberships.
*/
public function testdeleteRelatedMemberships() {
- $contactId = Contact::createIndividual();
+ $contactId = $this->individualCreate();
$params = array(
'contact_id' => $contactId,
* Renew membership with change in membership type.
*/
public function testRenewMembership() {
- $contactId = Contact::createIndividual();
+ $contactId = $this->individualCreate();
$joinDate = $startDate = date("Ymd", strtotime(date("Ymd") . " -6 month"));
$endDate = date("Ymd", strtotime($joinDate . " +1 year -1 day"));
$params = array(
*/
public function testStaleMembership() {
$statusId = 3;
- $contactId = Contact::createIndividual();
+ $contactId = $this->individualCreate();
$joinDate = $startDate = date("Ymd", strtotime(date("Ymd") . " -1 year -15 days"));
$endDate = date("Ymd", strtotime($joinDate . " +1 year -1 day"));
$params = array(
*/
protected function setUp() {
parent::setUp();
- $this->_contactId = Contact::createIndividual();
+ $this->_contactId = $this->individualCreate();
}
/**
* and redirect stdin to a temporary file
*/
public function setUp() {
- // Connect to the database
parent::setUp();
- require_once 'CiviTest/Contact.php';
-
- // lets create one contact of each type
- Contact::createIndividual();
- Contact::createHousehold();
- Contact::createOrganisation();
+ $this->individualCreate();
+ $this->householdCreate();
+ $this->organizationCreate();
}
public function tearDown() {
* Test Get Order api for participant contribution.
*/
public function testGetOrderParticipant() {
- $contribution = $this->addOrder(FALSE, 100);
+ $this->addOrder(FALSE, 100);
list($items, $contribution) = $this->createParticipantWithContribution();
$params = array(
}
/**
- * Function to assert db values
+ * Function to assert db values.
*/
public function checkPaymentResult($results, $expectedResult, $lineItems = NULL) {
foreach ($expectedResult[$results['id']] as $key => $value) {
}
/**
- * add order
+ * Add order.
*
* @param bool $isPriceSet
* @param float $amount
*
* @return array
*/
- public function addOrder($isPriceSet, $amount = 300, $extraParams = array()) {
+ public function addOrder($isPriceSet, $amount = 300.00, $extraParams = array()) {
$p = array(
'contact_id' => $this->_individualId,
'receive_date' => '2010-01-20',
* Test create order api for membership
*/
public function testAddOrderForMembership() {
- require_once 'CiviTest/Membership.php';
- $membership = new Membership();
- $membershipType = $membership->createMembershipType();
- $membershipType1 = $membership->createMembershipType();
- $membershipType = $membershipTypes = array($membershipType->id, $membershipType1->id);
+ $membershipType = $this->membershipTypeCreate();
+ $membershipType1 = $this->membershipTypeCreate();
+ $membershipType = $membershipTypes = array($membershipType, $membershipType1);
$p = array(
'contact_id' => $this->_individualId,
'receive_date' => '2010-01-20',
/**
* Test create order api for participant
*/
- public function testAddOrderForPariticipant() {
- require_once 'CiviTest/Event.php';
- $this->_eventId = Event::create($this->_individualId);
+ public function testAddOrderForParticipant() {
+ $event = $this->eventCreate();
+ $this->_eventId = $event['id'];
$p = array(
'contact_id' => $this->_individualId,
'receive_date' => '2010-01-20',
* Test cancel order api
*/
public function testCancelWithParticipant() {
- $this->_eventId = Event::create($this->_individualId);
+ $event = $this->eventCreate();
+ $this->_eventId = $event['id'];
$eventParams = array(
'id' => $this->_eventId,
'financial_type_id' => 4,