*
* (PHP 5)
*
- * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
- * @copyright Copyright CiviCRM LLC (C) 2009
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* GNU Affero General Public License version 3
- * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $
- * @package CiviCRM
+ * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Class containing all test suites
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class AllTests extends CiviTestSuite {
private static $instance = NULL;
*
* (PHP 5)
*
- * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
- * @copyright Copyright CiviCRM LLC (C) 2009
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* GNU Affero General Public License version 3
- * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $
- * @package CiviCRM
+ * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Class containing all test suites
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Activity_AllTests extends CiviTestSuite {
private static $instance = NULL;
/**
* Test class for CRM_Activity_BAO_ActivityAssignment BAO
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Activity_BAO_ActivityAssignmentTest extends CiviUnitTestCase {
* This method is called after a test is executed.
*
*/
- protected function tearDown() {}
+ protected function tearDown() {
+ }
/**
* Pass zero as an id and make sure no Assignees are retrieved
*/
public function testRetrieveAssigneeIdsByActivityIdNullId() {
$activity = $this->activityCreate();
- $activityId = CRM_Activity_BAO_ActivityAssignment::retrieveAssigneeIdsByActivityId(Null);
+ $activityId = CRM_Activity_BAO_ActivityAssignment::retrieveAssigneeIdsByActivityId(NULL);
$this->assertEquals(count($activityId), 0, '0 assignees retrieved using null');
}
*/
public function testGetAssigneeNamesNullId() {
$activity = $this->activityCreate();
- $assignees = CRM_Activity_BAO_ActivityAssignment::getAssigneeNames(Null);
+ $assignees = CRM_Activity_BAO_ActivityAssignment::getAssigneeNames(NULL);
$this->assertEquals(count($assignees), 0, '0 assignee names retrieved');
}
/**
* Test class for CRM_Activity_BAO_ActivityTarget BAO
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Activity_BAO_ActivityTargetTest extends CiviUnitTestCase {
* This method is called after a test is executed.
*
*/
- protected function tearDown() {}
+ protected function tearDown() {
+ }
public function testRetrieveTargetIdsByActivityIdZeroID() {
$activity = $this->activityCreate();
*
* (PHP 5)
*
- * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
- * @copyright Copyright CiviCRM LLC (C) 2009
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* GNU Affero General Public License version 3
- * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $
- * @package CiviCRM
+ * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Class containing all CRM test suites
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_AllTests extends CiviTestSuite {
private static $instance = NULL;
*
* (PHP 5)
*
- * @package CiviCRM
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Test CRM/Member/BAO Membership Log add , delete functions
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Batch_Form_EntryTest extends CiviUnitTestCase {
$result = $this->callAPISuccess('contribution', 'get', array('return' => 'total_amount'));
$this->assertEquals(2, $result['count']);
foreach($result['values'] as $contribution) {
- $this-> assertEquals($this->callAPISuccess('line_item', 'getvalue', array(
+ $this-> assertEquals($this->callAPISuccess('line_item', 'getvalue', array(
'contribution_id' => $contribution['id'],
'return' => 'line_total',
- )), $contribution['total_amount']);
+ )), $contribution['total_amount']);
}
}
/**
return array(
'batch_id' => 4,
'primary_profiles' => array(1 => NULL, 2 => NULL, 3 => NULL),
- 'primary_contact_id' => Array (
+ 'primary_contact_id' => array(
1 => $this->_contactID,
2 => $this->_contactID2,
3 => $this->_contactID3,
),
'field' => array(
1 => array(
- 'membership_type' => Array (0 => $this->_orgContactID, 1 => $this->_membershipTypeID),
+ 'membership_type' => array(0 => $this->_orgContactID, 1 => $this->_membershipTypeID),
'join_date' => '07/22/2013',
'membership_start_date' => NULL,
'membership_end_date' => NULL,
'contribution_status_id' => 1,
),
2 => array(
- 'membership_type' => Array (0 => $this->_orgContactID, 1 => $this->_membershipTypeID),
+ 'membership_type' => array(0 => $this->_orgContactID, 1 => $this->_membershipTypeID),
'join_date' => '07/03/2013',
'membership_start_date' => '02/03/2013',
'membership_end_date' => NULL,
),
// no join date, coded end date
3 => array(
- 'membership_type' => Array (0 => $this->_orgContactID, 1 => $this->_membershipTypeID),
+ 'membership_type' => array(0 => $this->_orgContactID, 1 => $this->_membershipTypeID),
'join_date' => NULL,
'membership_start_date' => NULL,
'membership_end_date' => '2013-12-01',
return array(
//'batch_id' => 4,
'primary_profiles' => array(1 => NULL, 2 => NULL, 3 => NULL),
- 'primary_contact_id' => Array (
+ 'primary_contact_id' => array(
1 => $this->_contactID,
2 => $this->_contactID2,
3 => $this->_contactID3,
*
* (PHP 5)
*
- * @copyright Copyright CiviCRM LLC (C) 2009
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* GNU Affero General Public License version 3
- * @package CiviCRM
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Test contact custom search functions
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Bridge_OG_DrupalTest extends CiviUnitTestCase {
/*
/**
* Class containing all test suites
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Case_AllTests extends CiviTestSuite {
private static $instance = NULL;
*
* (PHP 5)
*
- * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
- * @copyright Copyright CiviCRM LLC (C) 2009
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* GNU Affero General Public License version 3
- * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $
- * @package CiviCRM
+ * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Class containing all test suites
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Contacts_AllTests extends CiviTestSuite {
private static $instance = NULL;
* test with empty params.
*/
public function testAddWithEmptyParams() {
- $params = array( );
+ $params = array();
$contact = CRM_Contact_BAO_Contact::add($params);
//Now check Contact object
'location_type_id' => 1,
'is_primary' => 1,
);
- $compareParams = array('street_address' => CRM_Utils_Array::value('street_address', $params['address'][1]),
+ $compareParams = array(
+ 'street_address' => CRM_Utils_Array::value('street_address', $params['address'][1]),
'supplemental_address_1' => CRM_Utils_Array::value('supplemental_address_1',
$params['address'][1]
),
$this->assertDBCompareValues('CRM_Core_DAO_OpenID', $searchParams, $compareParams);
//Now check DB for IM
- $compareParams = array('name' => CRM_Utils_Array::value('name', $params['im'][1]),
+ $compareParams = array(
+ 'name' => CRM_Utils_Array::value('name', $params['im'][1]),
'provider_id' => CRM_Utils_Array::value('provider_id', $params['im'][1]),
);
$this->assertDBCompareValues('CRM_Core_DAO_IM', $searchParams, $compareParams);
//delete all notes related to contact
CRM_Core_BAO_Note::cleanContactNotes($contactId);
-
//cleanup DB by deleting the contact
Contact::delete($contactId);
$this->quickCleanup(array('civicrm_contact', 'civicrm_note'));
//delete all notes related to contact
CRM_Core_BAO_Note::cleanContactNotes($contactId);
-
//cleanup DB by deleting the contact
Contact::delete($contactId);
$this->quickCleanup(array('civicrm_contact'));
'id', 'openid', 'Database check, openId deleted successfully.'
);
-
// Check that the custom field value is no longer present
$params = array(
'entityID' => $contactId,
);
$dbPrefComm = explode(CRM_Core_DAO::VALUE_SEPARATOR,
- CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $contactId, 'preferred_communication_method', 'id', true)
+ CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $contactId, 'preferred_communication_method', 'id', TRUE)
);
$checkPrefComm = array();
foreach ($dbPrefComm as $key => $value) {
'location_type_id' => 1,
'is_primary' => 1,
);
- $compareParams = array('street_address' => CRM_Utils_Array::value('street_address-Primary', $profileParams),
+ $compareParams = array(
+ 'street_address' => CRM_Utils_Array::value('street_address-Primary', $profileParams),
'supplemental_address_1' => CRM_Utils_Array::value('supplemental_address_1-Primary', $profileParams),
'supplemental_address_2' => CRM_Utils_Array::value('supplemental_address_2-Primary', $profileParams),
'city' => CRM_Utils_Array::value('city-Primary', $profileParams),
$this->assertDBCompareValues('CRM_Core_DAO_Email', $searchParams, $compareParams);
//Now check DB for IM
- $compareParams = array('name' => CRM_Utils_Array::value('im-Primary', $profileParams),
+ $compareParams = array(
+ 'name' => CRM_Utils_Array::value('im-Primary', $profileParams),
'provider_id' => CRM_Utils_Array::value('im-Primary-provider_id', $profileParams),
);
$this->assertDBCompareValues('CRM_Core_DAO_IM', $searchParams, $compareParams);
);
$dbPrefComm = explode(CRM_Core_DAO::VALUE_SEPARATOR,
- CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $contactId, 'preferred_communication_method', 'id', true)
+ CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $contactId, 'preferred_communication_method', 'id', TRUE)
);
$checkPrefComm = array();
foreach ($dbPrefComm as $key => $value) {
'location_type_id' => 1,
'is_primary' => 1,
);
- $compareParams = array('street_address' => CRM_Utils_Array::value('street_address-Primary', $updatePfParams),
+ $compareParams = array(
+ 'street_address' => CRM_Utils_Array::value('street_address-Primary', $updatePfParams),
'supplemental_address_1' => CRM_Utils_Array::value('supplemental_address_1-Primary', $updatePfParams),
'supplemental_address_2' => CRM_Utils_Array::value('supplemental_address_2-Primary', $updatePfParams),
'city' => CRM_Utils_Array::value('city-Primary', $updatePfParams),
$this->assertDBCompareValues('CRM_Core_DAO_Email', $searchParams, $compareParams);
//Now check DB for IM
- $compareParams = array('name' => CRM_Utils_Array::value('im-Primary', $updatePfParams),
+ $compareParams = array(
+ 'name' => CRM_Utils_Array::value('im-Primary', $updatePfParams),
'provider_id' => CRM_Utils_Array::value('im-Primary-provider_id', $updatePfParams),
);
$this->assertDBCompareValues('CRM_Core_DAO_IM', $searchParams, $compareParams);
'email' => 'john.smith@example.org',
);
-
$params['phone'] = array();
$params['phone'][1] = array(
'location_type_id' => 1,
public function testTimestamps_contact() {
$test = $this;
$this->_testTimestamps(array(
- 'UPDATE' => function ($contactId) use ($test) {
- $params = array(
+ 'UPDATE' => function ($contactId) use ($test) {
+ $params = array(
'first_name' => 'Testing',
'contact_type' => 'Individual',
'contact_id' => $contactId,
);
- $contact = CRM_Contact_BAO_Contact::add($params);
- $test->assertInstanceOf('CRM_Contact_DAO_Contact', $contact, 'Check for created object');
- },
+ $contact = CRM_Contact_BAO_Contact::add($params);
+ $test->assertInstanceOf('CRM_Contact_DAO_Contact', $contact, 'Check for created object');
+ },
));
}
public function testTimestamps_email() {
$test = $this;
$this->_testTimestamps(array(
- 'INSERT' => function ($contactId) use ($test) {
- $params = array(
+ 'INSERT' => function ($contactId) use ($test) {
+ $params = array(
'email' => 'ex-1@example.com',
'is_primary' => 1,
'location_type_id' => 1,
'contact_id' => $contactId,
);
- CRM_Core_BAO_Email::add($params);
- $test->assertDBQuery('ex-1@example.com',
+ CRM_Core_BAO_Email::add($params);
+ $test->assertDBQuery('ex-1@example.com',
'SELECT email FROM civicrm_email WHERE contact_id = %1 ORDER BY id DESC LIMIT 1',
array(1 => array($contactId, 'Integer'))
);
- },
+ },
- 'UPDATE' => function ($contactId) use ($test) {
- CRM_Core_DAO::executeQuery(
+ 'UPDATE' => function ($contactId) use ($test) {
+ CRM_Core_DAO::executeQuery(
'UPDATE civicrm_email SET email = "ex-2@example.com" WHERE contact_id = %1',
array(1 => array($contactId, 'Integer'))
);
- },
+ },
- 'DELETE' => function ($contactId) use ($test) {
- CRM_Core_DAO::executeQuery(
+ 'DELETE' => function ($contactId) use ($test) {
+ CRM_Core_DAO::executeQuery(
'DELETE FROM civicrm_email WHERE contact_id = %1',
array(1 => array($contactId, 'Integer'))
);
- },
+ },
));
}
public function testTimestamps_phone() {
$test = $this;
$this->_testTimestamps(array(
- 'INSERT' => function ($contactId) use ($test) {
- $params = array(
+ 'INSERT' => function ($contactId) use ($test) {
+ $params = array(
'phone' => '202-555-1000',
'is_primary' => 1,
'location_type_id' => 1,
'contact_id' => $contactId,
);
- CRM_Core_BAO_Phone::add($params);
- $test->assertDBQuery('202-555-1000',
+ CRM_Core_BAO_Phone::add($params);
+ $test->assertDBQuery('202-555-1000',
'SELECT phone FROM civicrm_phone WHERE contact_id = %1 ORDER BY id DESC LIMIT 1',
array(1 => array($contactId, 'Integer'))
);
- },
+ },
- 'UPDATE' => function ($contactId) use ($test) {
- CRM_Core_DAO::executeQuery(
+ 'UPDATE' => function ($contactId) use ($test) {
+ CRM_Core_DAO::executeQuery(
'UPDATE civicrm_phone SET phone = "202-555-2000" WHERE contact_id = %1',
array(1 => array($contactId, 'Integer'))
);
- },
+ },
- 'DELETE' => function ($contactId) use ($test) {
- CRM_Core_DAO::executeQuery(
+ 'DELETE' => function ($contactId) use ($test) {
+ CRM_Core_DAO::executeQuery(
'DELETE FROM civicrm_phone WHERE contact_id = %1',
array(1 => array($contactId, 'Integer'))
);
- },
+ },
));
}
$customField = $customField['values'][$customField['id']];
$test = $this;
$this->_testTimestamps(array(
- 'INSERT' => function ($contactId) use ($test, $customGroup, $customField) {
- $result = civicrm_api3('contact', 'create', array(
+ 'INSERT' => function ($contactId) use ($test, $customGroup, $customField) {
+ $result = civicrm_api3('contact', 'create', array(
'contact_id' => $contactId,
'custom_' . $customField['id'] => 'test-1',
));
- },
- 'UPDATE' => function ($contactId) use ($test, $customGroup, $customField) {
- CRM_Core_DAO::executeQuery(
+ },
+ 'UPDATE' => function ($contactId) use ($test, $customGroup, $customField) {
+ CRM_Core_DAO::executeQuery(
"UPDATE {$customGroup->table_name} SET {$customField['column_name']} = 'test-2' WHERE entity_id = %1",
array(1 => array($contactId, 'Integer'))
);
- },
- 'DELETE' => function ($contactId) use ($test, $customGroup, $customField) {
- CRM_Core_DAO::executeQuery(
+ },
+ 'DELETE' => function ($contactId) use ($test, $customGroup, $customField) {
+ CRM_Core_DAO::executeQuery(
"DELETE FROM {$customGroup->table_name} WHERE entity_id = %1",
array(1 => array($contactId, 'Integer'))
);
- },
+ },
));
Custom::deleteGroup($customGroup);
$result = CRM_Contact_BAO_ContactType::add($params);
$this->sponsor = $params['name'];
-
$this->indiviParams = array(
'first_name' => 'Anne',
'last_name' => 'Grant',
$result = civicrm_api('contact', 'get', $params);
$this->assertEquals(empty($result['values']), TRUE, 'In line ' . __LINE__);
-
// for invalid subtype
$params = array('contact_sub_type' => 'Invalid', 'version' => 3);
$result = civicrm_api('contact', 'get', $params);
$this->assertEquals(empty($result['values']), TRUE, 'In line ' . __LINE__);
-
// for invalid contact type as well as subtype
$params = array('contact_type' => 'Invalid' . CRM_Core_DAO::VALUE_SEPARATOR . 'Invalid', 'version' => 3);
$result = civicrm_api('contact', 'get', $params);
$this->assertEquals(empty($result['values']), TRUE, 'In line ' . __LINE__);
-
// for valid type and invalid subtype
$params = array('contact_type' => 'Individual' . CRM_Core_DAO::VALUE_SEPARATOR . 'Invalid', 'version' => 3);
$result = civicrm_api('contact', 'get', $params);
$this->assertEquals(empty($result['values']), TRUE, 'In line ' . __LINE__);
-
// for invalid type and valid subtype
$params = array('contact_type' => 'Invalid' . CRM_Core_DAO::VALUE_SEPARATOR . 'indivi_student', 'version' => 3);
$result = civicrm_api('contact', 'get', $params);
$result = civicrm_api('contact', 'get', $params, $defaults);
$this->assertEquals(empty($result['values']), TRUE, 'In line ' . __LINE__);
-
// for type:Household subtype:Sponsor
$params = array('contact_type' => 'Household' . CRM_Core_DAO::VALUE_SEPARATOR . $this->sponsor, 'version' => 3);
$result = civicrm_api('contact', 'get', $params, $defaults);
$this->assertEquals(empty($result['values']), TRUE, 'In line ' . __LINE__);
-
// for type:Household subtype:Student
$params = array('contact_type' => 'Household' . CRM_Core_DAO::VALUE_SEPARATOR . $this->student, 'version' => 3);
$result = civicrm_api('contact', 'get', $params, $defaults);
$result = CRM_Contact_BAO_ContactType::add($params);
$this->parent = $params['name'];
-
$params = array(
'label' => 'org_sponsor',
'name' => 'org_sponsor',
$this->assertEquals(str_replace(CRM_Core_DAO::VALUE_SEPARATOR, '', $updatedContact->contact_sub_type), $this->parent, 'In line ' . __LINE__);
CRM_Contact_BAO_Contact::deleteContact($contact->id);
-
$params = array(
'organization_name' => 'Compumentor',
'contact_type' => 'Organization',
$this->assertEquals(str_replace(CRM_Core_DAO::VALUE_SEPARATOR, '', $updatedContact->contact_sub_type), $this->team, 'In line ' . __LINE__);
CRM_Contact_BAO_Contact::deleteContact($contact->id);
-
$params = array(
'first_name' => 'Anne',
'last_name' => 'Grant',
/**
* Test class for CRM_Contact_BAO_GroupContact BAO
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Contact_BAO_GroupContactCacheTest extends CiviUnitTestCase {
*
* @see CRM_Core_DAO::createTestObject
*/
- function createTestObject($daoName, $params = array(
- ), $numObjects = 1, $createOnly = FALSE) {
+ function createTestObject($daoName, $params = array(), $numObjects = 1, $createOnly = FALSE) {
$objects = CRM_Core_DAO::createTestObject($daoName, $params, $numObjects, $createOnly);
if (is_array($objects)) {
$this->registerTestObjects($objects);
/**
* Test class for CRM_Contact_BAO_GroupContact BAO
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Contact_BAO_GroupContactTest extends CiviUnitTestCase {
* This method is called after a test is executed.
*
*/
- protected function tearDown() {}
+ protected function tearDown() {
+ }
/**
* Test case for add( )
$groupContacts = CRM_Core_DAO::createTestObject('CRM_Contact_DAO_GroupContact', NULL, 10);
//check the group contact id is not null for each of them
- foreach ($groupContacts as $gc) $this->assertNotNull($gc->id);
+ foreach ($groupContacts as $gc) { $this->assertNotNull($gc->id);
+ }
//cleanup
- foreach ($groupContacts as $gc) $gc->deleteTestObjects('CRM_Contact_DAO_GroupContact');
+ foreach ($groupContacts as $gc) { $gc->deleteTestObjects('CRM_Contact_DAO_GroupContact');
+ }
}
/**
*/
public function testGetGroupId() {
-
//creates a test groupContact object
//force group_id to 1 so we can compare
$groupContact = CRM_Core_DAO::createTestObject('CRM_Contact_DAO_GroupContact');
/**
* Test class for CRM_Contact_BAO_Group BAO
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Contact_BAO_GroupTest extends CiviUnitTestCase {
/**
* Test CRM_Contact_BAO_Query::searchQuery()
- * @dataProvider dataProvider
+ * @dataProvider dataProvider
*/
public function testSearch($fv, $count, $ids, $full) {
$op = new PHPUnit_Extensions_Database_Operation_Insert();
public function testSearchProfileHomeCityCRM14263() {
$contactID = $this->individualCreate();
CRM_Core_Config::singleton()->defaultSearchProfileID = 1;
- $this->callAPISuccess('address', 'create', array('contact_id' => $contactID, 'city' => 'Cool City', 'location_type_id' => 1,));
+ $this->callAPISuccess('address', 'create', array('contact_id' => $contactID, 'city' => 'Cool City', 'location_type_id' => 1));
$params = array(
0 => array(
0 => 'city-1',
public function testSearchProfileHomeCityNoResultsCRM14263() {
$contactID = $this->individualCreate();
CRM_Core_Config::singleton()->defaultSearchProfileID = 1;
- $this->callAPISuccess('address', 'create', array('contact_id' => $contactID, 'city' => 'Cool City', 'location_type_id' => 1,));
+ $this->callAPISuccess('address', 'create', array('contact_id' => $contactID, 'city' => 'Cool City', 'location_type_id' => 1));
$params = array(
0 => array(
0 => 'city-1',
}
}
- /**
- * CRM-14263 search builder failure with search profile & address in criteria
- * We are retrieving primary here - checking the actual sql seems super prescriptive - but since the massive query object has
- * so few tests detecting any change seems good here :-)
- */
- public function testSearchProfilePrimaryCityCRM14263()
+ /**
+ * CRM-14263 search builder failure with search profile & address in criteria
+ * We are retrieving primary here - checking the actual sql seems super prescriptive - but since the massive query object has
+ * so few tests detecting any change seems good here :-)
+ */
+ public function testSearchProfilePrimaryCityCRM14263()
{
- $contactID = $this->individualCreate();
- CRM_Core_Config::singleton()->defaultSearchProfileID = 1;
- $this->callAPISuccess('address', 'create', array('contact_id' => $contactID, 'city' => 'Cool City', 'location_type_id' => 1,));
- $params = array(
+ $contactID = $this->individualCreate();
+ CRM_Core_Config::singleton()->defaultSearchProfileID = 1;
+ $this->callAPISuccess('address', 'create', array('contact_id' => $contactID, 'city' => 'Cool City', 'location_type_id' => 1));
+ $params = array(
0 => array(
0 => 'city',
1 => '=',
4 => 0,
)
);
- $returnProperties = array(
+ $returnProperties = array(
'contact_type' => 1,
'contact_sub_type' => 1,
'sort_name' => 1,
);
- $expectedSQL = "SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, contact_a.contact_sub_type as `contact_sub_type`, contact_a.sort_name as `sort_name`, civicrm_address.id as address_id, civicrm_address.city as `city` FROM civicrm_contact contact_a LEFT JOIN civicrm_address ON ( contact_a.id = civicrm_address.contact_id AND civicrm_address.is_primary = 1 ) WHERE ( ( LOWER(civicrm_address.city) = 'cool city' ) ) AND (contact_a.is_deleted = 0) ORDER BY contact_a.sort_name asc, contact_a.id ";
- $queryObj = new CRM_Contact_BAO_Query($params, $returnProperties);
- try {
- $this->assertEquals($expectedSQL ,$queryObj->searchQuery(0, 0, NULL,
+ $expectedSQL = "SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, contact_a.contact_sub_type as `contact_sub_type`, contact_a.sort_name as `sort_name`, civicrm_address.id as address_id, civicrm_address.city as `city` FROM civicrm_contact contact_a LEFT JOIN civicrm_address ON ( contact_a.id = civicrm_address.contact_id AND civicrm_address.is_primary = 1 ) WHERE ( ( LOWER(civicrm_address.city) = 'cool city' ) ) AND (contact_a.is_deleted = 0) ORDER BY contact_a.sort_name asc, contact_a.id ";
+ $queryObj = new CRM_Contact_BAO_Query($params, $returnProperties);
+ try {
+ $this->assertEquals($expectedSQL, $queryObj->searchQuery(0, 0, NULL,
FALSE, FALSE,
FALSE, FALSE,
TRUE));
- }
- catch (PEAR_Exception $e) {
- $err = $e->getCause();
- $this->fail('invalid SQL created' . $e->getMessage() . " " . $err->userinfo);
+ }
+ catch (PEAR_Exception $e) {
+ $err = $e->getCause();
+ $this->fail('invalid SQL created' . $e->getMessage() . " " . $err->userinfo);
- }
}
+ }
}
*
* (PHP 5)
*
- * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
- * @copyright Copyright CiviCRM LLC (C) 2009
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* GNU Affero General Public License version 3
- * @version $Id: GroupTestDataProvider.php 23715 2009-09-21 06:35:47Z shot $
- * @package CiviCRM
+ * @version $Id: GroupTestDataProvider.php 23715 2009-09-21 06:35:47Z shot $
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Provide data to the CRM_Contact_BAO_QueryTest class
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Contact_BAO_QueryTestDataProvider implements Iterator {
/**
- * @var integer
+ * @var integer
*/
private $i = 0;
/**
- * @var mixed[]
+ * @var mixed[]
* This dataset describes various form values and what contact
* IDs should be selected when the form values are applied to the
* database in dataset.xml
*
* (PHP 5)
*
- * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
- * @copyright Copyright CiviCRM LLC (C) 2009
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* GNU Affero General Public License version 3
- * @package CiviCRM
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Test contact custom search functions
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Contact_Form_Search_Custom_GroupTest extends CiviUnitTestCase {
protected $_tablesToTruncate = array(
parent::setUp();
}
- public function tearDown() {}
+ public function tearDown() {
+ }
/**
* Test CRM_Contact_Form_Search_Custom_Group::count()
- * @dataProvider dataProvider
+ * @dataProvider dataProvider
*/
public function testCount($fv, $count, $ids, $full) {
$this->foreignKeyChecksOff();
$dao = CRM_Core_DAO::executeQuery($sql);
/**
- echo "Count: $count, OBJ: ", $obj->count( ) . "\n";
- while ( $dao->fetch( ) ) {
- echo "{$dao->contact_id}, {$dao->contact_type}, {$dao->sort_name}, {$dao->group_names}\n";
- }
+ echo "Count: $count, OBJ: ", $obj->count( ) . "\n";
+ while ( $dao->fetch( ) ) {
+ echo "{$dao->contact_id}, {$dao->contact_type}, {$dao->sort_name}, {$dao->group_names}\n";
+ }
**/
$this->assertEquals($count, $obj->count(),
'In line ' . __LINE__
/**
* Test CRM_Contact_Form_Search_Custom_Group::all()
- * @dataProvider dataProvider
+ * @dataProvider dataProvider
*/
public function testAll($fv, $count, $ids, $full) {
// Truncate affected tables
/**
* Test CRM_Contact_Form_Search_Custom_Group::contactIDs()
- * @dataProvider dataProvider
+ * @dataProvider dataProvider
*/
public function testContactIDs($fv, $count, $ids, $full) {
// Truncate affected tables
/**
* Test CRM_Contact_Form_Search_Custom_Group::from()
- * @todo write this test
+ * @todo write this test
*/
- public function SKIPPED_testFrom() {}
+ public function SKIPPED_testFrom() {
+ }
/**
* Test CRM_Contact_Form_Search_Custom_Group::summary()
*
* (PHP 5)
*
- * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
- * @copyright Copyright CiviCRM LLC (C) 2009
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* GNU Affero General Public License version 3
- * @version $Id: GroupTestDataProvider.php 44314 2012-12-19 11:12:49Z kurund $
- * @package CiviCRM
+ * @version $Id: GroupTestDataProvider.php 44314 2012-12-19 11:12:49Z kurund $
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Provide data to the CRM_Contact_Form_Search_Custom_GroupTest class
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Contact_Form_Search_Custom_GroupTestDataProvider implements Iterator {
/**
- * @var integer
+ * @var integer
*/
private $i = 0;
/**
- * @var mixed[]
+ * @var mixed[]
* This dataset describes various form values and what contact
* IDs should be selected when the form values are applied to the
* database in dataset.xml
*/
private $dataset = array(
// Exclude static group 3
- array('fv' => array('excludeGroups' => array('3')),
+ array(
+ 'fv' => array('excludeGroups' => array('3')),
'id' => array(
'9', '10', '11', '12', '13', '14',
'15', '16', '26',
),
),
// Include static group 3
- array('fv' => array('includeGroups' => array('3')),
+ array(
+ 'fv' => array('includeGroups' => array('3')),
'id' => array(
'17', '18', '19', '20', '21',
'22', '23', '24', '27', '28',
),
),
// Include static group 5
- array('fv' => array('includeGroups' => array('5')),
+ array(
+ 'fv' => array('includeGroups' => array('5')),
'id' => array(
'13', '14', '15', '16', '21',
'22', '23', '24',
),
),
// Include static groups 3 and 5
- array('fv' => array('includeGroups' => array('3', '5')),
+ array(
+ 'fv' => array('includeGroups' => array('3', '5')),
'id' => array(
'13', '14', '15', '16', '17', '18',
'19', '20', '21', '22', '23', '24',
),
),
// Include static group 3, exclude static group 5
- array('fv' => array('includeGroups' => array('3'),
+ array(
+ 'fv' => array(
+ 'includeGroups' => array('3'),
'excludeGroups' => array('5'),
),
'id' => array('17', '18', '19', '20', '27', '28'),
),
// Exclude tag 7
- array('fv' => array('excludeTags' => array('7')),
+ array(
+ 'fv' => array('excludeTags' => array('7')),
'id' => array(
'9', '10', '13', '14', '17', '18',
'21', '22', '27',
),
),
// Include tag 7
- array('fv' => array('includeTags' => array('7')),
+ array(
+ 'fv' => array('includeTags' => array('7')),
'id' => array(
'11', '12', '15', '16', '19',
'20', '23', '24', '26', '28',
),
),
// Include tag 9
- array('fv' => array('includeTags' => array('9')),
+ array(
+ 'fv' => array('includeTags' => array('9')),
'id' => array(
'10', '12', '14', '16', '18',
'20', '22', '24',
),
),
// Include tags 7 and 9
- array('fv' => array('includeTags' => array('7', '9')),
+ array(
+ 'fv' => array('includeTags' => array('7', '9')),
'id' => array(
'10', '11', '12', '14', '15', '16',
'18', '19', '20', '22', '23', '24',
),
),
// Include tag 7, exclude tag 9
- array('fv' => array('includeTags' => array('7'),
+ array(
+ 'fv' => array(
+ 'includeTags' => array('7'),
'excludeTags' => array('9'),
),
'id' => array('11', '15', '19', '23', '26', '28'),
'id' => array('19', '20', '23', '24', '28'),
),
// Include static group 3, exclude tag 7
- array('fv' => array('includeGroups' => array('3'),
+ array(
+ 'fv' => array(
+ 'includeGroups' => array('3'),
'excludeTags' => array('7'),
),
'id' => array('17', '18', '21', '22', '27'),
),
// Include tag 9, exclude static group 5
- array('fv' => array('includeTags' => array('9'),
+ array(
+ 'fv' => array(
+ 'includeTags' => array('9'),
'excludeGroups' => array('5'),
),
- 'id' => array('10','12','18','20'),
+ 'id' => array('10', '12', '18', '20'),
),
// Exclude tag 9, exclude static group 5
- array('fv' => array('excludeTags' => array('9'),
+ array(
+ 'fv' => array(
+ 'excludeTags' => array('9'),
'excludeGroups' => array('5'),
),
'id' => array(
),
),
// Include smart group 6
- array('fv' => array('includeGroups' => array('6')),
+ array(
+ 'fv' => array('includeGroups' => array('6')),
'id' => array(
'9', '10', '11', '12', '13', '14',
'15', '16', '26',
),
),
// Include smart group 4
- array('fv' => array('includeGroups' => array('4')),
+ array(
+ 'fv' => array('includeGroups' => array('4')),
'id' => array(
'17', '18', '19', '20', '21',
'22', '23', '24', '27', '28',
),
),
// Include smart group 4 and static group 5
- array('fv' => array('includeGroups' => array('4', '5')),
+ array(
+ 'fv' => array('includeGroups' => array('4', '5')),
'id' => array(
'13', '14', '15', '16', '17', '18',
'19', '20', '21', '22', '23', '24',
*
* (PHP 5)
*
- * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
- * @copyright Copyright CiviCRM LLC (C) 2009
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* GNU Affero General Public License version 3
- * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $
- * @package CiviCRM
+ * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Class containing all test suites
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Contribute_AllTests extends CiviTestSuite {
private static $instance = NULL;
'is_credit_card_only' => '',
);
-
$contributionpage = CRM_Contribute_BAO_ContributionPage::create($params);
$this->assertNotNull($contributionpage->id);
$id = $contributionpage->id;
$is_active = 1;
$pageActive = CRM_Contribute_BAO_ContributionPage::setIsActive($id, $is_active);
- $this->assertEquals($pageActive, true, 'Verify financial types record deletion.');
+ $this->assertEquals($pageActive, TRUE, 'Verify financial types record deletion.');
ContributionPage::delete($contributionpage->id);
}
'is_credit_card_only' => '',
);
-
$contributionpage = CRM_Contribute_BAO_ContributionPage::create($params);
$copycontributionpage = CRM_Contribute_BAO_ContributionPage::copy($contributionpage->id);
$this->assertEquals($copycontributionpage->financial_type_id, $this->_financialTypeID, 'Check for Financial type id.');
'thankyou_date' => '20080522',
);
-
$params['custom'] = array(
$customField->id => array(
-1 => array(
),
);
-
$contribution = CRM_Contribute_BAO_Contribution::create($params, $ids);
// Check that the custom field value is saved
$annual = CRM_Contribute_BAO_Contribution::annual($contactId);
$config = CRM_Core_Config::singleton();
- $currencySymbol = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_Currency',$config->defaultCurrency,'symbol','name') ;
+ $currencySymbol = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_Currency', $config->defaultCurrency, 'symbol', 'name');
$this->assertDBCompareValue('CRM_Contribute_DAO_Contribution', $id, 'total_amount',
'id', ltrim($annual[2], $currencySymbol), 'Check DB for total amount of the contribution'
);
'premium' => NULL,
);
-
$params = array(
'name' => 'TEST Premium',
'sku' => 111,
*
* (PHP 5)
*
- * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
- * @copyright Copyright CiviCRM LLC (C) 2009
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* GNU Affero General Public License version 3
- * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $
- * @package CiviCRM
+ * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Class containing all test suites
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Core_AllTests extends CiviTestSuite {
private static $instance = NULL;
parent::setUp();
require_once 'CiviTest/CiviMailUtils.php';
- $this->mut = new CiviMailUtils($this, true);
+ $this->mut = new CiviMailUtils($this, TRUE);
$this->fixtures['rolling_membership'] = array( // createTestObject
'membership_type_id' => array(
$activity = $this->createTestObject('CRM_Activity_DAO_Activity', $this->fixtures['phonecall']);
$this->assertTrue(is_numeric($activity->id));
- $contact = $this->callAPISuccess('contact', 'create', $this->fixtures['contact']);
+ $contact = $this->callAPISuccess('contact', 'create', $this->fixtures['contact']);
$activity->save();
$source['contact_id'] = $contact['id'];
$activity = $this->createTestObject('CRM_Activity_DAO_Activity', $this->fixtures['phonecall']);
$this->assertTrue(is_numeric($activity->id));
- $contact = $this->callAPISuccess('contact', 'create', $this->fixtures['contact']);
+ $contact = $this->callAPISuccess('contact', 'create', $this->fixtures['contact']);
$activity->save();
$source['contact_id'] = $contact['id'];
$source['activity_id'] = $activity->id;
- $source['record_type_id'] =2;
+ $source['record_type_id'] = 2;
$activityContact = $this->createTestObject('CRM_Activity_DAO_ActivityContact', $source);
$activityContact->save();
/**
- * For contacts/members which match schedule based on end date,
- * an email should be sent.
- */
+ * For contacts/members which match schedule based on end date,
+ * an email should be sent.
+ */
public function testMembershipEndDate_NoMatch() {
// creates membership with end_date = 20120615
$membership = $this->createTestObject('CRM_Member_DAO_Membership', array_merge($this->fixtures['rolling_membership_past'], array('status_id' => 3)));
$this->assertTrue(is_numeric($membership->id));
- $result = $this->callAPISuccess('Email', 'create', array(
+ $result = $this->callAPISuccess('Email', 'create', array(
'contact_id' => $membership->contact_id,
'email' => 'test-member@example.com',
));
}
public function testContactBirthDate_Anniv() {
- $contact = $this->callAPISuccess('Contact', 'create', $this->fixtures['contact_birthdate']);
+ $contact = $this->callAPISuccess('Contact', 'create', $this->fixtures['contact_birthdate']);
$this->_testObjects['CRM_Contact_DAO_Contact'][] = $contact['id'];
$actionSchedule = $this->fixtures['sched_contact_bday_anniv'];
$actionScheduleDao = CRM_Core_BAO_ActionSchedule::add($actionSchedule);
'name' => 'test_group',
'extends' => array('Individual'),
'style' => 'Inline',
- 'is_multiple' => false,
+ 'is_multiple' => FALSE,
'is_active' => 1,
);
$createGroup = $this->callAPISuccess('custom_group', 'create', $group);
'recipients' => array(array('test-member@example.com')),
),
));
- $this->callAPISuccess('custom_group', 'delete', array('id' => $createGroup['id'],));
+ $this->callAPISuccess('custom_group', 'delete', array('id' => $createGroup['id']));
}
/**
* Check that limit_to + an empty recipients doesn't sent to multiple contacts
'name' => 'test_group_now',
'extends' => array('Individual'),
'style' => 'Inline',
- 'is_multiple' => false,
+ 'is_multiple' => FALSE,
'is_active' => 1,
);
$createGroup = $this->callAPISuccess('custom_group', 'create', $group);
'recipients' => array(array('test-member@example.com')),
),
));
- $this->callAPISuccess('custom_group', 'delete', array('id' => $createGroup['id'],));
+ $this->callAPISuccess('custom_group', 'delete', array('id' => $createGroup['id']));
}
// TODO // function testMembershipEndDate_NonMatch() { }
*
* @see CRM_Core_DAO::createTestObject
*/
- function createTestObject($daoName, $params = array(
- ), $numObjects = 1, $createOnly = FALSE) {
+ function createTestObject($daoName, $params = array(), $numObjects = 1, $createOnly = FALSE) {
$objects = CRM_Core_DAO::createTestObject($daoName, $params, $numObjects, $createOnly);
if (is_array($objects)) {
$this->registerTestObjects($objects);
$params['contact_id'] = $contactId;
-
$fixAddress = TRUE;
CRM_Core_BAO_Address::create($params, $fixAddress, $entity = NULL);
);
$params['contact_id'] = $contactId;
-
$block = CRM_Core_BAO_Address::create($params, $fixAddress, $entity = NULL);
$cid = $this->assertDBNotNull('CRM_Core_DAO_Address', $contactId, 'id', 'contact_id',
//$this->assertEquals( 'testFld1', $getCustomFields[$customFieldID1][0], 'Confirm First Custom field label' );
//$this->assertEquals( 'testFld2', $getCustomFields[$customFieldID2][0], 'Confirm Second Custom field label' );
-
Custom::deleteGroup($customGroup);
}
)),
);
$fields = array(
- 'countryA' => Custom::createField(array(
- ), array(
+ 'countryA' => Custom::createField(array(), array(
'groupId' => $groups['A']->id,
'label' => 'Country A',
'dataType' => 'Country',
'htmlType' => 'Select Country',
)),
- 'countryB' => Custom::createField(array(
- ), array(
+ 'countryB' => Custom::createField(array(), array(
'groupId' => $groups['A']->id,
'label' => 'Country B',
'dataType' => 'Country',
'htmlType' => 'Select Country',
)),
- 'countryC' => Custom::createField(array(
- ), array(
+ 'countryC' => Custom::createField(array(), array(
'groupId' => $groups['B']->id,
'label' => 'Country C',
'dataType' => 'Country',
'version' => 3,
);
-
$customGroup = Custom::createGroup($groupParams);
$activeGroup = CRM_Core_BAO_CustomGroup::getActiveGroups('Individual', 'civicrm/contact/view/cd', $contactId);
foreach ($activeGroup as $key => $value) {
);
$errorScope = CRM_Core_TemporaryErrorScope::useException();
- $message = null;
+ $message = NULL;
try {
$result = CRM_Core_BAO_CustomValueTable::setValues($params);
} catch ( Exception $e ) {
'Verify that the boolean value is stored for contact ' . $contactID
);
-
// Now set YesNo radio to an invalid boolean value and try to reset
$badYesNo = '20';
$params = array(
);
$errorScope = CRM_Core_TemporaryErrorScope::useException();
- $message = null;
+ $message = NULL;
try {
$result = CRM_Core_BAO_CustomValueTable::setValues($params);
} catch (Exception $e) {
'Int' => 1,
'Float' => 10.00,
'Date' => '2008-06-24',
- 'Boolean' => True,
+ 'Boolean' => TRUE,
'StateProvince' => 'California',
'Country' => 'US',
'Link' => 'http://civicrm.org',
$this->assertEquals($valid, '2008-06-24', 'Checking type ' . $type . ' for returned CustomField Type.');
}
else {
- $this->assertEquals($valid, true, 'Checking type ' . $type . ' for returned CustomField Type.');
+ $this->assertEquals($valid, TRUE, 'Checking type ' . $type . ' for returned CustomField Type.');
}
}
}
);
//Now check DB for location elements.
- $searchParams = array('id' => CRM_Utils_Array::value('address_id', $locElementIds),
+ $searchParams = array(
+ 'id' => CRM_Utils_Array::value('address_id', $locElementIds),
'location_type_id' => 1,
'is_primary' => 1,
);
);
$this->assertDBCompareValues('CRM_Core_DAO_Address', $searchParams, $compareParams);
- $searchParams = array('id' => CRM_Utils_Array::value('email_id', $locElementIds),
+ $searchParams = array(
+ 'id' => CRM_Utils_Array::value('email_id', $locElementIds),
'location_type_id' => 1,
'is_primary' => 1,
);
$compareParams = array('email' => 'john.smith@example.org');
$this->assertDBCompareValues('CRM_Core_DAO_Email', $searchParams, $compareParams);
-
- $searchParams = array('id' => CRM_Utils_Array::value('phone_id', $locElementIds),
+ $searchParams = array(
+ 'id' => CRM_Utils_Array::value('phone_id', $locElementIds),
'location_type_id' => 1,
'is_primary' => 1,
'phone_type_id' => 1,
$compareParams = array('phone' => '303443689');
$this->assertDBCompareValues('CRM_Core_DAO_Phone', $searchParams, $compareParams);
- $searchParams = array('id' => CRM_Utils_Array::value('phone_2_id', $locElementIds),
+ $searchParams = array(
+ 'id' => CRM_Utils_Array::value('phone_2_id', $locElementIds),
'location_type_id' => 1,
'phone_type_id' => 2,
);
$compareParams = array('phone' => '9833910234');
$this->assertDBCompareValues('CRM_Core_DAO_Phone', $searchParams, $compareParams);
- $searchParams = array('id' => CRM_Utils_Array::value('im_id', $locElementIds),
+ $searchParams = array(
+ 'id' => CRM_Utils_Array::value('im_id', $locElementIds),
'location_type_id' => 1,
'is_primary' => 1,
);
* AllEntityPhones() method - get all Phones for a location block, with primary Phone first
* @todo FIXME: Fixing this test requires add helper functions in CiviTest to create location block and phone and link them to an event. Punting to 3.1 cycle. DGG
*/
- public function SKIPPED_testAllEntityPhones() {}
+ public function SKIPPED_testAllEntityPhones() {
+ }
}
* This method is called after a test is executed.
*
*/
- protected function tearDown() {}
+ protected function tearDown() {
+ }
/**
* Testing Activity Generation through Entity Recursion
* Testing Event Generation through Entity Recursion
*/
public function testEventGeneration() {
- //Event set initial params
+ //Event set initial params
$daoEvent = new CRM_Event_DAO_Event();
$daoEvent->title = 'Test event for Recurring Entity';
$daoEvent->event_type_id = 3;
$recursion->entity_id = $daoEvent->id;
$recursion->entity_table = 'civicrm_event';
$recursion->dateColumns = array('start_date');
- $recursion->schedule = array (
+ $recursion->schedule = array(
'entity_value' => $daoEvent->id,
'start_action_date' => $daoEvent->start_date,
'start_action_condition' => 'monday',
$currentDomain = CRM_Core_Config::domainID();
// we are setting up an artificial situation here as we are trying to drive out
// previous memory of this setting so we need to flush it out
- $cachekey = CRM_Core_BAO_Setting::inCache('CiviCRM Preferences', 'max_attachments', NULL, NULL, TRUE, $currentDomain);
+ $cachekey = CRM_Core_BAO_Setting::inCache('CiviCRM Preferences', 'max_attachments', NULL, NULL, TRUE, $currentDomain);
CRM_Core_BAO_Setting::flushCache($cachekey);
CRM_Core_BAO_Setting::updateSettingsFromMetaData();
//check current domain
* Make sure that the existence of a profile doesn't break listing all fields
*
public function testGetAvailable_mixed() {
- // FIXME
- $this->testGetAvailable_full();
- // $this->testGetAvailable_byGid();
- $this->testGetAvailable_full();
- // $this->testGetAvailable_byGid();
+ // FIXME
+ $this->testGetAvailable_full();
+ // $this->testGetAvailable_byGid();
+ $this->testGetAvailable_full();
+ // $this->testGetAvailable_byGid();
} // */
/**
public function testHookAlterMailer() {
$test = $this;
$mockMailer = new CRM_Utils_FakeObject(array(
- 'send' => function ($recipients, $headers, $body) use ($test) {
- $test->calls['send']++;
- $test->assertEquals(array('to@example.org'), $recipients);
- $test->assertEquals('Subject Example', $headers['Subject']);
- }
+ 'send' => function ($recipients, $headers, $body) use ($test) {
+ $test->calls['send']++;
+ $test->assertEquals(array('to@example.org'), $recipients);
+ $test->assertEquals('Subject Example', $headers['Subject']);
+ }
));
CRM_Utils_Hook::singleton()->setHook('civicrm_alterMailer',
function (&$mailer, $driver, $params) use ($test, $mockMailer) {
- $test->calls['civicrm_alterMailer']++;
- $test->assertTrue(is_string($driver) && !empty($driver));
- $test->assertTrue(is_array($params));
- $test->assertTrue(is_callable(array($mailer, 'send')));
- $mailer = $mockMailer;
+ $test->calls['civicrm_alterMailer']++;
+ $test->assertTrue(is_string($driver) && !empty($driver));
+ $test->assertTrue(is_array($params));
+ $test->assertTrue(is_callable(array($mailer, 'send')));
+ $mailer = $mockMailer;
}
);
public function tearDown() {
$config = CRM_Core_Config::singleton();
- $config->configAndLogDir= $this->oldConfigAndLogDir;
+ $config->configAndLogDir = $this->oldConfigAndLogDir;
parent::tearDown();
}
$logger2->info('obj-3');
CRM_Core_Error::debug_log_message("static-5");
$this->assertLogRegexp('/static-1.*static-2.*obj-1.*static-3.*obj-2.*static-4.*obj-3.*static-5/s');
-}
+ }
/**
* @param $pattern
$this->assertDBQuery(1, 'SELECT count(*) FROM civicrm_option_value WHERE name = "CRM_Example_One_Foo"');
$this->assertEquals($foo['id'], $foo2['id']);
-
// Override 'getrefcount' ==> The refcount is 0
$this->adhocProvider->addAction('getrefcount', 'access CiviCRM', function($apiRequest) {
return civicrm_api3_create_success(array());
$me->reconcile();
$this->fail('Expected exception when using invalid declaration');
} catch (Exception $e) {
- // good
+ // good
}
}
$me->reconcile();
$this->fail('Expected exception when using invalid declaration');
} catch (Exception $e) {
- // good
+ // good
}
}
$me->reconcile();
$this->fail('Expected exception when using invalid declaration');
} catch (Exception $e) {
- // good
+ // good
}
}
$cases[] = array('method', 'CRM_Contact_Page_AJAX', TRUE, 'getAddressDisplay');
$cases[] = array('method', 'CRM_Foo_Page_AJAX', FALSE, 'method(');
$cases[] = array('method', 'CRM_Foo_Page_AJAX', FALSE, 'method()');
- $cases[] = array('method', 'othermethod;CRM_Foo_Page_AJAX', FALSE,'method');
- $cases[] = array('method', 'CRM_Foo_Page_AJAX;othermethod', FALSE,'method');
+ $cases[] = array('method', 'othermethod;CRM_Foo_Page_AJAX', FALSE, 'method');
+ $cases[] = array('method', 'CRM_Foo_Page_AJAX;othermethod', FALSE, 'method');
$cases[] = array('method', 'CRM_Foo_Page_Inline_Bar', FALSE, '');
$cases[] = array('method', 'CRM_Foo_Page_Inline_Bar', FALSE, 'method');
$cases[] = array('method', 'CRM_Foo->method', FALSE);
-
$cases[] = array('page', 'CRM_Foo', FALSE);
$cases[] = array('page', 'CRM_Foo_Bar', FALSE);
$cases[] = array('page', 'CRM_Foo_Page', FALSE);
$contribution = $this->callAPISuccess('contribution', 'get', array('contribution_recur_id' => $this->_contributionRecurID, 'sequential' => 1));
$this->assertEquals(2, $contribution['count']);
$this->assertEquals('second_one', $contribution['values'][1]['trxn_id']);
- $this->callAPISuccessGetSingle('membership_payment', array('contribution_id' => $contribution['values'][1]['id'],));
+ $this->callAPISuccessGetSingle('membership_payment', array('contribution_id' => $contribution['values'][1]['id']));
$this->callAPISuccessGetSingle('line_item', array('contribution_id' => $contribution['values'][1]['id'], 'entity_table' => 'civicrm_membership'));
}
// for some strange unknown reason, in batch mode this value gets set to null
// so crude hack here to avoid an exception and hence an error
- $GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK'] = array( );
+ $GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK'] = array();
}
public function tearDown() {
$this->assertEquals('secondone', $contribution['values'][1]['trxn_id']);
$this->callAPISuccessGetCount('line_item', array('entity_id' => $this->ids['membership'], 'entity_table' => 'civicrm_membership'), 2);
$this->callAPISuccessGetSingle('line_item', array('contribution_id' => $contribution['values'][1]['id'], 'entity_table' => 'civicrm_membership'));
- $this->callAPISuccessGetSingle('membership_payment', array('contribution_id' => $contribution['values'][1]['id'],));
+ $this->callAPISuccessGetSingle('membership_payment', array('contribution_id' => $contribution['values'][1]['id']));
}
/**
CRM_Core_Region::instance('testAllTypes')->add(array(
// note: returns a value which gets appended to the region
'callback' => 'implode',
- 'arguments' => array('-', array('callback','with','specific','args<br/>')),
+ 'arguments' => array('-', array('callback', 'with', 'specific', 'args<br/>')),
));
CRM_Core_Region::instance('testAllTypes')->add(array(
// note: returns a value which gets appended to the region
. "<script type=\"text/javascript\">\nalert(\"hi\");\n</script>\n"
. "<script type=\"text/javascript\">\nCRM.\$(function(\$) {\n\$(\"div\");\n});\n</script>\n"
. "<link href=\"/foo%20bar.css\" rel=\"stylesheet\" type=\"text/css\"/>\n"
- . "<style type=\"text/css\">\nbody { background: black; }\n</style>\n"
- ;
+ . "<style type=\"text/css\">\nbody { background: black; }\n</style>\n";
$this->assertEquals($expected, $actual);
}
$this->res
->addScriptFile('com.example.ext', 'foo%20bar.js', 0, 'testAddScriptFile')
->addScriptFile('com.example.ext', 'foo%20bar.js', 0, 'testAddScriptFile') // extra
- ->addScriptFile('civicrm', 'foo%20bar.js', 0, 'testAddScriptFile')
- ;
+ ->addScriptFile('civicrm', 'foo%20bar.js', 0, 'testAddScriptFile');
$smarty = CRM_Core_Smarty::singleton();
$actual = $smarty->fetch('string:{crmRegion name=testAddScriptFile}{/crmRegion}');
$expected = "" // stable ordering: alphabetical by (snippet.weight,snippet.name)
. "<script type=\"text/javascript\" src=\"http://core-app/foo%20bar.js?r=resTest\">\n</script>\n"
- . "<script type=\"text/javascript\" src=\"http://ext-dir/com.example.ext/foo%20bar.js?r=resTest\">\n</script>\n"
- ;
+ . "<script type=\"text/javascript\" src=\"http://ext-dir/com.example.ext/foo%20bar.js?r=resTest\">\n</script>\n";
$this->assertEquals($expected, $actual);
}
* FIXME: This can't work because the tests run in English and CRM_Core_Resources optimizes
* away the English data from $settings['strings']
public function testAddScriptFile_strings() {
- file_put_contents($this->mapper->keyToBasePath('com.example.ext') . '/hello.js', 'alert(ts("Hello world"));');
- $this->res->addScriptFile('com.example.ext', 'hello.js', 0, 'testAddScriptFile_strings');
- $settings = $this->res->getSettings();
- $expected = array('Hello world');
- $this->assertEquals($expected, $settings['strings']);
+ file_put_contents($this->mapper->keyToBasePath('com.example.ext') . '/hello.js', 'alert(ts("Hello world"));');
+ $this->res->addScriptFile('com.example.ext', 'hello.js', 0, 'testAddScriptFile_strings');
+ $settings = $this->res->getSettings();
+ $expected = array('Hello world');
+ $this->assertEquals($expected, $settings['strings']);
}
- */
+ */
public function testAddScriptURL() {
$this->res
->addScriptUrl('/whiz/foo%20bar.js', 0, 'testAddScriptURL')
->addScriptUrl('/whiz/foo%20bar.js', 0, 'testAddScriptURL') // extra
- ->addScriptUrl('/whizbang/foo%20bar.js', 0, 'testAddScriptURL')
- ;
+ ->addScriptUrl('/whizbang/foo%20bar.js', 0, 'testAddScriptURL');
$smarty = CRM_Core_Smarty::singleton();
$actual = $smarty->fetch('string:{crmRegion name=testAddScriptURL}{/crmRegion}');
$expected = "" // stable ordering: alphabetical by (snippet.weight,snippet.name)
. "<script type=\"text/javascript\" src=\"/whiz/foo%20bar.js\">\n</script>\n"
- . "<script type=\"text/javascript\" src=\"/whizbang/foo%20bar.js\">\n</script>\n"
- ;
+ . "<script type=\"text/javascript\" src=\"/whizbang/foo%20bar.js\">\n</script>\n";
$this->assertEquals($expected, $actual);
}
public function testAddScript() {
$this->res
->addScript('alert("hi");', 0, 'testAddScript')
- ->addScript('alert("there");', 0, 'testAddScript')
- ;
+ ->addScript('alert("there");', 0, 'testAddScript');
$smarty = CRM_Core_Smarty::singleton();
$actual = $smarty->fetch('string:{crmRegion name=testAddScript}{/crmRegion}');
$expected = ""
. "<script type=\"text/javascript\">\nalert(\"hi\");\n</script>\n"
- . "<script type=\"text/javascript\">\nalert(\"there\");\n</script>\n"
- ;
+ . "<script type=\"text/javascript\">\nalert(\"there\");\n</script>\n";
$this->assertEquals($expected, $actual);
}
public function testAddVars() {
$this->res
->addVars('food', array('fruit' => array('mine' => 'apple', 'ours' => 'banana')))
- ->addVars('food', array('fruit' => array('mine' => 'new apple', 'yours' => 'orange')))
- ;
+ ->addVars('food', array('fruit' => array('mine' => 'new apple', 'yours' => 'orange')));
$this->assertTreeEquals(
array('vars' => array('food' => array('fruit' => array('yours' => 'orange', 'mine' => 'new apple', 'ours' => 'banana')))),
$this->res->getSettings()
public function testAddSetting() {
$this->res
->addSetting(array('fruit' => array('mine' => 'apple')))
- ->addSetting(array('fruit' => array('yours' => 'orange')))
- ;
+ ->addSetting(array('fruit' => array('yours' => 'orange')));
$this->assertTreeEquals(
array('fruit' => array('yours' => 'orange', 'mine' => 'apple')),
$this->res->getSettings()
$actual = $smarty->fetch('string:{crmRegion name=testCrmJS}{/crmRegion}');
$expected = "" // stable ordering: alphabetical by (snippet.weight,snippet.name)
. "<script type=\"text/javascript\" src=\"http://ext-dir/com.example.ext/foo%20bar.js?r=resTest\">\n</script>\n"
- . "<script type=\"text/javascript\" src=\"/whiz/foo%20bar.js\">\n</script>\n"
- ;
+ . "<script type=\"text/javascript\" src=\"/whiz/foo%20bar.js\">\n</script>\n";
$this->assertEquals($expected, $actual);
}
$this->res
->addStyleFile('com.example.ext', 'foo%20bar.css', 0, 'testAddStyleFile')
->addStyleFile('com.example.ext', 'foo%20bar.css', 0, 'testAddStyleFile') // extra
- ->addStyleFile('civicrm', 'foo%20bar.css', 0, 'testAddStyleFile')
- ;
+ ->addStyleFile('civicrm', 'foo%20bar.css', 0, 'testAddStyleFile');
$smarty = CRM_Core_Smarty::singleton();
$actual = $smarty->fetch('string:{crmRegion name=testAddStyleFile}{/crmRegion}');
$expected = "" // stable ordering: alphabetical by (snippet.weight,snippet.name)
. "<link href=\"http://core-app/foo%20bar.css?r=resTest\" rel=\"stylesheet\" type=\"text/css\"/>\n"
- . "<link href=\"http://ext-dir/com.example.ext/foo%20bar.css?r=resTest\" rel=\"stylesheet\" type=\"text/css\"/>\n"
- ;
+ . "<link href=\"http://ext-dir/com.example.ext/foo%20bar.css?r=resTest\" rel=\"stylesheet\" type=\"text/css\"/>\n";
$this->assertEquals($expected, $actual);
}
$this->res
->addStyleUrl('/whiz/foo%20bar.css', 0, 'testAddStyleURL')
->addStyleUrl('/whiz/foo%20bar.css', 0, 'testAddStyleURL') // extra
- ->addStyleUrl('/whizbang/foo%20bar.css', 0, 'testAddStyleURL')
- ;
+ ->addStyleUrl('/whizbang/foo%20bar.css', 0, 'testAddStyleURL');
$smarty = CRM_Core_Smarty::singleton();
$actual = $smarty->fetch('string:{crmRegion name=testAddStyleURL}{/crmRegion}');
$expected = "" // stable ordering: alphabetical by (snippet.weight,snippet.name)
. "<link href=\"/whiz/foo%20bar.css\" rel=\"stylesheet\" type=\"text/css\"/>\n"
- . "<link href=\"/whizbang/foo%20bar.css\" rel=\"stylesheet\" type=\"text/css\"/>\n"
- ;
+ . "<link href=\"/whizbang/foo%20bar.css\" rel=\"stylesheet\" type=\"text/css\"/>\n";
$this->assertEquals($expected, $actual);
}
public function testAddStyle() {
$this->res
->addStyle('body { background: black; }', 0, 'testAddStyle')
- ->addStyle('body { text-color: black; }', 0, 'testAddStyle')
- ;
+ ->addStyle('body { text-color: black; }', 0, 'testAddStyle');
$smarty = CRM_Core_Smarty::singleton();
$actual = $smarty->fetch('string:{crmRegion name=testAddStyle}{/crmRegion}');
$expected = ""
. "<style type=\"text/css\">\nbody { background: black; }\n</style>\n"
- . "<style type=\"text/css\">\nbody { text-color: black; }\n</style>\n"
- ;
+ . "<style type=\"text/css\">\nbody { text-color: black; }\n</style>\n";
$this->assertEquals($expected, $actual);
}
$actual = $smarty->fetch('string:{crmRegion name=testCrmCSS}{/crmRegion}');
$expected = "" // stable ordering: alphabetical by (snippet.weight,snippet.name)
. "<link href=\"http://ext-dir/com.example.ext/foo%20bar.css?r=resTest\" rel=\"stylesheet\" type=\"text/css\"/>\n"
- . "<link href=\"/whiz/foo%20bar.css\" rel=\"stylesheet\" type=\"text/css\"/>\n"
- ;
+ . "<link href=\"/whiz/foo%20bar.css\" rel=\"stylesheet\" type=\"text/css\"/>\n";
$this->assertEquals($expected, $actual);
}
public function testCallback_commit() {
$tx = new CRM_Core_Transaction();
- CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_PRE_COMMIT, array($this, '_preCommit'), array('qwe','rty'));
- CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_POST_COMMIT, array($this, '_postCommit'), array('uio','p[]'));
- CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_PRE_ROLLBACK, array($this, '_preRollback'), array('asd','fgh'));
- CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_POST_ROLLBACK, array($this, '_postRollback'), array('jkl',';'));
+ CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_PRE_COMMIT, array($this, '_preCommit'), array('qwe', 'rty'));
+ CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_POST_COMMIT, array($this, '_postCommit'), array('uio', 'p[]'));
+ CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_PRE_ROLLBACK, array($this, '_preRollback'), array('asd', 'fgh'));
+ CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_POST_ROLLBACK, array($this, '_postRollback'), array('jkl', ';'));
CRM_Core_DAO::executeQuery('UPDATE civicrm_contact SET id = 100 WHERE id = 100');
public function testCallback_rollback() {
$tx = new CRM_Core_Transaction();
- CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_PRE_COMMIT, array($this, '_preCommit'), array('ewq','ytr'));
- CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_POST_COMMIT, array($this, '_postCommit'), array('oiu','][p'));
- CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_PRE_ROLLBACK, array($this, '_preRollback'), array('dsa','hgf'));
- CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_POST_ROLLBACK, array($this, '_postRollback'), array('lkj',';'));
+ CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_PRE_COMMIT, array($this, '_preCommit'), array('ewq', 'ytr'));
+ CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_POST_COMMIT, array($this, '_postCommit'), array('oiu', '][p'));
+ CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_PRE_ROLLBACK, array($this, '_preRollback'), array('dsa', 'hgf'));
+ CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_POST_ROLLBACK, array($this, '_postRollback'), array('lkj', ';'));
CRM_Core_DAO::executeQuery('UPDATE civicrm_contact SET id = 100 WHERE id = 100');
$tx->rollback();
'location_type_id' => 1,
'version' => 3,
);
- $result = civicrm_api( 'address','create',$params );
+ $result = civicrm_api( 'address', 'create', $params );
$contactIds[$count++] = $contact['id'];
}
*
* (PHP 5)
*
- * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
- * @copyright Copyright CiviCRM LLC (C) 2009
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* GNU Affero General Public License version 3
- * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $
- * @package CiviCRM
+ * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Class containing all test suites
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Event_AllTests extends CiviTestSuite {
private static $instance = NULL;
/**
* Test class for CRM_Event_BAO_ParticipantStatus BAO
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Event_BAO_ParticipantStatusTest extends CiviUnitTestCase {
* This method is called after a test is executed.
*
*/
- protected function tearDown() {}
+ protected function tearDown() {
+ }
/**
* create() and deleteParticipantStatusType() method
*
* (PHP 5)
*
- * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
- * @copyright Copyright CiviCRM LLC (C) 2009
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* GNU Affero General Public License version 3
- * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $
- * @package CiviCRM
+ * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Class containing all test suites
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Extension_AllTests extends CiviTestSuite {
private static $instance = NULL;
*
* (PHP 5)
*
- * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
- * @copyright Copyright CiviCRM LLC (C) 2009
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* GNU Affero General Public License version 3
- * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $
- * @package CiviCRM
+ * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Class containing all test suites
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Extension_Container_AllTests extends CiviTestSuite {
private static $instance = NULL;
*
* (PHP 5)
*
- * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
- * @copyright Copyright CiviCRM LLC (C) 2009
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* GNU Affero General Public License version 3
- * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $
- * @package CiviCRM
+ * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Class containing all test suites
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Extension_Manager_AllTests extends CiviTestSuite {
private static $instance = NULL;
public function assertModuleActiveByKey($expectedIsActive, $key) {
foreach (CRM_Core_Module::getAll() as $module) {
if ($module->name == $key) {
- $this->assertEquals((bool)$expectedIsActive, (bool)$module->is_active);
+ $this->assertEquals((bool) $expectedIsActive, (bool) $module->is_active);
return;
}
}
CRM_Financial_BAO_FinancialItem::add($lineItem, $contribution);
$result = $this->assertDBNotNull(
'CRM_Financial_DAO_FinancialItem',
- $lineItem->id ,
+ $lineItem->id,
'amount',
'entity_id',
'Database check on added financial item record.'
$result = $this->assertDBNotNull(
'CRM_Financial_DAO_FinancialItem',
- $lineItem->id ,
+ $lineItem->id,
'amount',
'entity_id',
'Database check on added financial item record.'
$this->assertEquals( $result, $price, 'Verify Amount for Financial Item');
$entityResult = $this->assertDBNotNull(
'CRM_Financial_DAO_EntityFinancialTrxn',
- $entityId ,
+ $entityId,
'amount',
'entity_id',
'Database check on added entity financial trxn record.'
$entityTrxn = CRM_Financial_BAO_FinancialItem::createEntityTrxn($params);
$entityResult = $this->assertDBNotNull(
'CRM_Financial_DAO_EntityFinancialTrxn',
- $financialTrxn->id ,
+ $financialTrxn->id,
'amount',
'financial_trxn_id',
'Database check on added entity financial trxn record.'
CRM_Financial_BAO_FinancialTypeAccount::del($financialAccountType->id);
$params = array('id' => $financialAccountType->id );
$result = CRM_Financial_BAO_FinancialType::retrieve($params, $defaults);
- $this->assertEquals( empty($result), true, 'Verify financial types record deletion.');
+ $this->assertEquals( empty($result), TRUE, 'Verify financial types record deletion.');
}
/**
$financialType = CRM_Financial_BAO_FinancialType::add($params, $ids);
$result = $this->assertDBNotNull(
'CRM_Financial_DAO_FinancialType',
- $financialType->id ,
+ $financialType->id,
'name',
'id',
'Database check on added financial type record.'
$ids = array();
$financialType = CRM_Financial_BAO_FinancialType::add($params, $ids);
$result = CRM_Financial_BAO_FinancialType::setIsActive($financialType->id, 0);
- $this->assertEquals($result, true , 'Verify financial type record updation for is_active.');
+ $this->assertEquals($result, TRUE, 'Verify financial type record updation for is_active.');
$isActive = $this->assertDBNotNull(
'CRM_Financial_DAO_FinancialType',
- $financialType->id ,
+ $financialType->id,
'is_active',
'id',
'Database check on updated for financial type is_active.'
CRM_Financial_BAO_FinancialType::del($financialType->id);
$params = array('id' => $financialType->id);
$result = CRM_Financial_BAO_FinancialType::retrieve($params, $defaults);
- $this->assertEquals(empty($result), true, 'Verify financial types record deletion.');
+ $this->assertEquals(empty($result), TRUE, 'Verify financial types record deletion.');
}
}
}
/**
- * Implements ACLGroup hook
- * aclGroup function returns a list of permitted groups
- * @param string $type
- * @param int $contactID
- * @param string $tableName
- * @param array $allGroups
- * @param array $currentGroups
- */
+ * Implements ACLGroup hook
+ * aclGroup function returns a list of permitted groups
+ * @param string $type
+ * @param int $contactID
+ * @param string $tableName
+ * @param array $allGroups
+ * @param array $currentGroups
+ */
public function hook_civicrm_aclGroup($type, $contactID, $tableName, &$allGroups, &$currentGroups) {
//don't use api - you will get a loop
$sql = " SELECT * FROM civicrm_group WHERE name LIKE '%pick%'";
/**
* Test CRM_Contact_BAO_Query::searchQuery()
- * @dataProvider dataProvider
+ * @dataProvider dataProvider
*/
public function testSearch($fv, $count, $ids, $full) {
$op = new PHPUnit_Extensions_Database_Operation_Insert();
/**
* Provide data to the CRM_Mailing_BAO_QueryTest class
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Mailing_BAO_QueryTestDataProvider implements Iterator {
/**
- * @var integer
+ * @var integer
*/
private $i = 0;
/**
- * @var mixed[]
+ * @var mixed[]
* This dataset describes various form values and what contact
* IDs should be selected when the form values are applied to the
* database in dataset.xml
*/
private $dataset = array(
- array('fv' => array('mailing_name' => 'First%', 'mailing_open_status' => 'Y'),
+ array(
+ 'fv' => array('mailing_name' => 'First%', 'mailing_open_status' => 'Y'),
'id' => array(109, 110, 111, 112),
),
- array('fv' => array('mailing_name' => 'First%', 'mailing_open_status' => 'N'),
+ array(
+ 'fv' => array('mailing_name' => 'First%', 'mailing_open_status' => 'N'),
'id' => array(102, 103, 104, 105, 108),
),
/*bounce*/
array(
- 'fv' => array('mailing_name' => 'First%', 'mailing_delivery_status'
+ 'fv' => array(
+ 'mailing_name' => 'First%',
+ 'mailing_delivery_status'
=> 'N'),
'id' => array(105),
),
/*bounce*/
array(
- 'fv' => array('mailing_name' => 'First%', 'mailing_delivery_status'
+ 'fv' => array(
+ 'mailing_name' => 'First%',
+ 'mailing_delivery_status'
=> 'Y'),
'id' => array(102, 103, 104, 108, 109, 110, 111, 112),
),
- array('fv' => array('mailing_name' => 'First%', 'mailing_reply_status' => 'Y'),
+ array(
+ 'fv' => array('mailing_name' => 'First%', 'mailing_reply_status' => 'Y'),
'id' => array(103, 108, 110, 112),
),
- array('fv' => array('mailing_name' => 'First%', 'mailing_reply_status' => 'N'),
+ array(
+ 'fv' => array('mailing_name' => 'First%', 'mailing_reply_status' => 'N'),
'id' => array(102, 104, 105, 109, 111),
),
- array('fv' => array('mailing_name' => 'First%', 'mailing_click_status' => 'Y'),
+ array(
+ 'fv' => array('mailing_name' => 'First%', 'mailing_click_status' => 'Y'),
'id' => array(104, 108, 111, 112),
),
- array('fv' => array('mailing_name' => 'First%', 'mailing_click_status' => 'N'),
+ array(
+ 'fv' => array('mailing_name' => 'First%', 'mailing_click_status' => 'N'),
'id' => array(102, 103, 105, 109, 110),
),
/*bounce*/
array(
- 'fv' => array('mailing_name' => 'Second%', 'mailing_delivery_status'
+ 'fv' => array(
+ 'mailing_name' => 'Second%',
+ 'mailing_delivery_status'
=> 'N'),
'id' => array(),
),
/*bounce*/
array(
- 'fv' => array('mailing_name' => 'Second%', 'mailing_delivery_status'
+ 'fv' => array(
+ 'mailing_name' => 'Second%',
+ 'mailing_delivery_status'
=> 'Y'),
'id' => array(102, 103, 104, 108, 109, 110, 111, 112),
),
- array('fv' => array('mailing_name' => 'Second%', 'mailing_reply_status' => 'Y'),
+ array(
+ 'fv' => array('mailing_name' => 'Second%', 'mailing_reply_status' => 'Y'),
'id' => array(103),
),
- array('fv' => array('mailing_name' => 'Second%', 'mailing_click_status' => 'Y'),
+ array(
+ 'fv' => array('mailing_name' => 'Second%', 'mailing_click_status' => 'Y'),
'id' => array(104),
),
- array('fv' => array('mailing_name' => 'Second%', 'mailing_click_status' => 'N'),
+ array(
+ 'fv' => array('mailing_name' => 'Second%', 'mailing_click_status' => 'N'),
'id' => array(102, 103, 108, 109, 110, 111, 112),
),
- array('fv' => array('mailing_date_high' => '2011-05-25', 'mailing_open_status' => 'Y'),
+ array(
+ 'fv' => array('mailing_date_high' => '2011-05-25', 'mailing_open_status' => 'Y'),
'id' => array(109, 110, 111, 112),
),
- array('fv' => array('mailing_date_high' => '2011-05-25', 'mailing_open_status' => 'N'),
+ array(
+ 'fv' => array('mailing_date_high' => '2011-05-25', 'mailing_open_status' => 'N'),
'id' => array(102, 103, 104, 105, 108),
),
- array('fv' => array('mailing_date_low' => '2011-05-26', 'mailing_open_status' => 'Y'),
+ array(
+ 'fv' => array('mailing_date_low' => '2011-05-26', 'mailing_open_status' => 'Y'),
'id' => array(102),
),
- array('fv' => array('mailing_date_low' => '2011-05-26', 'mailing_open_status' => 'N'),
+ array(
+ 'fv' => array('mailing_date_low' => '2011-05-26', 'mailing_open_status' => 'N'),
'id' => array(103, 104, 108, 109, 110, 111, 112),
),
);
*/
class CRM_Mailing_BAO_SpoolTest extends CiviUnitTestCase {
- protected $_mut = null;
+ protected $_mut = NULL;
protected static $bodytext = 'Unit tests keep children safe.';
public function setUp() {
parent::setUp();
- $this->_mut = new CiviMailUtils( $this, true );
+ $this->_mut = new CiviMailUtils( $this, TRUE );
}
public function tearDown() {
* @param $context
* @param $mailPart
*/
- public static function mailWalkCallback( $context, $mailPart ) {
+ public static function mailWalkCallback($context, $mailPart) {
if ( $mailPart instanceof ezcMailText ) {
switch ( $mailPart->subType ) {
- case 'plain':
- self::assertContains( self::$bodytext, $mailPart->generateBody() );
- break;
- case 'html':
- self::assertContains( self::$bodytext . '</p>', $mailPart->generateBody() );
- break;
+ case 'plain':
+ self::assertContains( self::$bodytext, $mailPart->generateBody() );
+ break;
+
+ case 'html':
+ self::assertContains( self::$bodytext . '</p>', $mailPart->generateBody() );
+ break;
}
}
}
*
* (PHP 5)
*
- * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
- * @copyright Copyright CiviCRM LLC (C) 2009
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* GNU Affero General Public License version 3
- * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $
- * @package CiviCRM
+ * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Class containing all test suites
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Member_AllTests extends CiviTestSuite {
private static $instance = NULL;
*
* (PHP 5)
*
- * @package CiviCRM
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Test CRM/Member/BAO Membership Log add , delete functions
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Member_BAO_MembershipLogTest extends CiviUnitTestCase {
$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' => date('Ymd', strtotime('2006-01-21')),
+ 'start_date' => date('Ymd', strtotime('2006-01-21')),
+ 'end_date' => date('Ymd', strtotime('2006-12-21')),
'source' => 'Payment',
'is_override' => 1,
'status_id' => $this->_mebershipStatusID,
$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' => date('Ymd', strtotime('2006-01-21')),
+ 'start_date' => date('Ymd', strtotime('2006-01-21')),
+ 'end_date' => date('Ymd', strtotime('2006-12-21')),
'source' => 'Payment',
'is_override' => 1,
'status_id' => $this->_mebershipStatusID,
$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' => date('Ymd', strtotime('2006-01-21')),
+ 'start_date' => date('Ymd', strtotime('2006-01-21')),
+ 'end_date' => date('Ymd', strtotime('2006-12-21')),
'source' => 'Payment',
'is_override' => 1,
'status_id' => $this->_mebershipStatusID,
$this->membershipStatusDelete( $this->_membershipStatusID );
Contact::delete( $this->_contactID );
- $this->_contactID = $this->_membershipStatusID = $this->_membershipTypeID = null;
+ $this->_contactID = $this->_membershipStatusID = $this->_membershipTypeID = NULL;
}
public function testCreate() {
$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' => date('Ymd', strtotime('2006-01-21')),
+ 'start_date' => date('Ymd', strtotime('2006-01-21')),
+ 'end_date' => date('Ymd', strtotime('2006-12-21')),
'source' => 'Payment',
'is_override' => 1,
'status_id' => $this->_membershipStatusID,
$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' => date('Ymd', strtotime('2006-01-21')),
+ 'start_date' => date('Ymd', strtotime('2006-01-21')),
+ 'end_date' => date('Ymd', strtotime('2006-12-21')),
'source' => 'Payment',
'is_override' => 1,
'status_id' => $this->_membershipStatusID,
$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' => date('Ymd', strtotime('2006-01-21')),
+ 'start_date' => date('Ymd', strtotime('2006-01-21')),
+ 'end_date' => date('Ymd', strtotime('2006-12-21')),
'source' => 'Payment',
'is_override' => 1,
'status_id' => $this->_membershipStatusID,
$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' => date('Ymd', strtotime('2006-01-21')),
+ 'start_date' => date('Ymd', strtotime('2006-01-21')),
+ 'end_date' => date('Ymd', strtotime('2006-12-21')),
'source' => 'Payment',
'is_override' => 1,
'status_id' => $this->_membershipStatusID,
$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' => date('Ymd', strtotime('2006-01-21')),
+ 'start_date' => date('Ymd', strtotime('2006-01-21')),
+ 'end_date' => date('Ymd', strtotime('2006-12-21')),
'source' => 'PaySource',
'is_override' => 1,
'status_id' => $this->_membershipStatusID,
$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' => date('Ymd', strtotime('2006-01-21')),
+ 'start_date' => date('Ymd', strtotime('2006-01-21')),
+ 'end_date' => date('Ymd', strtotime('2006-12-21')),
'source' => 'Payment',
'is_override' => 1,
'status_id' => $this->_membershipStatusID,
$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' => date('Ymd', strtotime('2006-01-21')),
+ 'start_date' => date('Ymd', strtotime('2006-01-21')),
+ 'end_date' => date('Ymd', strtotime('2006-12-21')),
'source' => 'Payment',
'is_override' => 1,
'status_id' => $this->_membershipStatusID,
$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' => date('Ymd', strtotime('2006-01-21')),
+ 'start_date' => date('Ymd', strtotime('2006-01-21')),
+ 'end_date' => date('Ymd', strtotime('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.'
);
$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' => date('Ymd', strtotime('2006-01-21')),
+ 'start_date' => date('Ymd', strtotime('2006-01-21')),
+ 'end_date' => date('Ymd', strtotime('2006-12-21')),
'source' => 'Payment',
'is_override' => 1,
'status_id' => $this->_membershipStatusID,
$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' => date('Ymd', strtotime('2006-01-21')),
+ 'start_date' => date('Ymd', strtotime('2006-01-21')),
+ 'end_date' => date('Ymd', strtotime('2006-12-21')),
'source' => 'Payment',
'is_override' => 1,
'status_id' => $this->_membershipStatusID,
$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' => date('Ymd', strtotime('2006-01-21')),
+ 'start_date' => date('Ymd', strtotime('2006-01-21')),
+ 'end_date' => date('Ymd', strtotime('2006-12-21')),
'source' => 'Payment',
'is_override' => 1,
'status_id' => $this->_membershipStatusID,
$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' => date('Ymd', strtotime('2006-01-21')),
+ 'start_date' => date('Ymd', strtotime('2006-01-21')),
+ 'end_date' => date('Ymd', strtotime('2006-12-21')),
'source' => 'Payment',
'is_override' => 1,
'status_id' => $this->_membershipStatusID,
*
* (PHP 5)
*
- * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
- * @copyright Copyright CiviCRM LLC (C) 2009
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* GNU Affero General Public License version 3
- * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $
- * @package CiviCRM
+ * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Class containing all test suites
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Member_Form_AllTests extends CiviTestSuite {
private static $instance = NULL;
*
* (PHP 5)
*
- * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
- * @copyright Copyright CiviCRM LLC (C) 2009
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* GNU Affero General Public License version 3
- * @package CiviCRM
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Test APIv2 civicrm_activity_* functions
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Member_Form_MembershipTest extends CiviUnitTestCase {
public function testFormRuleOverrideNoStatus() {
$unixNow = time();
$unixYearFromNow = $unixNow + (365 * 24 * 60 * 60);
- $params = array('join_date' => date('m/d/Y', $unixNow),
+ $params = array(
+ 'join_date' => date('m/d/Y', $unixNow),
'membership_type_id' => array('23', '13'),
'is_override' => TRUE,
);
public function testFormRuleRollingJoin1MonthFromNow() {
$unixNow = time();
$unix1MFmNow = $unixNow + (31 * 24 * 60 * 60);
- $params = array('join_date' => date('m/d/Y', $unix1MFmNow),
+ $params = array(
+ 'join_date' => date('m/d/Y', $unix1MFmNow),
'start_date' => '',
'end_date' => '',
'membership_type_id' => array('23', '3'),
*/
public function testFormRuleRollingJoinToday() {
$unixNow = time();
- $params = array('join_date' => date('m/d/Y', $unixNow),
+ $params = array(
+ 'join_date' => date('m/d/Y', $unixNow),
'start_date' => '',
'end_date' => '',
'membership_type_id' => array('23', '3'),
public function testFormRuleRollingJoin1MonthAgo() {
$unixNow = time();
$unix1MAgo = $unixNow - (31 * 24 * 60 * 60);
- $params = array('join_date' => date('m/d/Y', $unix1MAgo),
+ $params = array(
+ 'join_date' => date('m/d/Y', $unix1MAgo),
'start_date' => '',
'end_date' => '',
'membership_type_id' => array('23', '3'),
public function testFormRuleRollingJoin6MonthsAgo() {
$unixNow = time();
$unix6MAgo = $unixNow - (180 * 24 * 60 * 60);
- $params = array('join_date' => date('m/d/Y', $unix6MAgo),
+ $params = array(
+ 'join_date' => date('m/d/Y', $unix6MAgo),
'start_date' => '',
'end_date' => '',
'membership_type_id' => array('23', '3'),
public function testFormRuleRollingJoin1YearAgo() {
$unixNow = time();
$unix1YAgo = $unixNow - (370 * 24 * 60 * 60);
- $params = array('join_date' => date('m/d/Y', $unix1YAgo),
+ $params = array(
+ 'join_date' => date('m/d/Y', $unix1YAgo),
'start_date' => '',
'end_date' => '',
'membership_type_id' => array('23', '3'),
public function testFormRuleRollingJoin2YearsAgo() {
$unixNow = time();
$unix2YAgo = $unixNow - (2 * 365 * 24 * 60 * 60);
- $params = array('join_date' => date('m/d/Y', $unix2YAgo),
+ $params = array(
+ 'join_date' => date('m/d/Y', $unix2YAgo),
'start_date' => '',
'end_date' => '',
'membership_type_id' => array('23', '3'),
public function testFormRuleFixedJoin6MonthsAgo() {
$unixNow = time();
$unix6MAgo = $unixNow - (180 * 24 * 60 * 60);
- $params = array('join_date' => date('m/d/Y', $unix6MAgo),
+ $params = array(
+ 'join_date' => date('m/d/Y', $unix6MAgo),
'start_date' => '',
'end_date' => '',
'membership_type_id' => array('23', '7'),
*
* (PHP 5)
*
- * @package CiviCRM
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Test CRM/Member/BAO Membership Log add , delete functions
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Member_Import_Parser_MembershipTest extends CiviUnitTestCase {
/**
'mapper[1][0]' => 'membership_type_id',
'mapper[2][0]' => 'membership_start_date',
);
-/*
+ /*
$params = array(
'contact_id' => $contactId,
/**
* Test class for CRM_PCP_BAO_PCPTest BAO
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_PCP_BAO_PCPTest extends CiviUnitTestCase {
* This method is called after a test is executed.
*
*/
- protected function tearDown() {}
+ protected function tearDown() {
+ }
}
*
* (PHP 5)
*
- * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
- * @copyright Copyright CiviCRM LLC (C) 2009
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* GNU Affero General Public License version 3
- * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $
- * @package CiviCRM
+ * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Class containing all test suites
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Pledge_AllTests extends CiviTestSuite {
private static $instance = NULL;
/**
* Test class for CRM_Pledge_BAO_PledgeBlock BAO
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Pledge_BAO_PledgeBlockTest extends CiviUnitTestCase {
* This method is called after a test is executed.
*
*/
- protected function tearDown() {}
+ protected function tearDown() {
+ }
/**
* create() and deletepledgeblock() method
/**
* Test class for CRM_Pledge_BAO_PledgePayment BAO
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Pledge_BAO_PledgePaymentTest extends CiviUnitTestCase {
* This method is called after a test is executed.
*
*/
- protected function tearDown() {}
+ protected function tearDown() {
+ }
/**
* Test for Add/Update Pledge Payment.
*/
public function testDeletePledgePaymentsNullId() {
$payment = CRM_Core_DAO::createTestObject('CRM_Pledge_BAO_PledgePayment');
- $paymentid = CRM_Pledge_BAO_PledgePayment::deletePayments(Null);
+ $paymentid = CRM_Pledge_BAO_PledgePayment::deletePayments(NULL);
$this->assertEquals(count($paymentid), 1, "No payments deleted");
$result = CRM_Pledge_BAO_Pledge::deletePledge($payment->pledge_id);
}
/**
* Test class for CRM_Pledge_BAO_Pledge BAO
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Pledge_BAO_PledgeTest extends CiviUnitTestCase {
* This method is called after a test is executed.
*
*/
- protected function tearDown() {}
+ protected function tearDown() {
+ }
/**
* Test for Add/Update Pledge.
*
* (PHP 5)
*
- * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
- * @copyright Copyright CiviCRM LLC (C) 2009
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* GNU Affero General Public License version 3
- * @version $Id: AllTests.php 25163 2009-11-17 23:43:46Z walt $
- * @package CiviCRM
+ * @version $Id: AllTests.php 25163 2009-11-17 23:43:46Z walt $
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Class containing all test suites
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Queue_AllTests extends CiviTestSuite {
private static $instance = NULL;
*
* (PHP 5)
*
- * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
- * @copyright Copyright CiviCRM LLC (C) 2009
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* GNU Affero General Public License version 3
- * @version $Id: AllTests.php 25163 2009-11-17 23:43:46Z walt $
- * @package CiviCRM
+ * @version $Id: AllTests.php 25163 2009-11-17 23:43:46Z walt $
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Class containing all test suites
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Queue_Queue_AllTests extends CiviTestSuite {
private static $instance = NULL;
$this->assertEquals($expected, CRM_Utils_Array::collect('catWord', $arr));
$arr = array();
- $arr['en']= (object) array('catWord' => 'cat', 'dogWord' => 'dog');
- $arr['fr']= (object) array('catWord' => 'chat', 'dogWord' => 'chien');
- $arr['es']= (object) array('catWord' => 'gato');
+ $arr['en'] = (object) array('catWord' => 'cat', 'dogWord' => 'dog');
+ $arr['fr'] = (object) array('catWord' => 'chat', 'dogWord' => 'chien');
+ $arr['es'] = (object) array('catWord' => 'gato');
$expected = array('en' => 'cat', 'fr' => 'chat', 'es' => 'gato');
$this->assertEquals($expected, CRM_Utils_Array::collect('catWord', $arr));
}
public function testIsSubset() {
$this->assertTrue(CRM_Utils_Array::isSubset(array(), array()));
$this->assertTrue(CRM_Utils_Array::isSubset(array('a'), array('a')));
- $this->assertTrue(CRM_Utils_Array::isSubset(array('a'), array('b','a','c')));
- $this->assertTrue(CRM_Utils_Array::isSubset(array('b','d'), array('a','b','c','d')));
+ $this->assertTrue(CRM_Utils_Array::isSubset(array('a'), array('b', 'a', 'c')));
+ $this->assertTrue(CRM_Utils_Array::isSubset(array('b', 'd'), array('a', 'b', 'c', 'd')));
$this->assertFalse(CRM_Utils_Array::isSubset(array('a'), array()));
$this->assertFalse(CRM_Utils_Array::isSubset(array('a'), array('b')));
- $this->assertFalse(CRM_Utils_Array::isSubset(array('a'), array('b','c','d')));
+ $this->assertFalse(CRM_Utils_Array::isSubset(array('a'), array('b', 'c', 'd')));
}
public function testRemove() {
*
* (PHP 5)
*
- * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
- * @copyright Copyright CiviCRM LLC (C) 2009
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* GNU Affero General Public License version 3
- * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $
- * @package CiviCRM
+ * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Class containing all test suites
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class CRM_Utils_Cache_AllTests extends CiviTestSuite {
private static $instance = NULL;
public function testFormatRFC822() {
$values = array(
- array('name' => "Test User",
+ array(
+ 'name' => "Test User",
'email' => "foo@bar.com",
'result' => "Test User <foo@bar.com>",
),
public function truncDecimalCases() {
$cases = array();
// array($value, $precision, $expectedValue)
- $cases[] = array(523, array(1,0), 5);
- $cases[] = array(523, array(5,2), 523);
- $cases[] = array(523, array(10,8), 52.3);
- $cases[] = array(12345, array(3,3), 0.123);
- $cases[] = array(0.12345, array(10,0), 12345);
- $cases[] = array(-123.45, array(4,2), -12.34);
+ $cases[] = array(523, array(1, 0), 5);
+ $cases[] = array(523, array(5, 2), 523);
+ $cases[] = array(523, array(10, 8), 52.3);
+ $cases[] = array(12345, array(3, 3), 0.123);
+ $cases[] = array(0.12345, array(10, 0), 12345);
+ $cases[] = array(-123.45, array(4, 2), -12.34);
return $cases;
}
public function dataProvider() {
$cases = array(); // array(0=>$inputText, 1=>$language, 2=>$options, 3=>$expectedText)
- $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, CRM_Utils_QueryFormatter::MODE_NONE, '%first second%');
- $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, CRM_Utils_QueryFormatter::MODE_PHRASE, '%first second%');
- $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, CRM_Utils_QueryFormatter::MODE_WILDPHRASE, '%first second%');
- $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, CRM_Utils_QueryFormatter::MODE_WILDWORDS, '%first%second%');
+ $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, CRM_Utils_QueryFormatter::MODE_NONE, '%first second%');
+ $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, CRM_Utils_QueryFormatter::MODE_PHRASE, '%first second%');
+ $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, CRM_Utils_QueryFormatter::MODE_WILDPHRASE, '%first second%');
+ $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, CRM_Utils_QueryFormatter::MODE_WILDWORDS, '%first%second%');
$cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, CRM_Utils_QueryFormatter::MODE_WILDWORDS_SUFFIX, '%first%second%');
- $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, CRM_Utils_QueryFormatter::MODE_NONE, 'first second');
- $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, CRM_Utils_QueryFormatter::MODE_PHRASE, '"first second"');
- $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, CRM_Utils_QueryFormatter::MODE_WILDPHRASE, '"*first second*"');
- $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, CRM_Utils_QueryFormatter::MODE_WILDWORDS, '*first* *second*');
+ $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, CRM_Utils_QueryFormatter::MODE_NONE, 'first second');
+ $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, CRM_Utils_QueryFormatter::MODE_PHRASE, '"first second"');
+ $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, CRM_Utils_QueryFormatter::MODE_WILDPHRASE, '"*first second*"');
+ $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, CRM_Utils_QueryFormatter::MODE_WILDWORDS, '*first* *second*');
$cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, CRM_Utils_QueryFormatter::MODE_WILDWORDS_SUFFIX, 'first* second*');
- $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, CRM_Utils_QueryFormatter::MODE_NONE, '+first +second');
- $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, CRM_Utils_QueryFormatter::MODE_PHRASE, '+"first second"');
- $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, CRM_Utils_QueryFormatter::MODE_WILDPHRASE, '+"*first second*"');
- $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, CRM_Utils_QueryFormatter::MODE_WILDWORDS, '+*first* +*second*');
+ $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, CRM_Utils_QueryFormatter::MODE_NONE, '+first +second');
+ $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, CRM_Utils_QueryFormatter::MODE_PHRASE, '+"first second"');
+ $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, CRM_Utils_QueryFormatter::MODE_WILDPHRASE, '+"*first second*"');
+ $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, CRM_Utils_QueryFormatter::MODE_WILDWORDS, '+*first* +*second*');
$cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, CRM_Utils_QueryFormatter::MODE_WILDWORDS_SUFFIX, '+first* +second*');
- $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SOLR, CRM_Utils_QueryFormatter::MODE_NONE, 'first second');
- $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SOLR, CRM_Utils_QueryFormatter::MODE_PHRASE, '"first second"');
- $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SOLR, CRM_Utils_QueryFormatter::MODE_WILDPHRASE, '"*first second*"');
- $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SOLR, CRM_Utils_QueryFormatter::MODE_WILDWORDS, '*first* *second*');
+ $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SOLR, CRM_Utils_QueryFormatter::MODE_NONE, 'first second');
+ $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SOLR, CRM_Utils_QueryFormatter::MODE_PHRASE, '"first second"');
+ $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SOLR, CRM_Utils_QueryFormatter::MODE_WILDPHRASE, '"*first second*"');
+ $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SOLR, CRM_Utils_QueryFormatter::MODE_WILDWORDS, '*first* *second*');
$cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SOLR, CRM_Utils_QueryFormatter::MODE_WILDWORDS_SUFFIX, 'first* second*');
// if user supplies wildcards, then ignore mode
foreach (array(CRM_Utils_QueryFormatter::MODE_NONE, CRM_Utils_QueryFormatter::MODE_WILDPHRASE, CRM_Utils_QueryFormatter::MODE_WILDWORDS, CRM_Utils_QueryFormatter::MODE_WILDWORDS_SUFFIX) as $mode) {
- $cases[] = array('first% second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, $mode, 'first% second');
- $cases[] = array('first% second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, $mode, 'first* second');
- $cases[] = array('first% second', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, $mode, '+first* +second');
- $cases[] = array('first% second', CRM_Utils_QueryFormatter::LANG_SOLR, $mode, 'first* second');
- $cases[] = array('first second%', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, $mode, 'first second%');
- $cases[] = array('first second%', CRM_Utils_QueryFormatter::LANG_SQL_FTS, $mode, 'first second*');
- $cases[] = array('first second%', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, $mode, '+first +second*');
- $cases[] = array('first second%', CRM_Utils_QueryFormatter::LANG_SOLR, $mode, 'first second*');
+ $cases[] = array('first% second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, $mode, 'first% second');
+ $cases[] = array('first% second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, $mode, 'first* second');
+ $cases[] = array('first% second', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, $mode, '+first* +second');
+ $cases[] = array('first% second', CRM_Utils_QueryFormatter::LANG_SOLR, $mode, 'first* second');
+ $cases[] = array('first second%', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, $mode, 'first second%');
+ $cases[] = array('first second%', CRM_Utils_QueryFormatter::LANG_SQL_FTS, $mode, 'first second*');
+ $cases[] = array('first second%', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, $mode, '+first +second*');
+ $cases[] = array('first second%', CRM_Utils_QueryFormatter::LANG_SOLR, $mode, 'first second*');
}
return $cases;
public function testRow_twice() {
$insert = CRM_Utils_SQL_Insert::into('foo')
->row(array('first' => '1', 'second' => '2' ))
- ->row(array('second' => '2b', 'first' => '1b'))
- ;
+ ->row(array('second' => '2b', 'first' => '1b'));
$expected = '
INSERT INTO foo (`first`,`second`) VALUES
("1","2"),
array('second' => '2b', 'first' => '1b'),
array('first' => '1c', 'second' => '2c')
))
- ->row(array('second' => '2d', 'first' => '1d'))
- ;
+ ->row(array('second' => '2d', 'first' => '1d'));
$expected = '
INSERT INTO foo (`first`,`second`) VALUES
("1","2"),
$actual = CRM_Utils_SQL_Select::from('ignore')->interpolate(
'(@escaped) (!unescaped) (#validated)',
array(
- '@escaped' => array('foo"bar', "whiz", "null", null, "bang"),
+ '@escaped' => array('foo"bar', "whiz", "null", NULL, "bang"),
'!unescaped' => array('foo"bar', 'bar'),
- '#validated' => array(1, 10, null, 100.1)
+ '#validated' => array(1, 10, NULL, 100.1)
)
);
$this->assertLike('("foo\\"bar", "whiz", "null", NULL, "bang") (foo"bar, bar) (1, 10, NULL, 100.1)', $actual);
'civicrm dashboard & force = 1,;' => 'civicrm_dashboard___force___1__',
);
-
foreach ($testSet as $in => $expected) {
$out = CRM_Utils_String::stripPathChars($in);
$this->assertEquals($out, $expected, "Output does not match");
$config = CRM_Core_Config::singleton();
$this->assertTrue($config->userSystem instanceof CRM_Utils_System_UnitTests);
$expected = '/index.php?q=civicrm/foo/bar&foo=ab&bar=cd%26ef';
- $actual = CRM_Utils_System::url('civicrm/foo/bar', 'foo=ab&bar=cd%26ef', false, null, false);
+ $actual = CRM_Utils_System::url('civicrm/foo/bar', 'foo=ab&bar=cd%26ef', FALSE, NULL, FALSE);
$this->assertEquals($expected, $actual);
}
$actual = CRM_Utils_System::url('civicrm/foo/bar', array(
'foo' => 'ab',
'bar' => 'cd&ef',
- ), false, null, false);
+ ), FALSE, NULL, FALSE);
$this->assertEquals($expected, $actual);
}
array('version' => '4.2.1', 'date' => '2012-09-12'),
array('version' => '4.2.2', 'date' => '2012-09-27'),
array('version' => '4.2.4', 'date' => '2012-10-18'),
- array('version' => '4.2.6', 'date' => '2012-11-01', 'security' => true),
- array('version' => '4.2.7', 'date' => '2013-01-02', 'security' => true),
+ array('version' => '4.2.6', 'date' => '2012-11-01', 'security' => TRUE),
+ array('version' => '4.2.7', 'date' => '2013-01-02', 'security' => TRUE),
array('version' => '4.2.8', 'date' => '2013-02-20'),
array('version' => '4.2.9', 'date' => '2013-04-03'),
- array('version' => '4.2.10', 'date' => '2013-07-29', 'security' => true),
+ array('version' => '4.2.10', 'date' => '2013-07-29', 'security' => TRUE),
array('version' => '4.2.11', 'date' => '2013-09-25'),
- array('version' => '4.2.12', 'date' => '2013-10-02', 'security' => true),
- array('version' => '4.2.13', 'date' => '2013-11-06', 'security' => true),
+ array('version' => '4.2.12', 'date' => '2013-10-02', 'security' => TRUE),
+ array('version' => '4.2.13', 'date' => '2013-11-06', 'security' => TRUE),
array('version' => '4.2.14', 'date' => '2013-11-20'),
- array('version' => '4.2.15', 'date' => '2014-02-07', 'security' => true),
+ array('version' => '4.2.15', 'date' => '2014-02-07', 'security' => TRUE),
array('version' => '4.2.16', 'date' => '2014-02-18'),
- array('version' => '4.2.17', 'date' => '2014-07-01', 'security' => true),
+ array('version' => '4.2.17', 'date' => '2014-07-01', 'security' => TRUE),
array('version' => '4.2.18', 'date' => '2014-08-06'),
- array('version' => '4.2.19', 'date' => '2014-09-17', 'security' => true)
+ array('version' => '4.2.19', 'date' => '2014-09-17', 'security' => TRUE)
),
),
'4.3' => array(
array('version' => '4.3.1', 'date' => '2013-04-18'),
array('version' => '4.3.2', 'date' => '2013-05-02'),
array('version' => '4.3.3', 'date' => '2013-05-08'),
- array('version' => '4.3.4', 'date' => '2013-06-10', 'security' => true),
- array('version' => '4.3.5', 'date' => '2013-07-08', 'security' => true),
+ array('version' => '4.3.4', 'date' => '2013-06-10', 'security' => TRUE),
+ array('version' => '4.3.5', 'date' => '2013-07-08', 'security' => TRUE),
array('version' => '4.3.6', 'date' => '2013-09-25'),
- array('version' => '4.3.7', 'date' => '2013-10-02', 'security' => true),
- array('version' => '4.3.8', 'date' => '2013-11-06', 'security' => true),
- array('version' => '4.3.9', 'date' => '2014-09-07', 'security' => true)
+ array('version' => '4.3.7', 'date' => '2013-10-02', 'security' => TRUE),
+ array('version' => '4.3.8', 'date' => '2013-11-06', 'security' => TRUE),
+ array('version' => '4.3.9', 'date' => '2014-09-07', 'security' => TRUE)
),
),
'4.4' => array(
'status' => 'lts',
'releases' => array(
array('version' => '4.4.0', 'date' => '2013-10-23'),
- array('version' => '4.4.1', 'date' => '2013-11-06', 'security' => true),
+ array('version' => '4.4.1', 'date' => '2013-11-06', 'security' => TRUE),
array('version' => '4.4.2', 'date' => '2013-11-20'),
array('version' => '4.4.3', 'date' => '2013-12-05'),
- array('version' => '4.4.4', 'date' => '2014-02-07', 'security' => true),
+ array('version' => '4.4.4', 'date' => '2014-02-07', 'security' => TRUE),
array('version' => '4.4.5', 'date' => '2014-04-17'),
- array('version' => '4.4.6', 'date' => '2014-07-01', 'security' => true),
- array('version' => '4.4.7', 'date' => '2014-09-17', 'security' => true),
+ array('version' => '4.4.6', 'date' => '2014-07-01', 'security' => TRUE),
+ array('version' => '4.4.7', 'date' => '2014-09-17', 'security' => TRUE),
array('version' => '4.4.8', 'date' => '2014-10-14'),
array('version' => '4.4.9', 'date' => '2014-11-05'),
array('version' => '4.4.10', 'date' => '2014-11-19'),
- array('version' => '4.4.11', 'date' => '2014-12-17', 'security' => true)
+ array('version' => '4.4.11', 'date' => '2014-12-17', 'security' => TRUE)
),
),
'4.5' => array(
array('version' => '4.5.2', 'date' => '2014-10-14'),
array('version' => '4.5.3', 'date' => '2014-11-05'),
array('version' => '4.5.4', 'date' => '2014-11-19'),
- array('version' => '4.5.5', 'date' => '2014-12-17', 'security' => true),
+ array('version' => '4.5.5', 'date' => '2014-12-17', 'security' => TRUE),
)
),
'4.6' => array(
*
* (PHP 5)
*
- * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
- * @copyright Copyright CiviCRM LLC (C) 2009
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* GNU Affero General Public License version 3
- * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $
- * @package CiviCRM
+ * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Class containing all CRM test suites
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class Civi_AllTests extends CiviTestSuite {
private static $instance = NULL;
$dbValues = array();
CRM_Core_DAO::commonRetrieve($daoName, $searchParams, $dbValues);
-
// compare db values with expected values
self::assertAttributesEquals($testCase, $expectedValues, $dbValues);
}
case 'raw':
// nothing to do
break;
+
case 'ezc':
$msg = $this->convertToEzc($msg);
break;
case 'raw':
// nothing to do
break;
+
case 'ezc':
foreach ($msgs as $i => $msg) {
$msgs[$i] = $this->convertToEzc($msg);
$cookie['path'] = '/';
}
if (!isset($cookie['max_age'])) {
- $cookie['max_age'] = 7*24*60*60;
+ $cookie['max_age'] = 7 * 24 * 60 * 60;
}
$this->deleteCookie($cookie['name'], $cookie['path']);
$optionExprs = array();
* @param string $element
* @param string $waitFor
*/
- public function clickPopupLink($element, $waitFor=NULL) {
+ public function clickPopupLink($element, $waitFor = NULL) {
$this->clickAjaxLink($element, 'css=.ui-dialog');
if ($waitFor) {
$this->waitForElementPresent($waitFor);
* @param string $element
* @param string $waitFor
*/
- public function clickAjaxLink($element, $waitFor=NULL) {
+ public function clickAjaxLink($element, $waitFor = NULL) {
$this->click($element);
if ($waitFor) {
$this->waitForElementPresent($waitFor);
/**
*/
public function webtestFillAutocomplete($sortName, $fieldName = 'contact_id') {
- $this->select2($fieldName,$sortName);
+ $this->select2($fieldName, $sortName);
//$this->assertContains($sortName, $this->getValue($fieldName), "autocomplete expected $sortName but didn’t find it in " . $this->getValue($fieldName));
}
$this->type('email-Primary', $params['email'] = "{$name}@example.com");
$this->clickAjaxLink('_qf_Edit_next');
- $this->waitForText("xpath=//div[@id='$selectId']","$name");
+ $this->waitForText("xpath=//div[@id='$selectId']", "$name");
$params['sort_name'] = $contactType == 'Individual' ? $params['last_name'] . ', ' . $params['first_name'] : "$name $contactType";
$params['display_name'] = $contactType == 'Individual' ? $params['first_name'] . ' ' . $params['last_name'] : $params['sort_name'];
// Is new contact created?
if ($lname) {
- $this->waitForText("xpath=//div[@id='$selectId']","$lname, $fname");
+ $this->waitForText("xpath=//div[@id='$selectId']", "$lname, $fname");
}
else {
- $this->waitForText("xpath=//div[@id='$selectId']","$fname");
+ $this->waitForText("xpath=//div[@id='$selectId']", "$fname");
}
}
/**
* Returns a single argument from the url query
*/
- public function urlArg($arg, $url = NULL) {
- $elements = $this->parseURL($url);
- return isset($elements['queryString'][$arg]) ? $elements['queryString'][$arg] : NULL;
- }
+ public function urlArg($arg, $url = NULL) {
+ $elements = $this->parseURL($url);
+ return isset($elements['queryString'][$arg]) ? $elements['queryString'][$arg] : NULL;
+ }
/**
* Define a payment processor for use by a webtest. Default is to create Dummy processor
$this->openCiviPage('admin/paymentProcessor', 'action=add&reset=1&pp=' . $pid, 'name');
$this->type('name', $processorName);
$this->select('financial_account_id', "label={$financialAccount}");
- foreach ($processorSettings AS $f => $v) {
+ foreach ($processorSettings as $f => $v) {
$this->type($f, $v);
}
break;
}
- $this->select2('member_of_contact_id',$membershipTitle);
+ $this->select2('member_of_contact_id', $membershipTitle);
$this->type('minimum_fee', '100');
$this->select('financial_type_id', "value={$memTypeParams['financial_type']}");
*
* @param array $customSets
* Custom sets i.e entity wise sets want to be created and checked.
- e.g $customSets = array(array('entity' => 'Contribution', 'subEntity' => 'Donation',
- 'triggerElement' => $triggerElement))
- array $triggerElement: the element which is responsible for custom group to load
+ e.g $customSets = array(array('entity' => 'Contribution', 'subEntity' => 'Donation',
+ 'triggerElement' => $triggerElement))
+ array $triggerElement: the element which is responsible for custom group to load
- which uses the entity info as its selection value
+ which uses the entity info as its selection value
* @param array $pageUrl
* The url which on which the ajax custom group load takes place.
- * @param callable|boolean $beforeTriggering fn to execute before actual element triggering
+ * @param bool $beforeTriggering
* @return void
*/
public function customFieldSetLoadOnTheFlyCheck($customSets, $pageUrl, $beforeTriggering = NULL) {
/**
* Type and select first occurance of autocomplete
*/
- public function select2($fieldName,$label, $multiple = FALSE, $xpath=FALSE) {
+ public function select2($fieldName, $label, $multiple = FALSE, $xpath = FALSE) {
// In the case of chainSelect, wait for options to load
$this->waitForElementNotPresent('css=select.loading');
if ($multiple) {
/**
* Check for unobtrusive status message as set by CRM.status
*/
- public function checkCRMStatus($text=NULL) {
+ public function checkCRMStatus($text = NULL) {
$this->waitForElementPresent("css=.crm-status-box-outer.status-success");
if ($text) {
$this->assertElementContainsText("css=.crm-status-box-outer.status-success", $text);
/**
* Check for obtrusive status message as set by CRM.alert
*/
- public function checkCRMAlert($text, $type='success') {
+ public function checkCRMAlert($text, $type = 'success') {
$this->waitForElementPresent("css=div.ui-notify-message.$type");
$this->waitForText("css=div.ui-notify-message.$type", $text);
// We got the message, now let's close it so the webtest doesn't get confused by lots of open alerts
$this->openCiviPage('admin/setting/preferences/display', 'reset=1');
$isChecked = $this->isChecked('ajaxPopupsEnabled');
if (($isChecked && !$enabled) || (!$isChecked && $enabled)) {
- $this->click('ajaxPopupsEnabled');
+ $this->click('ajaxPopupsEnabled');
}
if ($enabled) {
$this->assertChecked('ajaxPopupsEnabled');
//flush component settings
CRM_Core_Component::getEnabledComponents(TRUE);
-
if ($this->_eNoticeCompliant) {
error_reporting(E_ALL);
}
* array(1 => array("Whiz", "String")));
*/
public function assertDBQuery($expected, $query, $params = array(), $message = '') {
- if ($message) $message .= ': ';
+ if ($message) { $message .= ': ';
+ }
$actual = CRM_Core_DAO::singleValueQuery($query, $params);
$this->assertEquals($expected, $actual,
sprintf('%sexpected=[%s] actual=[%s] query=[%s]',
$params
);
switch (strtolower($action)) {
- case 'getvalue' :
+ case 'getvalue':
return $this->callAPISuccessGetValue($entity, $params, $checkAgainst);
- case 'getsingle' :
+
+ case 'getsingle':
return $this->callAPISuccessGetSingle($entity, $params, $checkAgainst);
- case 'getcount' :
- return $this->callAPISuccessGetCount($entity, $params, $checkAgainst);
+
+ case 'getcount':
+ return $this->callAPISuccessGetCount($entity, $params, $checkAgainst);
}
$result = $this->civicrm_api($entity, $action, $params);
$this->assertAPISuccess($result, "Failure in api call for $entity $action");
* so the distinction between set
* up & tested functions is clearer
*
- * @return array api Result
+ * @return array api Result
*/
public function createTestEntity(){
return $entity = $this->callAPISuccess($this->entity, 'create', $this->params);
$params[$key] = $values[$seq % sizeof($values)];
}
if ($contact_type == 'Individual' ) {
- $params['email'] = strtolower(
+ $params['email'] = strtolower(
$params['first_name'] . '_' . $params['last_name'] . '@civicrm.org'
);
- $params['prefix_id'] = 3;
- $params['suffix_id'] = 3;
+ $params['prefix_id'] = 3;
+ $params['suffix_id'] = 3;
}
return $params;
}
return;
}
$result = $this->callAPISuccess('contact', 'delete', $params);
- return $result;
+ return $result;
}
/**
'domain_id' => '1',
);
$params = array_merge($defaults, $params);
- $result = $this->callAPISuccess('Tag', 'create', $params);
+ $result = $this->callAPISuccess('Tag', 'create', $params);
return $result['values'][$result['id']];
}
}
- /**
+ /**
* Function to add a Group
*
* @params array to add group
*/
public function groupContactCreate($groupID, $totalCount = 10) {
$params = array('group_id' => $groupID);
- for ($i=1; $i <= $totalCount; $i++) {
+ for ($i = 1; $i <= $totalCount; $i++) {
$contactID = $this->individualCreate();
if ($i == 1) {
$params += array('contact_id' => $contactID);
$params = array_merge($defaults, $params);
if (strlen($params['title']) > 13) {
- $params['title'] = substr($params['title'], 0, 13);
+ $params['title'] = substr($params['title'], 0, 13);
}
//have a crack @ deleting it first in the hope this will prevent derailing our tests
public function entityCustomGroupWithSingleFieldCreate($function, $filename) {
$params = array('title' => $function);
$entity = substr(basename($filename), 0, strlen(basename($filename)) - 8);
- $params['extends'] = $entity ? $entity : 'Contact';
+ $params['extends'] = $entity ? $entity : 'Contact';
$customGroup = $this->CustomGroupCreate($params);
$customField = $this->customFieldCreate(array('custom_group_id' => $customGroup['id'], 'label' => $function));
CRM_Core_PseudoConstant::flush();
'decision_date' => '20130805000000',
);
- $keysToUnset = array('xdebug', 'undefined_fields',);
+ $keysToUnset = array('xdebug', 'undefined_fields');
foreach ($keysToUnset as $unwantedKey) {
if(isset($result[$unwantedKey])) {
unset($result[$unwantedKey]);
}
foreach ($resultArray as $index => &$values) {
- if(!is_array($values)) {
- continue;
- }
- foreach($values as $key => &$value) {
- if(substr($key, 0, 3) == 'api' && is_array($value)) {
- if(isset($value['is_error'])) {
- // we have a std nested result format
- $this->tidyExampleResult($value);
- }
- else{
- foreach ($value as &$nestedResult) {
- // this is an alternative syntax for nested results a keyed array of results
- $this->tidyExampleResult($nestedResult);
- }
- }
- }
- if(in_array($key, $keysToUnset)) {
- unset($values[$key]);
- break;
- }
- if(array_key_exists($key, $fieldsToChange) && !empty($value)) {
- $value = $fieldsToChange[$key];
+ if(!is_array($values)) {
+ continue;
+ }
+ foreach($values as $key => &$value) {
+ if(substr($key, 0, 3) == 'api' && is_array($value)) {
+ if(isset($value['is_error'])) {
+ // we have a std nested result format
+ $this->tidyExampleResult($value);
}
- if(is_string($value)) {
- $value = addslashes($value);
+ else{
+ foreach ($value as &$nestedResult) {
+ // this is an alternative syntax for nested results a keyed array of results
+ $this->tidyExampleResult($nestedResult);
+ }
}
}
+ if(in_array($key, $keysToUnset)) {
+ unset($values[$key]);
+ break;
+ }
+ if(array_key_exists($key, $fieldsToChange) && !empty($value)) {
+ $value = $fieldsToChange[$key];
+ }
+ if(is_string($value)) {
+ $value = addslashes($value);
+ }
+ }
}
}
}
if (!empty($unformattedArray['values']) && is_array($unformattedArray['values'])) {
foreach ($unformattedArray['values'] as $key => $value) {
- if (is_Array($value)) {
+ if (is_array($value)) {
foreach ($value as $k => $v) {
if ($k == 'id') {
unset($value[$k]);
*/
public function setMockSettingsMetaData($extras) {
CRM_Core_BAO_Setting::$_cache = array();
- $this->callAPISuccess('system','flush', array());
+ $this->callAPISuccess('system', 'flush', array());
CRM_Core_BAO_Setting::$_cache = array();
CRM_Utils_Hook::singleton()->setHook('civicrm_alterSettingsMetaData', function (&$metadata, $domainId, $profile) use ($extras) {
CRM_Core_Config::singleton()->userPermissionClass->permissions = array('access CiviCRM');
$optionGroupID = $this->callAPISuccessGetValue('option_group', array('return' => 'id', 'name' => 'acl_role'));
- $optionValue = $this->callAPISuccess('option_value', 'create', array('option_group_id' => $optionGroupID,
+ $optionValue = $this->callAPISuccess('option_value', 'create', array(
+ 'option_group_id' => $optionGroupID,
'label' => 'pick me',
'value' => 55,
));
-
CRM_Core_DAO::executeQuery("
TRUNCATE civicrm_acl_cache
");
TRUNCATE civicrm_acl_contact_cache
");
-
CRM_Core_DAO::executeQuery("
INSERT INTO civicrm_acl_entity_role (
`acl_role_id`, `entity_table`, `entity_id`
* @param array $params
* @param null $fields
* @return object of created field
-*/
+ */
public static function createField($params, $fields = NULL) {
if (empty($params)) {
$params = array(
'contact_id' => $contactId,
);
-
$event = CRM_Event_BAO_Event::create($params);
return $event->id;
}
$delete_params = array('id' => $params['profileId']);
$resulProfile = civicrm_api('uf_group', 'delete', $delete_params);
-
require_once 'CRM/Contribute/DAO/PCPBlock.php';
$dao = new CRM_Contribute_DAO_PCPBlock();
$dao->id = $params['blockId'];
# Relying on system timezone setting produces a warning,
# doing the following prevents the warning message
if ( file_exists( '/etc/timezone' ) ) {
- $timezone = trim( file_get_contents( '/etc/timezone' ) );
- if ( ini_set('date.timezone', $timezone ) === false ) {
- echo "ini_set( 'date.timezone', '$timezone' ) failed\n";
- }
+ $timezone = trim( file_get_contents( '/etc/timezone' ) );
+ if ( ini_set('date.timezone', $timezone ) === FALSE ) {
+ echo "ini_set( 'date.timezone', '$timezone' ) failed\n";
+ }
}
# Crank up the memory
if ( empty( $GLOBALS['mysql_pass'] ) && $GLOBALS['mysql_pass_need_password'] ) {
$GLOBALS['mysql_pass'] = PHPUnit_TextUI_Command::getPassword( 'Password' );
}
- define( 'CIVICRM_DSN' , "mysql://{$GLOBALS['mysql_user']}:{$GLOBALS['mysql_pass']}@{$GLOBALS['mysql_host']}/{$dbName}?new_link=true" );
+ define( 'CIVICRM_DSN', "mysql://{$GLOBALS['mysql_user']}:{$GLOBALS['mysql_pass']}@{$GLOBALS['mysql_host']}/{$dbName}?new_link=true" );
}
if (!defined("CIVICRM_DSN")) {
- $dsn= getenv("CIVICRM_TEST_DSN");
+ $dsn = getenv("CIVICRM_TEST_DSN");
if (!empty ($dsn)) {
- define("CIVICRM_DSN",$dsn);
+ define("CIVICRM_DSN", $dsn);
} else {
echo "\nFATAL: no DB connection configured (CIVICRM_DSN). \nYou can either create/edit " . __DIR__ . "/civicrm.settings.local.php\n";
if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
echo "OR set it in your shell:\n SETX CIVICRM_TEST_DSN mysql://db_username:db_password@localhost/civicrm_tests_dev \n
(you will need to open a new command shell before it takes effect)";
}
-echo "\n\n
+ echo "\n\n
If you haven't done so already, you need to create (once) a database dedicated to the unit tests:
mysql -uroot -p
create database civicrm_tests_dev;
global $civicrm_root;
if (empty($civicrm_root)) {
- $civicrm_root = dirname (dirname (dirname (dirname( __FILE__ ) )));
+ $civicrm_root = dirname(dirname(dirname(dirname( __FILE__ ) )));
}
#$civicrm_root = '/var/www/drupal7.dev.civicrm.org/public/sites/devel.drupal7.tests.dev.civicrm.org/modules/civicrm';
if (!defined("CIVICRM_TEMPLATE_COMPILEDIR")) {
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
- define( 'CIVICRM_TEMPLATE_COMPILEDIR', getenv ('TMP') . DIRECTORY_SEPARATOR . 'civi' . DIRECTORY_SEPARATOR );
+ define( 'CIVICRM_TEMPLATE_COMPILEDIR', getenv('TMP') . DIRECTORY_SEPARATOR . 'civi' . DIRECTORY_SEPARATOR );
} else {
define( 'CIVICRM_TEMPLATE_COMPILEDIR', '/tmp/civi/' );
}
*
*/
if (!defined('CIVICRM_UF_BASEURL')) {
- define( 'CIVICRM_UF_BASEURL' , 'http://FIX ME' );
+ define( 'CIVICRM_UF_BASEURL', 'http://FIX ME' );
}
/**
set_include_path( $include_path );
if ( function_exists( 'variable_get' ) && variable_get('clean_url', '0') != '0' ) {
- define( 'CIVICRM_CLEANURL', 1 );
+ define( 'CIVICRM_CLEANURL', 1 );
} else {
- define( 'CIVICRM_CLEANURL', 0 );
+ define( 'CIVICRM_CLEANURL', 0 );
}
// force PHP to auto-detect Mac line endings
$memLimitUnit = strtolower(substr($memLimitString, -1));
$memLimit = (int) $memLimitString;
switch ($memLimitUnit) {
- case 'g': $memLimit *= 1024;
- case 'm': $memLimit *= 1024;
- case 'k': $memLimit *= 1024;
+ case 'g': $memLimit *= 1024;
+ case 'm': $memLimit *= 1024;
+ case 'k': $memLimit *= 1024;
}
if ($memLimit >= 0 and $memLimit < 67108864) {
- ini_set('memory_limit', '64M');
+ ini_set('memory_limit', '64M');
}
require_once 'CRM/Core/ClassLoader.php';
*
* (PHP 5)
*
- * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
- * @copyright Copyright CiviCRM LLC (C) 2009
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* GNU Affero General Public License version 3
- * @version $Id: Utils.php 40328 2012-05-11 23:06:13Z allen $
- * @package CiviCRM
+ * @version $Id: Utils.php 40328 2012-05-11 23:06:13Z allen $
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Utility functions
- * @package CiviCRM
+ * @package CiviCRM
*/
class Utils {
/**
* PDO for the database
- * @var PDO
+ * @var PDO
*/
public $pdo;
* Prepare and execute a query
*
* If the query fails, output a diagnostic message
- * @param string Query to run
- * @return mixed PDOStatement => Results of the query
+ * @param string Query to run
+ * @return mixed PDOStatement => Results of the query
* false => Query failed
*/
public function do_query($query) {
// ...need to use mouseDownAt on first result (which is a li element), click does not work
$this->clickAt("xpath=//div[@class='select2-result-label']");
- $this->waitForText("xpath=//div[@id='s2id_target_contact_id']","$contact1");
+ $this->waitForText("xpath=//div[@id='s2id_target_contact_id']", "$contact1");
$this->assertElementContainsText("xpath=//div[@id='s2id_target_contact_id']", "Karan, $contact1", 'Contact not found in line ' . __LINE__);
-
//Assigned To field
$this->click("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input");
$this->keyDown("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input", " ");
$this->clickAt("xpath=//div[@class='select2-result-label']");
// ...again, waiting for the box with contact name to show up...
- $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']","$contact2");
+ $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']", "$contact2");
// ...and verifying if the page contains properly formatted display name for chosen contact.
$this->assertElementContainsText("xpath=//div[@id='s2id_assignee_contact_id']", "Jane, $contact2", 'Contact not found in line ' . __LINE__);
$this->clickAt("xpath=//div[@class='select2-result-label']");
// ...again, waiting for the box with contact name to show up...
- $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']","$firstName1");
+ $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']", "$firstName1");
// ...and verifying if the page contains properly formatted display name for chosen contact.
$this->assertElementContainsText("xpath=//div[@id='s2id_assignee_contact_id']", "Summerson, $firstName1", 'Contact not found in line ' . __LINE__);
// ...need to use mouseDownAt on first result (which is a li element), click does not work
$this->clickAt("xpath=//div[@class='select2-result-label']");
-
// ...and verifying if the page contains properly formatted display name for chosen contact.
$this->waitForText("xpath=//div[@id='s2id_target_contact_id']", "$firstName1", 'Contact not found in line ' . __LINE__);
// ...need to use mouseDownAt on first result (which is a li element), click does not work
$this->clickAt("xpath=//div[@class='select2-result-label']");
-
// ...and verifying if the page contains properly formatted display name for chosen contact.
$this->waitForText("xpath=//div[@id='s2id_target_contact_id']", "$firstName2", 'Contact not found in line ' . __LINE__);
$this->waitForElementPresent("xpath=//div[@class='select2-result-label']");
$this->clickAt("xpath=//div[@class='select2-result-label']");
- $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']","$firstName1");
+ $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']", "$firstName1");
$subject = "Testing Ical attachment for activity assignee";
$this->type("subject", $subject);
$this->clickAt("xpath=//div[@class='select2-result-label']");
// ...again, waiting for the box with contact name to show up (span with delete token class indicates that it's present)...
- $this->waitForText("xpath=//div[@id='s2id_target_contact_id']","$firstName1");
+ $this->waitForText("xpath=//div[@id='s2id_target_contact_id']", "$firstName1");
//..and verifying if the page contains properly formatted display name for chosen contact.
$this->assertElementContainsText("xpath=//div[@id='s2id_target_contact_id']", "Anderson, $firstName1", 'Contact not found in line ' . __LINE__);
$this->clickAt("xpath=//div[@class='select2-result-label']");
// ...again, waiting for the box with contact name to show up...
- $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']","$firstName2");
+ $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']", "$firstName2");
// ...and verifying if the page contains properly formatted display name for chosen contact.
$this->assertElementContainsText("xpath=//div[@id='s2id_assignee_contact_id']", "Summerson, $firstName2", 'Contact not found in line ' . __LINE__);
*/
public function VerifyTabularData($expected, $xpathPrefix = NULL) {
foreach ($expected as $label => $value) {
- $this->waitForElementPresent("xpath=//table/tbody/tr/td{$xpathPrefix}[text()='{$label}']/../following-sibling::td/span");
- $this->verifyText("xpath=//table/tbody/tr/td{$xpathPrefix}[text()='{$label}']/../following-sibling::td/span", preg_quote($value), 'In line ' . __LINE__);
+ $this->waitForElementPresent("xpath=//table/tbody/tr/td{$xpathPrefix}[text()='{$label}']/../following-sibling::td/span");
+ $this->verifyText("xpath=//table/tbody/tr/td{$xpathPrefix}[text()='{$label}']/../following-sibling::td/span", preg_quote($value), 'In line ' . __LINE__);
}
}
}
}
//Go to the contacts page and check that the custom field is in the right group
- $this->openCiviPage('contact/view',"reset=1&cid={$cid_all}");
+ $this->openCiviPage('contact/view', "reset=1&cid={$cid_all}");
//load the names of the custom fieldsets
$source = $this->webtest_civicrm_api("CustomGroup", "get", array('id' => $from_group_id));
$this->select("date_format", "value=yy-mm-dd");
$this->click("//option[@value='yy-mm-dd']");
break;
+
//TODO allow for more things....
}
* @param string $prefix
* @param array $values
*/
- function _createFieldOptions($count = 3, $prefix = "option", $values = array(
- )) {
+ function _createFieldOptions($count = 3, $prefix = "option", $values = array()) {
// Only support up to 10 options on the creation form
$count = $count > 10 ? 10 : $count;
/**
* Class containing all CRM test suites
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class WebTest_AllTests extends CiviTestSuite {
private static $instance = NULL;
$this->type("followup_activity_subject", "This is subject of schedule follow-up activity");
// Clicking save.
- $this->clickLink("_qf_Activity_upload",'link=View',FALSE);
+ $this->clickLink("_qf_Activity_upload", 'link=View', FALSE);
// Is status message correct?
$this->waitForText('crm-notification-container', $subject);
$this->waitForPageToLoad($this->getTimeoutMsec());
// verify undelivered status message
- $this->assertElementContainsText('crm-container',"Delivery has not yet begun for this mailing. If the scheduled delivery date and time is past, ask the system administrator or technical support contact for your site to verify that the automated mailer task ('cron job') is running - and how frequently.");
+ $this->assertElementContainsText('crm-container', "Delivery has not yet begun for this mailing. If the scheduled delivery date and time is past, ask the system administrator or technical support contact for your site to verify that the automated mailer task ('cron job') is running - and how frequently.");
// do check for recipient group
$this->assertElementContainsText('crm-container', "Members of $groupName");
$this->type("invoice_id", time());
$this->webtestFillDate('thankyou_date');
-
//Premium section
$this->click("Premium");
$this->waitForElementPresent("fulfilled_date");
$this->waitForElementPresent("_qf_Fee_upload-bottom");
$this->click("CIVICRM_QFID_1_is_monetary");
$this->check("payment_processor[$processorId]");
- $this->select("financial_type_id", "value=4");
+ $this->select("financial_type_id", "value=4");
if ($priceSet) {
// get one - TBD
}
$this->waitForElementPresent("_qf_Interview_cancel_interview");
$this->click("CIVICRM_QFID_1_2");
- $this->select("xpath=//table[@class='display crm-copy-fields dataTable no-footer']/tbody/tr[1]/td[8]/select","value=Label $title 1");
+ $this->select("xpath=//table[@class='display crm-copy-fields dataTable no-footer']/tbody/tr[1]/td[8]/select", "value=Label $title 1");
$this->click("xpath=//table[@class='display crm-copy-fields dataTable no-footer']/tbody/tr[1]/td[9]/a");
$this->click("CIVICRM_QFID_2_8");
- $this->select("xpath=//table[@class='display crm-copy-fields dataTable no-footer']/tbody/tr[2]/td[8]/select","value=Label $title 2");
+ $this->select("xpath=//table[@class='display crm-copy-fields dataTable no-footer']/tbody/tr[2]/td[8]/select", "value=Label $title 2");
$this->click("xpath=//table[@class='display crm-copy-fields dataTable no-footer']/tbody/tr[2]/td[9]/a");
$this->click("_qf_Interview_cancel_interview");
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->waitForElementPresent('_qf_Search_refresh');
$this->clickLink("_qf_Search_refresh");
- $this->waitForText("xpath=//div[@id='search-status']/table/tbody/tr[1]/td[1]",'1 Result');
+ $this->waitForText("xpath=//div[@id='search-status']/table/tbody/tr[1]/td[1]", '1 Result');
}
public function testSurveyReportTest() {
$this->clickAt("xpath=//div[@class='select2-result-label']");
// ...again, waiting for the box with contact name to show up...
- $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']","$firstName1");
+ $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']", "$firstName1");
// ...and verifying if the page contains properly formatted display name for chosen contact.
$this->assertElementContainsText("xpath=//div[@id='s2id_assignee_contact_id']", "Summerson, $firstName1", 'Contact not found in line ' . __LINE__);
//change the case status to Resolved to get the end date
$this->click("xpath=//form[@id='CaseView']/div[2]/table/tbody/tr/td[4]/a");
$this->waitForElementPresent("_qf_Activity_cancel-bottom");
- $this->select("case_status_id","value=2");
+ $this->select("case_status_id", "value=2");
$this->click("_qf_Activity_upload-top");
$this->_testSearchbyDate($client['first_name'], $client['last_name'], "this.quarter");
*
* test for assign case to another client
*/
- public function _testAssignToClient($firstName, $lastName, $caseTypeLabel) {
+ public function _testAssignToClient($firstName, $lastName, $caseTypeLabel) {
$this->openCiviPage('case/search', 'reset=1', '_qf_Search_refresh-bottom');
$this->type('sort_name', $firstName);
$this->clickLink('_qf_Search_refresh-bottom');
public function testAddEditCaseType() {
$caseRoles = array(1 => 'Parent of', 2 => 'Spouse of', 3 => 'Partner of');
- $activityTypes = array(1 => 'Meeting',2 => 'Contribution',3 => 'Event Registration');
- $timelineActivityTypes = array(1 => 'Meeting',2 => 'Phone Call',3 => 'Email');
+ $activityTypes = array(1 => 'Meeting', 2 => 'Contribution', 3 => 'Event Registration');
+ $timelineActivityTypes = array(1 => 'Meeting', 2 => 'Phone Call', 3 => 'Email');
// Log in as admin first to verify permissions for CiviCase
$this->webtestLogin('admin');
*
* @return array
*/
- public function _testGetCustomFieldId($customGrpId1, $noteRichEditor=FALSE) {
+ public function _testGetCustomFieldId($customGrpId1, $noteRichEditor = FALSE) {
$customId = array();
$this->openCiviPage('admin/custom/group/field/add', array('reset' => 1, 'action' => 'add', 'gid' => $customGrpId1));
$this->select('task', "label=Add Contacts to Event");
-
// Select event. Based on label for now.
$this->waitForElementPresent('event_id');
$this->select2('event_id', "Rain-forest Cup Youth Soccer Tournament");
//create new current employer
$currentEmployer = substr(sha1(rand()), 0, 7) . "Web Access";
-
//fill in email
$this->type("email_1_email", substr(sha1(rand()), 0, 7) . "john@gmail.com");
/**
* @param array $openedPanes
*/
- function _checkOpenedPanes($openedPanes = array(
- )) {
+ function _checkOpenedPanes($openedPanes = array()) {
if (!$this->isTextPresent('None found.')) {
$this->click('css=div.crm-advanced_search_form-accordion div.crm-accordion-header');
}
* @param $paneRef
* @param array $selectFields
*/
- function _selectPaneFields($paneRef, $selectFields = array(
- )) {
+ function _selectPaneFields($paneRef, $selectFields = array()) {
$pane = $this->_advanceSearchPanes($paneRef);
$this->click("css=div.crm-accordion-wrapper {$pane['headerLocator']}");
$cal = $count / $perPageRow;
$mod = $count % $perPageRow;
$j = 1;
- for ($i=1; $i<=$cal; $i++) {
+ for ($i = 1; $i <= $cal; $i++) {
$subTotal = $i * $perPageRow;
$lastPageSub = $subTotal + 1;
$this->select2("group", "Summer", TRUE);
$this->select2("group", "Advisory", TRUE);
$this->clickAjaxLink("location", 'country');
- $this->select2("country", "United States", False);
+ $this->select2("country", "United States", FALSE);
$this->waitForElementPresent('state_province');
$this->multiselect2("state_province", array("Ohio", "New York", "New Mexico", "Connecticut", "Georgia", "New Jersey", "Texas"));
$this->clickLink("_qf_Advanced_refresh", "xpath=//div[@class='crm-search-results']//table/tbody/tr[1]/td[6]");
$this->click("xpath=//div[@id='activity']/table/tbody/tr[2]/td[1]/div[1]//div/label[text()=\"$labels\"]");
}
// fill date range
- $this->select("activity_date_relative","value=0");
+ $this->select("activity_date_relative", "value=0");
$this->webtestFillDate("activity_date_low", "-1 day");
$this->webtestFillDate("activity_date_high", "+1 day");
$this->type("activity_subject", "Student - membership source$firstName - Status: New");
// function to fill demographic search details
public function addDemographicSearchDetail() {
// fill birth date range
- $this->select("birth_date_relative","value=0");
+ $this->select("birth_date_relative", "value=0");
$this->webtestFillDate("birth_date_low", "-3 year");
$this->webtestFillDate("birth_date_high", "now");
// fill deceased date range
$this->click("xpath=//div[@id='demographics']/table/tbody//tr/td/label[text()='Deceased']/../label[text()='Yes']");
- $this->select("deceased_date_relative","value=0");
+ $this->select("deceased_date_relative", "value=0");
$this->webtestFillDate("deceased_date_low", "-1 month");
$this->webtestFillDate("deceased_date_high", "+1 month");
// fill gender (male)
*/
public function addContributionSearchDetail($firstName) {
// fill contribution date range
- $this->select("contribution_date_relative","value=0");
+ $this->select("contribution_date_relative", "value=0");
$this->webtestFillDate("contribution_date_low", "-1 day");
$this->webtestFillDate("contribution_date_high", "+1 day");
// fill amount range
$this->type("contribution_check_number", "chqNo$firstName");
// fill transaction id
$this->type("contribution_transaction_id", "trid$firstName");
- // fill financial type
- $this->select("financial_type_id", "Event Fee");
+ // fill financial type
+ $this->select("financial_type_id", "Event Fee");
// fill currency type
$this->select("contribution_currency_type", "USD");
}
// check to search primary member
$this->click("xpath=//div[@id='memberForm']/table/tbody/tr[2]/td[2]/p/input");
// add join date range
- $this->select("member_join_date_relative","value=0");
+ $this->select("member_join_date_relative", "value=0");
$this->webtestFillDate("member_join_date_low", "-1 day");
$this->webtestFillDate("member_join_date_high", "+1 day");
// add start date range
- $this->select("member_start_date_relative","value=0");
+ $this->select("member_start_date_relative", "value=0");
$this->webtestFillDate("member_start_date_low", "-1 day");
$this->webtestFillDate("member_start_date_high", "+1 day");
// add end date range
- $this->select("member_end_date_relative","value=0");
+ $this->select("member_end_date_relative", "value=0");
$this->webtestFillDate("member_end_date_low", "-1 year");
$this->webtestFillDate("member_end_date_high", "+2 year");
}
*/
public function addPledgeSearchDetail($firstName) {
// fill pledge schedule date range
- $this->select("pledge_payment_date_relative","value=0");
+ $this->select("pledge_payment_date_relative", "value=0");
$this->webtestFillDate("pledge_payment_date_low", "-1 day");
$this->webtestFillDate("pledge_payment_date_high", "+1 day");
// fill Pledge payment status
$Id = explode('-', $this->getAttribute("xpath=//div[@id='event_status_id']/div[2]/table/tbody/tr@id"));
$eventId = $Id[1];
- $params = array('label_a_b' => 'Owner of ' . rand(),
+ $params = array(
+ 'label_a_b' => 'Owner of ' . rand(),
'label_b_a' => 'Belongs to ' . rand(),
'contact_type_a' => 'Individual',
'contact_type_b' => 'Individual',
$this->assertElementContainsText('search-status', '2 Contacts');
}
- public function testAdvanceSearchForLog() {
+ public function testAdvanceSearchForLog() {
$this->webtestLogin();
- $Pdate = date('F jS, Y h:i:s A', mktime( 0, 0, 0, date( 'm' ), date( 'd' ) - 1, date( 'Y' )) );
- $Ndate = date('F jS, Y h:i:s A', mktime( 0, 0, 0, date( 'm' ), date( 'd' ) + 1, date( 'Y' )) );
+ $Pdate = date('F jS, Y h:i:s A', mktime( 0, 0, 0, date( 'm' ), date( 'd' ) - 1, date( 'Y' )) );
+ $Ndate = date('F jS, Y h:i:s A', mktime( 0, 0, 0, date( 'm' ), date( 'd' ) + 1, date( 'Y' )) );
//create a contact and return the contact id
$firstNameSoft = "John_".substr(sha1(rand()), 0, 5);
$this->type('sort_name', $lastNameSoft.', '.$firstNameSoft);
$this->click('changeLog');
$this->waitForElementPresent("log_date_low");
- $this->select("log_date_relative","value=0");
+ $this->select("log_date_relative", "value=0");
$this->webtestFillDate('log_date_low', "-1 day");
$this->webtestFillDate('log_date_high', "+1 day");
$this->click('_qf_Advanced_refresh');
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->assertTrue(True, 'greater than or equal to "{$Pdate}" AND less than or equal to "{$Ndate}"');
+ $this->assertTrue(TRUE, 'greater than or equal to "{$Pdate}" AND less than or equal to "{$Ndate}"');
$value = "$lastNameSoft, $firstNameSoft";
$this->verifyText("xpath= id('rowid{$cid}')/td[3]/a", preg_quote($value));
-}
+ }
}
// ...need to use mouseDownAt on first result (which is a li element), click does not work
$this->clickAt("xpath=//div[@class='select2-result-label']");
-
// Type search name in autocomplete.
$this->click("css=input#sort_name_navigation");
$this->type("css=input#sort_name_navigation", $firstName);
//Get the customFieldsetID
$this->openCiviPage('admin/custom/group', 'reset=1');
$customFieldsetId = explode('&gid=', $this->getAttribute("xpath=//div[@id='custom_group']//table/tbody//tr/td/span[text()='$customGroupTitle']/../../td[7]/span/a@href"));
- $customFieldsetId = $customFieldsetId[1];
+ $customFieldsetId = $customFieldsetId[1];
//create Individual contact
$this->openCiviPage("contact/add", "reset=1&ct=Individual");
$this->click("xpath=//table//tr/td/label[text()=\"$customField\"]");
$value = "custom".rand();
- $this->type("xpath=//table//tr/td/label[text()=\"$customField\"]/../following-sibling::td/input",$value);
+ $this->type("xpath=//table//tr/td/label[text()=\"$customField\"]/../following-sibling::td/input", $value);
//check for matching contact
$this->click("_qf_Contact_refresh_dedupe");
$this->clickLink("xpath=//ul[@id='actions']/li[2]/a/span");
$this->click("xpath=//table//tr/td/label[text()=\"$customField\"]");
$value1 = "custom_1".rand();
- $this->type("xpath=//table//tr/td/label[text()=\"$customField\"]/../following-sibling::td/input",$value1);
+ $this->type("xpath=//table//tr/td/label[text()=\"$customField\"]/../following-sibling::td/input", $value1);
$this->click("_qf_Contact_upload_view-bottom");
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->click("css=#tab_log a");
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->waitForText('crm-notification-container', "Contact Saved");
- $this->openCiviPage('contact/add' , 'reset=1&ct=Individual');
+ $this->openCiviPage('contact/add', 'reset=1&ct=Individual');
//contact details section
$firstName = 'WebTest' . substr(sha1(rand()), 0, 7);
$lastName = 'ContactEdit' . substr(sha1(rand()), 0, 7);
$this->openCiviPage("contact/add", "reset=1&ct=Individual");
- $this->type("first_name",$firstName);
- $this->type("last_name",$lastName);
+ $this->type("first_name", $firstName);
+ $this->type("last_name", $lastName);
//fill in phone 1
$this->type("phone_1_phone", "111113333");
$this->type("phone_2_phone_ext", "111");
$this->select('phone_2_location_type_id', 'value=3');
- //Edit in phone 3
+ //Edit in phone 3
$this->type("phone_3_phone", "777777699");
$this->type("phone_3_phone_ext", "197");
$this->select('phone_3_location_type_id', 'value=1');
$this->waitForTextPresent("The role has been deleted.");
}
- /**
- * Webtest for add contact to group (CRM-15108)
- */
+ /**
+ * Webtest for add contact to group (CRM-15108)
+ */
public function testAddContactToGroup() {
$this->webtestLogin();
$this->openCiviPage("contact/add", "reset=1&ct=Individual");
$this->openCiviPage('contact/search', 'reset=1');
$this->waitForElementPresent("_qf_Basic_refresh");
$this->type('sort_name', $firstName);
- $this->select('group',"Advisory Board");
+ $this->select('group', "Advisory Board");
$this->click('_qf_Basic_refresh');
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->assertTrue($this->isElementPresent("xpath=//table/tbody//tr/td[3]/a[text()='{$lastName}, {$firstName}']"));
case 'boolean':
$this->click($item);
break;
+
case 'string':
if (substr($val, 0, 5) == 'date:') {
$this->webtestFillDate($item, trim(substr($val, 5)));
$this->type($item, $val);
}
break;
+
case 'integer':
$method = $val ? 'check' : 'uncheck';
$this->$method($item);
break;
+
case 'array':
foreach ($val as $option) {
$selector = is_int($option) ? 'value' : 'label';
}
}
$this->click("css=#$block input.crm-form-submit");
- if ($valid !== 'error' && $valid !='errorJs') {
+ if ($valid !== 'error' && $valid != 'errorJs') {
// Verify the form saved
$this->waitForElementPresent("css=#$block > .crm-inline-block-content");
$validate = FALSE;
$this->assertElementValueEquals($item, $val);
}
break;
+
case 'integer':
$method = $val ? 'assertChecked' : 'assertNotChecked';
$this->$method($item);
break;
+
case 'array':
foreach ($val as $option) {
$method = is_int($option) ? 'assertIsSelected' : 'assertSelected';
case 'errorJs':
$this->waitForElementPresent('css=label.error');
break;
+
default:
$this->waitForElementPresent('css=#crm-notification-container .error.ui-notify-message');
$this->click('css=#crm-notification-container .error .ui-notify-cross');
// Now we're filling the "Assigned To" field.
// Typing contact's name into the field (using typeKeys(), not type()!)...
- $this->select2("assignee_contact_id", $firstName,TRUE,FALSE);
+ $this->select2("assignee_contact_id", $firstName, TRUE, FALSE);
// ...and verifying if the page contains properly formatted display name for chosen contact.
$this->assertTrue($this->isTextPresent("$lastName, " . $firstName), "Contact not found in line " . __LINE__);
$firstName = "Kerry".substr(sha1(rand()), 0, 7);
//last name
$lastName = "King".substr(sha1(rand()), 0, 7);
- $this->_createContacts($firstName,$lastName);
+ $this->_createContacts($firstName, $lastName);
//add contact2 and its duplicate
//These are the contacts with conflicts in communication preference.these contacts will be skipped during merge.
$firstName2 = "David".substr(sha1(rand()), 0, 7);
//fill in last name
$lastName2 = "Gilmour".substr(sha1(rand()), 0, 7);
- $this->_createContacts($firstName2,$lastName2);
+ $this->_createContacts($firstName2, $lastName2);
// add contact4 and its duplicate
//fill in first name
$firstName3 = "Dave".substr(sha1(rand()), 0, 7);
//fill in last name
$lastName3 = "Mustaine".substr(sha1(rand()), 0, 7);
- $this->_createContacts($firstName3,$lastName3);
+ $this->_createContacts($firstName3, $lastName3);
// Find and Merge Contacts with Supervised Rule
$this->openCiviPage("contact/dedupefind", "reset=1&rgid=1&action=renew", "css=#DedupeFind table.pagerDisplay tbody tr");
// Check confirmation alert.
$this->assertTrue(
- (bool)preg_match("/^This will run the batch merge process on the listed duplicates. The operation will run in safe mode - only records with no direct data conflicts will be merged. Click OK to proceed if you are sure you wish to run this operation./",
+ (bool) preg_match("/^This will run the batch merge process on the listed duplicates. The operation will run in safe mode - only records with no direct data conflicts will be merged. Click OK to proceed if you are sure you wish to run this operation./",
$this->getConfirmation()
));
$this->chooseOkOnNextConfirmation();
$this->openCiviPage("contact/dedupefind", "reset=1&action=update&rgid=4");
$this->click("xpath=//a/span[text()='Refresh Duplicates']");
- $this->assertTrue((bool)preg_match("/This will refresh the duplicates list. Click OK to proceed./", $this->getConfirmation()));
+ $this->assertTrue((bool) preg_match("/This will refresh the duplicates list. Click OK to proceed./", $this->getConfirmation()));
$this->chooseOkOnNextConfirmation();
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->waitForElementPresent("xpath=//a[text()='$firstName $lastName']/../../td[4]/a[text()='merge']");
$this->waitForPageToLoad($this->getTimeoutMsec());
// Check confirmation alert.
- $this->assertTrue((bool)preg_match("/One or more contact subtypes have been de-selected from the list for this contact. Any custom data associated with de-selected subtype will be removed. Click OK to proceed, or Cancel to review your changes before saving./", $this->getConfirmation()));
+ $this->assertTrue((bool) preg_match("/One or more contact subtypes have been de-selected from the list for this contact. Any custom data associated with de-selected subtype will be removed. Click OK to proceed, or Cancel to review your changes before saving./", $this->getConfirmation()));
$this->chooseOkOnNextConfirmation();
$this->waitForPageToLoad($this->getTimeoutMsec());
//fill in the individual
$this->select2('related_contact_id', $sortName, TRUE);
-
//fill in the relationship start date
$this->webtestFillDate('start_date', '-2 year');
$this->webtestFillDate('end_date', '+1 year');
//fill in the individual
$this->select2('related_contact_id', $sortName, TRUE);
-
//fill in the relationship start date
$this->webtestFillDate('start_date', '-2 year');
$this->webtestFillDate('end_date', '+1 year');
$this->type('organization_name', $orgName);
$this->type('email-Primary', "info@" . $orgName . ".com");
$this->click('_qf_Edit_next');
- $this->waitForText("xpath=//div[@id='s2id_related_contact_id']","$orgName");
+ $this->waitForText("xpath=//div[@id='s2id_related_contact_id']", "$orgName");
//fill in the relationship start date
$this->webtestFillDate('start_date', '-2 year');
//$this->click("_qf_Relationship_upload");
$this->click("_qf_Relationship_upload-bottom");
-
//check the status message
$this->waitForText('crm-notification-container', 'Relationship created.');
$this->type('organization_name', $orgName);
$this->type('email-Primary', "info@" . $orgName . ".com");
$this->click('_qf_Edit_next');
- $this->waitForText("xpath=//div[@id='s2id_related_contact_id']","$orgName");
+ $this->waitForText("xpath=//div[@id='s2id_related_contact_id']", "$orgName");
//fill in the relationship start date
$this->webtestFillDate('start_date', '-2 year');
$description = "Current employee test.";
$this->type("description", $description);
-
//save the relationship
//$this->click("_qf_Relationship_upload");
$this->click('_qf_Relationship_upload-bottom');
'Status' => 'Enabled',
)
);
- $this->assertTrue($this->isTextPresent("Employee of"),"Employee of relationship type not visible on View Relationship page.");
+ $this->assertTrue($this->isTextPresent("Employee of"), "Employee of relationship type not visible on View Relationship page.");
}
}
// add to group
$this->select("group_id", "label=$groupName");
$this->click("_qf_GroupContact_next");
- $this->waitForText("crm-notification-container","Contact has been added to '$groupName'.");
+ $this->waitForText("crm-notification-container", "Contact has been added to '$groupName'.");
// tag a contact
// visit tag tab
// add to group
$this->select("group_id", "label=$parentGroupName");
$this->click("_qf_GroupContact_next");
- $this->waitForText("crm-notification-container","Contact has been added to '$parentGroupName'.");
+ $this->waitForText("crm-notification-container", "Contact has been added to '$parentGroupName'.");
// Adding child group contact
// We're using Quick Add block on the main page for this.
// add to child group
$this->select("group_id", "*$childGroupName");
$this->click("_qf_GroupContact_next");
- $this->waitForText("crm-notification-container","Contact has been added to '$childGroupName'.");
+ $this->waitForText("crm-notification-container", "Contact has been added to '$childGroupName'.");
// visit contact search page
$this->openCiviPage("contact/search", "reset=1");
$this->webtestLogin();
$this->openCiviPage("contribute/search", "reset=1");
- $this->select("contribution_date_relative","value=previous_before.quarter");
+ $this->select("contribution_date_relative", "value=previous_before.quarter");
$this->click("_qf_Search_refresh");
$this->waitForPageToLoad(2 * $this->getTimeoutMsec());
- $this->select("contribution_date_relative","value=previous_2.quarter");
+ $this->select("contribution_date_relative", "value=previous_2.quarter");
$this->click("_qf_Search_refresh");
$this->waitForPageToLoad(2 * $this->getTimeoutMsec());
- $this->select("contribution_date_relative","value=earlier.quarter");
+ $this->select("contribution_date_relative", "value=earlier.quarter");
$this->click("_qf_Search_refresh");
$this->waitForPageToLoad(2 * $this->getTimeoutMsec());
- $this->select("contribution_date_relative","value=ending.year");
+ $this->select("contribution_date_relative", "value=ending.year");
$this->click("_qf_Search_refresh");
$this->waitForPageToLoad(2 * $this->getTimeoutMsec());
$this->openCiviPage("member/search", "reset=1");
- $this->select("member_end_date_relative","value=previous_before.month");
+ $this->select("member_end_date_relative", "value=previous_before.month");
$this->click("_qf_Search_refresh");
$this->waitForPageToLoad(2 * $this->getTimeoutMsec());
- $this->select("member_end_date_relative","value=previous_2.month");
+ $this->select("member_end_date_relative", "value=previous_2.month");
$this->click("_qf_Search_refresh");
$this->waitForPageToLoad(2 * $this->getTimeoutMsec());
- $this->select("member_end_date_relative","value=earlier.month");
+ $this->select("member_end_date_relative", "value=earlier.month");
$this->click("_qf_Search_refresh");
$this->waitForPageToLoad(2 * $this->getTimeoutMsec());
- $this->select("member_end_date_relative","value=ending.month");
+ $this->select("member_end_date_relative", "value=ending.month");
$this->click("_qf_Search_refresh");
$this->waitForPageToLoad(2 * $this->getTimeoutMsec());
$this->openCiviPage("event/search", "reset=1");
- $this->select("event_relative","value=previous_before.week");
+ $this->select("event_relative", "value=previous_before.week");
$this->click("_qf_Search_refresh");
$this->waitForPageToLoad(2 * $this->getTimeoutMsec());
- $this->select("event_relative","value=previous_2.week");
+ $this->select("event_relative", "value=previous_2.week");
$this->click("_qf_Search_refresh");
$this->waitForPageToLoad(2 * $this->getTimeoutMsec());
- $this->select("event_relative","value=earlier.week");
+ $this->select("event_relative", "value=earlier.week");
$this->click("_qf_Search_refresh");
$this->waitForPageToLoad(2 * $this->getTimeoutMsec());
- $this->select("event_relative","value=ending.week");
+ $this->select("event_relative", "value=ending.week");
$this->click("_qf_Search_refresh");
$this->waitForPageToLoad(2 * $this->getTimeoutMsec());
$this->openCiviPage("activity/search", "reset=1");
- $this->select("activity_date_relative","value=previous_before.day");
+ $this->select("activity_date_relative", "value=previous_before.day");
$this->click("_qf_Search_refresh");
$this->waitForPageToLoad(2 * $this->getTimeoutMsec());
- $this->select("activity_date_relative","value=previous_2.day");
+ $this->select("activity_date_relative", "value=previous_2.day");
$this->click("_qf_Search_refresh");
$this->waitForPageToLoad(2 * $this->getTimeoutMsec());
- $this->select("activity_date_relative","value=earlier.day");
+ $this->select("activity_date_relative", "value=earlier.day");
$this->click("_qf_Search_refresh");
$this->waitForPageToLoad(2 * $this->getTimeoutMsec());
- $this->select("activity_date_relative","value=ending.quarter");
+ $this->select("activity_date_relative", "value=ending.quarter");
$this->click("_qf_Search_refresh");
$this->waitForPageToLoad(2 * $this->getTimeoutMsec());
$this->openCiviPage("pledge/search", "reset=1");
- $this->select("pledge_payment_date_relative","value=greater.week");
+ $this->select("pledge_payment_date_relative", "value=greater.week");
$this->click("_qf_Search_refresh");
$this->waitForPageToLoad(2 * $this->getTimeoutMsec());
$this->click("xpath=//form[@id='Search']/div[2]/div/div");
- $this->select("pledge_payment_date_relative","value=greater.day");
+ $this->select("pledge_payment_date_relative", "value=greater.day");
$this->click("_qf_Search_refresh");
$this->waitForPageToLoad(2 * $this->getTimeoutMsec());
$this->click("xpath=//form[@id='Search']/div[2]/div/div");
- $this->select("pledge_payment_date_relative","value=greater.quarter");
+ $this->select("pledge_payment_date_relative", "value=greater.quarter");
$this->click("_qf_Search_refresh");
$this->waitForPageToLoad(2 * $this->getTimeoutMsec());
$this->click("xpath=//form[@id='Search']/div[2]/div/div");
- $this->select("pledge_payment_date_relative","value=greater.month");
+ $this->select("pledge_payment_date_relative", "value=greater.month");
$this->click("_qf_Search_refresh");
$this->waitForPageToLoad(2 * $this->getTimeoutMsec());
$this->openCiviPage("mailing", "reset=1");
- $this->select("mailing_relative","value=previous_before.year");
+ $this->select("mailing_relative", "value=previous_before.year");
$this->click("_qf_Search_refresh");
$this->waitForPageToLoad(2 * $this->getTimeoutMsec());
- $this->select("mailing_relative","value=previous_2.year");
+ $this->select("mailing_relative", "value=previous_2.year");
$this->click("_qf_Search_refresh");
$this->waitForPageToLoad(2 * $this->getTimeoutMsec());
- $this->select("mailing_relative","value=earlier.year");
+ $this->select("mailing_relative", "value=earlier.year");
$this->click("_qf_Search_refresh");
$this->waitForPageToLoad(2 * $this->getTimeoutMsec());
- $this->select("mailing_relative","value=greater.year");
+ $this->select("mailing_relative", "value=greater.year");
$this->click("_qf_Search_refresh");
$this->waitForPageToLoad(2 * $this->getTimeoutMsec());
}
/**
* @param array $openedPanes
*/
- function _checkOpenedPanes($openedPanes = array(
- )) {
+ function _checkOpenedPanes($openedPanes = array()) {
if (!$this->isTextPresent('None found.')) {
$this->click('css=div.crm-advanced_search_form-accordion div.crm-accordion-header');
}
* @param $paneRef
* @param array $selectFields
*/
- function _selectPaneFields($paneRef, $selectFields = array(
- )) {
+ function _selectPaneFields($paneRef, $selectFields = array()) {
$pane = $this->_advanceSearchPanesDateFilter($paneRef);
$this->click("css=div.crm-accordion-wrapper {$pane['headerLocator']}");
$this->select("task", "label=Add Contacts to Group");
$this->waitForPageToLoad($this->getTimeoutMsec());
- // Select the new group and click to add
+ // Select the new group and click to add
$this->click("group_id");
$this->select("group_id", "label=" . $newGroupName);
$this->click("_qf_AddToGroup_next-bottom");
public function testUpdateProfile() {
// Create new via profile
- include_once ('WebTest/Contact/AddViaProfileTest.php');
+ include_once 'WebTest/Contact/AddViaProfileTest.php';
WebTest_Contact_AddViaProfileTest::testAddViaCreateProfile();
// Open profile for editing
$this->click("css=span#{$row}.pledge-adjust-option a");
$this->type("field_{$row}_total_amount", $data['amount']);
}
- }
+ }
elseif ($type == "Contribution") {
$this->select("field_{$row}_financial_type", $data['financial_type']);
$this->type("field_{$row}_total_amount", $data['amount']);
$isDefault
);
- $this->webtestAddContact($firstName, "Anderson", true);
+ $this->webtestAddContact($firstName, "Anderson", TRUE);
// Get the contact id of the new contact
$contactUrl = $this->parseURL();
$this->type("invoice_id", time());
$this->webtestFillDate('thankyou_date');
-
//Premium section
$this->click("Premium");
$this->waitForElementPresent("fulfilled_date");
$this->type('first_name', $firstName);
$this->type('last_name', $lastName);
- $this->select('state_province-1',"value=1002");
+ $this->select('state_province-1', "value=1002");
$this->clickLink('_qf_Main_upload-bottom', '_qf_Confirm_next-bottom');
$this->click('_qf_Confirm_next-bottom');
$this->openCiviPage("contribute/search", "reset=1", 'contribution_date_low');
$this->type('sort_name', "$lastName $firstName");
- $this->select('financial_type_id',"label=Member Dues");
+ $this->select('financial_type_id', "label=Member Dues");
$this->clickLink('_qf_Search_refresh', "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']");
$this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", '_qf_ContributionView_cancel-bottom', FALSE);
$expected = array(
$this->click("xpath=id('Search')/div[2]/div/div[1]");
$this->waitForElementPresent("financial_type_id");
$this->type("sort_name", $firstName);
- $this->select('financial_type_id',"label=Donation");
+ $this->select('financial_type_id', "label=Donation");
$this->clickLink('_qf_Search_refresh', "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']");
$this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", '_qf_ContributionView_cancel-bottom', FALSE);
$this->type("invoice_id", time());
$this->webtestFillDate('thankyou_date');
-
-
//Premium section
$this->click("Premium");
$this->waitForElementPresent("fulfilled_date");
$pageId = $this->webtestAddContributionPage($hash,
$rand,
$pageTitle,
- null,
+ NULL,
$amountSection,
$payLater,
$onBehalf,
$honoreeSection
);
- $this->_testOrganization($pageId, $cid, $pageTitle);
+ $this->_testOrganization($pageId, $cid, $pageTitle);
}
public function testWithContactSubtypeDupe() {
$pageId = $this->webtestAddContributionPage($hash,
$rand,
$pageTitle,
- null,
+ NULL,
$amountSection,
$payLater,
$onBehalf,
$honoreeSection
);
- //Open Live Contribution Page
+ //Open Live Contribution Page
$this->openCiviPage("contribute/transact", "reset=1&id=$pageId", "_qf_Main_upload-bottom");
$this->waitForElementPresent("onbehalf_state_province-3");
$this->click("xpath=//div[@id='current-relationships']/div/table/tbody//tr/td[2]/a[text()='{$orgName1}']/../../td[9]/span[2][text()='more ']/ul/li[2]/a[text()='Delete']");
// Check confirmation alert.
- $this->assertTrue((bool)preg_match("/^Are you sure you want to delete this relationship?/",
+ $this->assertTrue((bool) preg_match("/^Are you sure you want to delete this relationship?/",
$this->getConfirmation()
));
$this->chooseOkOnNextConfirmation();
or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 0, 0, 0);
$text_color = imagecolorallocate($im, 233, 14, 91);
- imagestring($im, 1, 5, 5, "On Behalf-Org Logo", $text_color);
- imagepng($im,"/tmp/file.png");
+ imagestring($im, 1, 5, 5, "On Behalf-Org Logo", $text_color);
+ imagepng($im, "/tmp/file.png");
$imagePath = "/tmp/file.png";
$this->webtestAttachFile('onbehalf_image_URL', $imagePath);
$this->type("sort_name", "$lastName $firstName");
$this->clickLink("_qf_Search_refresh", "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']");
- $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom",FALSE);
+ $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom", FALSE);
//View Contribution Record and verify data
$expected = array(
// Is contact present?
$this->assertTrue($this->isTextPresent("$honorDisplayName"), "Honoree contact not found.");
- }
+ }
public function testOnlineContributionWithZeroAmount () {
$this->webtestLogin();
$this->clickLink("_qf_Confirm_next-bottom", NULL);
-
//login to check contribution
// Log in using webtestLogin() method
$this->webtestLogin();
- //Find Contribution
+ //Find Contribution
$this->openCiviPage("contribute/search", "reset=1", "contribution_date_low");
$this->type("sort_name", "$lastName $firstName");
$this->type("invoice_id", time());
$this->webtestFillDate('thankyou_date');
-
//Premium section
$this->click("Premium");
$this->waitForElementPresent("fulfilled_date");
// Clicking save.
$this->click("_qf_Contribution_upload");
// Ask for confirmation to send a receipt to the contributor on 'is_email_reciept' check
- $this->assertTrue((bool)preg_match("/^Click OK to save this contribution record AND send a receipt to the contributor now./",$this->getConfirmation()));
+ $this->assertTrue((bool) preg_match("/^Click OK to save this contribution record AND send a receipt to the contributor now./", $this->getConfirmation()));
$this->chooseOkOnNextConfirmation();
$this->waitForPageToLoad($this->getTimeoutMsec());
*/
class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase {
- protected function setUp() {
+ protected function setUp() {
parent::setUp();
}
- public function testChangeContributionAmount() {
- $this->webtestLogin();
- $amount = 100;
- //Offline Pay Later Contribution
- $contact = $this->_testOfflineContribution($amount, "Pending");
-
- $this->openCiviPage("contribute/search", "reset=1", "contribution_date_low");
-
- $this->type("sort_name", $contact['sort_name']);
- $this->click("_qf_Search_refresh");
-
- $this->waitForElementPresent("xpath=//*[@id='Search']//div[@id='contributionSearch']");
- $contriIDOff = explode('&', $this->getAttribute("xpath=//div[@id='contributionSearch']//table[@class='selector row-highlight']/tbody/tr[1]/td[11]/span/a[1]@href"));
- if (!empty($contriIDOff)) {
- $contriIDOff = substr($contriIDOff[1], (strrpos($contriIDOff[1], '=') + 1));
- }
-
- $this->clickLink("xpath=//tr[@id='rowid{$contriIDOff}']/td[11]/span/a[2]", "total_amount", FALSE);
- $this->type("total_amount", "90");
- $this->clickLink('_qf_Contribution_upload','',FALSE);
-
- // Is status message correct?
- $this->waitForText('crm-notification-container', "The contribution record has been saved.");
-
- //For Contribution
- $searchParams = array('id' => $contriIDOff);
- $compareParams = array('total_amount' => '90.00');
- //For LineItem
- $lineItemSearchParams = array('entity_id' => $contriIDOff);
- $lineItemCompareParams = array('line_total' => '90.00');
-
- $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compareParams);
- $this->assertDBCompareValues('CRM_Price_DAO_LineItem', $lineItemSearchParams, $lineItemCompareParams);
-
- $total = $this->_getTotalContributedAmount($contriIDOff);
- $compare = array('total_amount' => $total);
- $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compare);
-
- $amount = $this->_getFinancialItemAmount($contriIDOff);
- $compare = array('total_amount' => $amount);
- $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compare);
-
- $financialTrxnAmount = $this->_getFinancialTrxnAmount($contriIDOff);
- $compare = array('total_amount' => $financialTrxnAmount);
- $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compare);
- }
-
- public function testPayLater() {
- $this->webtestLogin();
- $amount = 100.00;
- //Offline Pay Later Contribution
- $this->_testOfflineContribution($amount, "Pending");
- $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']");
- $contId = $this->urlArg('id', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
- $this->clickAjaxLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom');
- $this->select("contribution_status_id", "label=Completed");
- $this->clickAjaxLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']");
- $this->checkCRMAlert("The contribution record has been saved.");
-
- //Assertions
- $search = array('id' => $contId);
- $compare = array('contribution_status_id' => 1);
- $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $search, $compare);
-
- $lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution'));
- $search = array( 'entity_id' => $lineItem );
- $compare = array( 'status_id' => 1 );
- $this->assertDBCompareValues("CRM_Financial_DAO_FinancialItem", $search, $compare);
-
- $status = $this->_getPremiumActualCost($contId, 'Accounts Receivable', 'Payment Processor Account', NULL, "'civicrm_contribution'", "ft.status_id as status");
- $this->assertEquals($status, '1', "Verify Completed Status");
- }
-
- public function testChangePremium() {
- $this->webtestLogin();
- $from = 'Premiums';
- $to = 'Premiums inventory';
- $financialType = array(
+ public function testChangeContributionAmount() {
+ $this->webtestLogin();
+ $amount = 100;
+ //Offline Pay Later Contribution
+ $contact = $this->_testOfflineContribution($amount, "Pending");
+
+ $this->openCiviPage("contribute/search", "reset=1", "contribution_date_low");
+
+ $this->type("sort_name", $contact['sort_name']);
+ $this->click("_qf_Search_refresh");
+
+ $this->waitForElementPresent("xpath=//*[@id='Search']//div[@id='contributionSearch']");
+ $contriIDOff = explode('&', $this->getAttribute("xpath=//div[@id='contributionSearch']//table[@class='selector row-highlight']/tbody/tr[1]/td[11]/span/a[1]@href"));
+ if (!empty($contriIDOff)) {
+ $contriIDOff = substr($contriIDOff[1], (strrpos($contriIDOff[1], '=') + 1));
+ }
+
+ $this->clickLink("xpath=//tr[@id='rowid{$contriIDOff}']/td[11]/span/a[2]", "total_amount", FALSE);
+ $this->type("total_amount", "90");
+ $this->clickLink('_qf_Contribution_upload', '', FALSE);
+
+ // Is status message correct?
+ $this->waitForText('crm-notification-container', "The contribution record has been saved.");
+
+ //For Contribution
+ $searchParams = array('id' => $contriIDOff);
+ $compareParams = array('total_amount' => '90.00');
+ //For LineItem
+ $lineItemSearchParams = array('entity_id' => $contriIDOff);
+ $lineItemCompareParams = array('line_total' => '90.00');
+
+ $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compareParams);
+ $this->assertDBCompareValues('CRM_Price_DAO_LineItem', $lineItemSearchParams, $lineItemCompareParams);
+
+ $total = $this->_getTotalContributedAmount($contriIDOff);
+ $compare = array('total_amount' => $total);
+ $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compare);
+
+ $amount = $this->_getFinancialItemAmount($contriIDOff);
+ $compare = array('total_amount' => $amount);
+ $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compare);
+
+ $financialTrxnAmount = $this->_getFinancialTrxnAmount($contriIDOff);
+ $compare = array('total_amount' => $financialTrxnAmount);
+ $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compare);
+ }
+
+ public function testPayLater() {
+ $this->webtestLogin();
+ $amount = 100.00;
+ //Offline Pay Later Contribution
+ $this->_testOfflineContribution($amount, "Pending");
+ $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']");
+ $contId = $this->urlArg('id', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
+ $this->clickAjaxLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom');
+ $this->select("contribution_status_id", "label=Completed");
+ $this->clickAjaxLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']");
+ $this->checkCRMAlert("The contribution record has been saved.");
+
+ //Assertions
+ $search = array('id' => $contId);
+ $compare = array('contribution_status_id' => 1);
+ $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $search, $compare);
+
+ $lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution'));
+ $search = array( 'entity_id' => $lineItem );
+ $compare = array( 'status_id' => 1 );
+ $this->assertDBCompareValues("CRM_Financial_DAO_FinancialItem", $search, $compare);
+
+ $status = $this->_getPremiumActualCost($contId, 'Accounts Receivable', 'Payment Processor Account', NULL, "'civicrm_contribution'", "ft.status_id as status");
+ $this->assertEquals($status, '1', "Verify Completed Status");
+ }
+
+ public function testChangePremium() {
+ $this->webtestLogin();
+ $from = 'Premiums';
+ $to = 'Premiums inventory';
+ $financialType = array(
'name' => 'Test Financial'.substr(sha1(rand()), 0, 7),
'is_reserved' => 1,
'is_deductible' => 1,
- );
- $this->addeditFinancialType($financialType);
- $this->waitForElementPresent("xpath=//div[@id='ltype']/div/table/tbody//tr/td[text()='".$financialType['name']."']/../td[7]/span/a[text()='Accounts']");
- $this->click("xpath=//div[@id='ltype']/div/table/tbody//tr/td[text()='".$financialType['name']."']/../td[7]/span/a[text()='Accounts']");
- $this->waitForElementPresent("xpath=//a[@id='newfinancialTypeAccount']");
- $this->clickAjaxLink("xpath=//a[@id='newfinancialTypeAccount']", "_qf_FinancialTypeAccount_cancel-botttom");
- $this->select("account_relationship", "label=Premiums Inventory Account is");
- $this->waitForElementPresent("xpath=//select[@id='financial_account_id']/option[3][text()='Deposit Bank Account']");
- $this->select("financial_account_id", "label=$to");
- $this->clickAjaxLink("_qf_FinancialTypeAccount_next-botttom", "xpath=//a[@id='newfinancialTypeAccount']");
-
- $premiumName = 'Premium'.substr(sha1(rand()), 0, 7);
- $amount = 500;
- $sku = 'SKU';
- $price = 300;
- $cost = 3.00;
- $this->openCiviPage("admin/contribute/managePremiums", "action=add&reset=1");
- // add premium
- $this->addPremium($premiumName, $sku, $amount, $price, $cost, $financialType['name']);
-
- //add second premium
- $premiumName2 = 'Premium'.substr(sha1(rand()), 0, 7);
- $amount2 = 600;
- $sku2 = 'SKU';
- $price2 = 200;
- $cost2 = 2.00;
- $this->openCiviPage("admin/contribute/managePremiums", "action=add&reset=1");
- $this->addPremium($premiumName2, $sku2, $amount2, $price2, $cost2, $financialType['name']);
-
- // add contribution with premium
- $this->openCiviPage("contribute/add", "reset=1&action=add&context=standalone");
-
- // create new contact using dialog
- $this->createDialogContact();
- // select financial type
- $this->select( "financial_type_id", "value=1" );
- // total amount
- $this->type("total_amount", "100");
- // fill Premium information
- $this->clickAjaxLink("xpath=//div[@id='Premium']", "product_name_0");
- $this->select('product_name_0', "label=$premiumName ( $sku )");
- // Clicking save.
- $this->clickAjaxLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']");
- // Is status message correct?
- $this->checkCRMAlert("The contribution record has been saved.");
- // verify if Contribution is created
- //click through to the Contribution edit screen
- $contId = $this->urlArg('id', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
- $this->clickAjaxLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", "product_name_0");
-
- $this->select('product_name_0', "label=$premiumName2 ( $sku2 )");
- // Clicking save.
- $this->clickAjaxLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[7][text()='$premiumName2']");
- $this->checkCRMAlert("The contribution record has been saved.");
-
- //Assertions
- $actualAmount = $this->_getPremiumActualCost($contId, $to, $from, $cost2, "'civicrm_contribution'");
- $this->assertEquals($actualAmount, $cost2, "Verify actual cost for changed premium");
-
- $deletedAmount = $this->_getPremiumActualCost($contId, $from, $to, $cost, "'civicrm_contribution'");
- $this->assertEquals($deletedAmount, $cost, "Verify actual cost for deleted premium");
- }
-
- public function testDeletePremium() {
- $this->webtestLogin();
- $from = 'Premiums';
- $to = 'Premiums inventory';
- $financialType = array(
+ );
+ $this->addeditFinancialType($financialType);
+ $this->waitForElementPresent("xpath=//div[@id='ltype']/div/table/tbody//tr/td[text()='".$financialType['name']."']/../td[7]/span/a[text()='Accounts']");
+ $this->click("xpath=//div[@id='ltype']/div/table/tbody//tr/td[text()='".$financialType['name']."']/../td[7]/span/a[text()='Accounts']");
+ $this->waitForElementPresent("xpath=//a[@id='newfinancialTypeAccount']");
+ $this->clickAjaxLink("xpath=//a[@id='newfinancialTypeAccount']", "_qf_FinancialTypeAccount_cancel-botttom");
+ $this->select("account_relationship", "label=Premiums Inventory Account is");
+ $this->waitForElementPresent("xpath=//select[@id='financial_account_id']/option[3][text()='Deposit Bank Account']");
+ $this->select("financial_account_id", "label=$to");
+ $this->clickAjaxLink("_qf_FinancialTypeAccount_next-botttom", "xpath=//a[@id='newfinancialTypeAccount']");
+
+ $premiumName = 'Premium'.substr(sha1(rand()), 0, 7);
+ $amount = 500;
+ $sku = 'SKU';
+ $price = 300;
+ $cost = 3.00;
+ $this->openCiviPage("admin/contribute/managePremiums", "action=add&reset=1");
+ // add premium
+ $this->addPremium($premiumName, $sku, $amount, $price, $cost, $financialType['name']);
+
+ //add second premium
+ $premiumName2 = 'Premium'.substr(sha1(rand()), 0, 7);
+ $amount2 = 600;
+ $sku2 = 'SKU';
+ $price2 = 200;
+ $cost2 = 2.00;
+ $this->openCiviPage("admin/contribute/managePremiums", "action=add&reset=1");
+ $this->addPremium($premiumName2, $sku2, $amount2, $price2, $cost2, $financialType['name']);
+
+ // add contribution with premium
+ $this->openCiviPage("contribute/add", "reset=1&action=add&context=standalone");
+
+ // create new contact using dialog
+ $this->createDialogContact();
+ // select financial type
+ $this->select( "financial_type_id", "value=1" );
+ // total amount
+ $this->type("total_amount", "100");
+ // fill Premium information
+ $this->clickAjaxLink("xpath=//div[@id='Premium']", "product_name_0");
+ $this->select('product_name_0', "label=$premiumName ( $sku )");
+ // Clicking save.
+ $this->clickAjaxLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']");
+ // Is status message correct?
+ $this->checkCRMAlert("The contribution record has been saved.");
+ // verify if Contribution is created
+ //click through to the Contribution edit screen
+ $contId = $this->urlArg('id', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
+ $this->clickAjaxLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", "product_name_0");
+
+ $this->select('product_name_0', "label=$premiumName2 ( $sku2 )");
+ // Clicking save.
+ $this->clickAjaxLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[7][text()='$premiumName2']");
+ $this->checkCRMAlert("The contribution record has been saved.");
+
+ //Assertions
+ $actualAmount = $this->_getPremiumActualCost($contId, $to, $from, $cost2, "'civicrm_contribution'");
+ $this->assertEquals($actualAmount, $cost2, "Verify actual cost for changed premium");
+
+ $deletedAmount = $this->_getPremiumActualCost($contId, $from, $to, $cost, "'civicrm_contribution'");
+ $this->assertEquals($deletedAmount, $cost, "Verify actual cost for deleted premium");
+ }
+
+ public function testDeletePremium() {
+ $this->webtestLogin();
+ $from = 'Premiums';
+ $to = 'Premiums inventory';
+ $financialType = array(
'name' => 'Test Financial' . substr(sha1(rand()), 0, 7),
'is_reserved' => 1,
'is_deductible' => 1,
- );
- $this->addeditFinancialType($financialType);
- $this->waitForElementPresent("xpath=//div[@id='ltype']/div/table/tbody//tr/td[text()='".$financialType['name']."']/../td[7]/span/a[text()='Accounts']");
- $this->click("xpath=//div[@id='ltype']/div/table/tbody//tr/td[text()='".$financialType['name']."']/../td[7]/span/a[text()='Accounts']");
- $this->waitForElementPresent("xpath=//a[@id='newfinancialTypeAccount']");
- $this->clickLink("xpath=//a[@id='newfinancialTypeAccount']", "_qf_FinancialTypeAccount_cancel-botttom", FALSE);
-
- $this->select("account_relationship", "label=Premiums Inventory Account is");
- $this->waitForElementPresent("xpath=//select[@id='financial_account_id']/option[3][text()='Deposit Bank Account']");
- $this->select("financial_account_id", "label=$to");
- $this->clickLink("_qf_FinancialTypeAccount_next-botttom", "xpath=//a[@id='newfinancialTypeAccount']", FALSE);
- $premiumName = 'Premium' . substr(sha1(rand()), 0, 7);
- $amount = 500;
- $sku = 'SKU';
- $price = 300;
- $cost = 3.00;
- $this->openCiviPage("admin/contribute/managePremiums", "action=add&reset=1");
- // add premium
- $this->addPremium($premiumName, $sku, $amount, $price, $cost, $financialType['name']);
-
- // add contribution with premium
- $this->openCiviPage("contribute/add", "reset=1&action=add&context=standalone");
-
- // create new contact using dialog
- $this->createDialogContact();
- // select financial type
- $this->select("financial_type_id", "value=1");
- // total amount
- $this->type("total_amount", "100");
- // fill Premium information
- $this->click("xpath=//div[@id='Premium']");
- $this->waitForElementPresent("product_name_0");
- $this->select('product_name_0', "label=$premiumName ( $sku )");
- // Clicking save.
- $this->clickLink("_qf_Contribution_upload");
- // Is status message correct?
- $this->waitForText('crm-notification-container', "The contribution record has been saved.");
- // verify if Contribution is created
- $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']");
- //click through to the Contribution edit screen
- $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
- $contId = explode('&', $contId[1]);
- $contId = $contId[0];
- $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", "_qf_Contribution_upload-bottom", FALSE);
- $this->waitForElementPresent("product_name_0");
- $this->select('product_name_0', "value=0");
- // Clicking save.
- $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[7][not(text())]", FALSE);
-
- //Assertions
- $actualAmount = $this->_getPremiumActualCost($contId, $from, $to, NULL, "'civicrm_contribution'");
- $this->assertEquals($actualAmount, $cost, "Verify actual cost for deleted premium");
- }
-
- public function testChangePaymentInstrument() {
- $this->webtestLogin();
- $label = 'TEST'.substr(sha1(rand()), 0, 7);
- $amount = 100.00;
- $financialAccount = CRM_Contribute_PseudoConstant::financialAccount();
- $to = array_search('Accounts Receivable', $financialAccount);
- $from = array_search('Deposit Bank Account', $financialAccount);
- $this->addPaymentInstrument($label, $to);
- $this->_testOfflineContribution($amount);
- $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']");
- $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom', FALSE);
- $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
- $contId = explode('&', $contId[1]);
- $contId = $contId[0];
- //change payment processor to newly created value
- $this->select("payment_instrument_id", "label=$label");
- $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", FALSE);
- $this->waitForAjaxContent();
- //Assertions
- $subtractedTotal = $this->_getPremiumActualCost($contId, NULL, 'Payment Processor Account');
- $this->assertEquals($subtractedTotal, -$amount, "Verify amount deleted from old account");
- $totalAmount = $this->_getPremiumActualCost($contId, NULL, 'Accounts Receivable');
- $this->assertEquals($totalAmount, $amount, "Verify amount for newly inserted values");
- }
-
- public function testRefundContribution() {
- $this->webtestLogin();
- $amount = 100.00;
- $this->_testOfflineContribution($amount);
- $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']");
- $this->clickAjaxLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom');
- //Contribution status
- $this->select("contribution_status_id", "label=Refunded");
- $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
- $contId = explode('&', $contId[1]);
- $contId = $contId[0];
- $this->clickAjaxLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[6][text()='Refunded']");
-
- //Assertions
- $lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution'));
- $search = array('entity_id' => $lineItem);
- $compare = array(
+ );
+ $this->addeditFinancialType($financialType);
+ $this->waitForElementPresent("xpath=//div[@id='ltype']/div/table/tbody//tr/td[text()='".$financialType['name']."']/../td[7]/span/a[text()='Accounts']");
+ $this->click("xpath=//div[@id='ltype']/div/table/tbody//tr/td[text()='".$financialType['name']."']/../td[7]/span/a[text()='Accounts']");
+ $this->waitForElementPresent("xpath=//a[@id='newfinancialTypeAccount']");
+ $this->clickLink("xpath=//a[@id='newfinancialTypeAccount']", "_qf_FinancialTypeAccount_cancel-botttom", FALSE);
+
+ $this->select("account_relationship", "label=Premiums Inventory Account is");
+ $this->waitForElementPresent("xpath=//select[@id='financial_account_id']/option[3][text()='Deposit Bank Account']");
+ $this->select("financial_account_id", "label=$to");
+ $this->clickLink("_qf_FinancialTypeAccount_next-botttom", "xpath=//a[@id='newfinancialTypeAccount']", FALSE);
+ $premiumName = 'Premium' . substr(sha1(rand()), 0, 7);
+ $amount = 500;
+ $sku = 'SKU';
+ $price = 300;
+ $cost = 3.00;
+ $this->openCiviPage("admin/contribute/managePremiums", "action=add&reset=1");
+ // add premium
+ $this->addPremium($premiumName, $sku, $amount, $price, $cost, $financialType['name']);
+
+ // add contribution with premium
+ $this->openCiviPage("contribute/add", "reset=1&action=add&context=standalone");
+
+ // create new contact using dialog
+ $this->createDialogContact();
+ // select financial type
+ $this->select("financial_type_id", "value=1");
+ // total amount
+ $this->type("total_amount", "100");
+ // fill Premium information
+ $this->click("xpath=//div[@id='Premium']");
+ $this->waitForElementPresent("product_name_0");
+ $this->select('product_name_0', "label=$premiumName ( $sku )");
+ // Clicking save.
+ $this->clickLink("_qf_Contribution_upload");
+ // Is status message correct?
+ $this->waitForText('crm-notification-container', "The contribution record has been saved.");
+ // verify if Contribution is created
+ $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']");
+ //click through to the Contribution edit screen
+ $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
+ $contId = explode('&', $contId[1]);
+ $contId = $contId[0];
+ $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", "_qf_Contribution_upload-bottom", FALSE);
+ $this->waitForElementPresent("product_name_0");
+ $this->select('product_name_0', "value=0");
+ // Clicking save.
+ $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[7][not(text())]", FALSE);
+
+ //Assertions
+ $actualAmount = $this->_getPremiumActualCost($contId, $from, $to, NULL, "'civicrm_contribution'");
+ $this->assertEquals($actualAmount, $cost, "Verify actual cost for deleted premium");
+ }
+
+ public function testChangePaymentInstrument() {
+ $this->webtestLogin();
+ $label = 'TEST'.substr(sha1(rand()), 0, 7);
+ $amount = 100.00;
+ $financialAccount = CRM_Contribute_PseudoConstant::financialAccount();
+ $to = array_search('Accounts Receivable', $financialAccount);
+ $from = array_search('Deposit Bank Account', $financialAccount);
+ $this->addPaymentInstrument($label, $to);
+ $this->_testOfflineContribution($amount);
+ $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']");
+ $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom', FALSE);
+ $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
+ $contId = explode('&', $contId[1]);
+ $contId = $contId[0];
+ //change payment processor to newly created value
+ $this->select("payment_instrument_id", "label=$label");
+ $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", FALSE);
+ $this->waitForAjaxContent();
+ //Assertions
+ $subtractedTotal = $this->_getPremiumActualCost($contId, NULL, 'Payment Processor Account');
+ $this->assertEquals($subtractedTotal, -$amount, "Verify amount deleted from old account");
+ $totalAmount = $this->_getPremiumActualCost($contId, NULL, 'Accounts Receivable');
+ $this->assertEquals($totalAmount, $amount, "Verify amount for newly inserted values");
+ }
+
+ public function testRefundContribution() {
+ $this->webtestLogin();
+ $amount = 100.00;
+ $this->_testOfflineContribution($amount);
+ $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']");
+ $this->clickAjaxLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom');
+ //Contribution status
+ $this->select("contribution_status_id", "label=Refunded");
+ $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
+ $contId = explode('&', $contId[1]);
+ $contId = $contId[0];
+ $this->clickAjaxLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[6][text()='Refunded']");
+
+ //Assertions
+ $lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution'));
+ $search = array('entity_id' => $lineItem);
+ $compare = array(
'amount' => '100.00',
'status_id' => 1,
- );
- $this->assertDBCompareValues("CRM_Financial_DAO_FinancialItem", $search, $compare);
- $amount = $this->_getPremiumActualCost($contId, NULL, 'Payment Processor Account', -100.00, "'civicrm_contribution'");
- $this->assertEquals($amount, '-100.00', 'Verify Financial Trxn Amount.');
- }
-
- public function testCancelPayLater() {
- $this->webtestLogin();
- $amount = 100.00;
- $this->_testOfflineContribution($amount, "Pending");
- $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']");
- $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom', FALSE);
- //Contribution status
- $this->select("contribution_status_id", "label=Cancelled");
- $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
- $contId = explode('&', $contId[1]);
- $contId = $contId[0];
- $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", FALSE);
- $this->waitForText('crm-notification-container', "The contribution record has been saved.");
-
- //Assertions
- $search = array('id' => $contId);
- $compare = array('contribution_status_id' => 3);
- $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $search, $compare);
- $lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution'));
- $itemParams = array(
+ );
+ $this->assertDBCompareValues("CRM_Financial_DAO_FinancialItem", $search, $compare);
+ $amount = $this->_getPremiumActualCost($contId, NULL, 'Payment Processor Account', -100.00, "'civicrm_contribution'");
+ $this->assertEquals($amount, '-100.00', 'Verify Financial Trxn Amount.');
+ }
+
+ public function testCancelPayLater() {
+ $this->webtestLogin();
+ $amount = 100.00;
+ $this->_testOfflineContribution($amount, "Pending");
+ $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']");
+ $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom', FALSE);
+ //Contribution status
+ $this->select("contribution_status_id", "label=Cancelled");
+ $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
+ $contId = explode('&', $contId[1]);
+ $contId = $contId[0];
+ $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", FALSE);
+ $this->waitForText('crm-notification-container', "The contribution record has been saved.");
+
+ //Assertions
+ $search = array('id' => $contId);
+ $compare = array('contribution_status_id' => 3);
+ $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $search, $compare);
+ $lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution'));
+ $itemParams = array(
'amount' => '-100.00',
'entity_id' => $lineItem,
- );
- $defaults = array();
- $items = CRM_Financial_BAO_FinancialItem::retrieve($itemParams, $defaults);
- $this->assertEquals($items->amount, $itemParams['amount'], 'Verify Amount for financial Item');
- $totalAmount = $this->_getPremiumActualCost($items->id, 'Accounts Receivable', NULL, "-100.00", "'civicrm_financial_item'");
- $this->assertEquals($totalAmount, "-$amount", 'Verify Amount for Financial Trxn');
- $totalAmount = $this->_getPremiumActualCost($contId, 'Accounts Receivable', NULL, "-100.00", "'civicrm_contribution'");
- $this->assertEquals($totalAmount, "-$amount", 'Verify Amount for Financial Trxn');
- }
-
- public function testChangeFinancialType() {
- $this->webtestLogin();
- $amount = 100.00;
- $this->_testOfflineContribution($amount);
- $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']");
- $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom', FALSE);
- //Contribution status
- $this->select("financial_type_id", "value=3");
- $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
- $contId = explode('&', $contId[1]);
- $contId = $contId[0];
- $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", FALSE);
- $this->waitForText('crm-notification-container', "The contribution record has been saved.");
-
- //Assertions
- $search = array( 'id' => $contId );
- $compare = array( 'financial_type_id' => 3 );
- $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $search, $compare);
-
- $lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution'));
- $itemParams = array(
+ );
+ $defaults = array();
+ $items = CRM_Financial_BAO_FinancialItem::retrieve($itemParams, $defaults);
+ $this->assertEquals($items->amount, $itemParams['amount'], 'Verify Amount for financial Item');
+ $totalAmount = $this->_getPremiumActualCost($items->id, 'Accounts Receivable', NULL, "-100.00", "'civicrm_financial_item'");
+ $this->assertEquals($totalAmount, "-$amount", 'Verify Amount for Financial Trxn');
+ $totalAmount = $this->_getPremiumActualCost($contId, 'Accounts Receivable', NULL, "-100.00", "'civicrm_contribution'");
+ $this->assertEquals($totalAmount, "-$amount", 'Verify Amount for Financial Trxn');
+ }
+
+ public function testChangeFinancialType() {
+ $this->webtestLogin();
+ $amount = 100.00;
+ $this->_testOfflineContribution($amount);
+ $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']");
+ $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom', FALSE);
+ //Contribution status
+ $this->select("financial_type_id", "value=3");
+ $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
+ $contId = explode('&', $contId[1]);
+ $contId = $contId[0];
+ $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", FALSE);
+ $this->waitForText('crm-notification-container', "The contribution record has been saved.");
+
+ //Assertions
+ $search = array( 'id' => $contId );
+ $compare = array( 'financial_type_id' => 3 );
+ $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $search, $compare);
+
+ $lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution'));
+ $itemParams = array(
'amount' => '-100.00',
'entity_id' => $lineItem,
- );
- $item1 = $item2 = array();
- CRM_Financial_BAO_FinancialItem::retrieve($itemParams, $item1);
- $this->assertEquals($item1['amount'], "-100.00", "Verify Amount for New Financial Item");
- $itemParams['amount'] = '100.00';
- CRM_Financial_BAO_FinancialItem::retrieve($itemParams, $item2);
- $this->assertEquals($item2['amount'], "100.00", "Verify Amount for New Financial Item");
-
- $cValue1 = $this->_getPremiumActualCost($contId, NULL, NULL, "-100.00", "'civicrm_contribution'");
- $fValue1 = $this->_getPremiumActualCost($item1['id'], NULL, NULL, "-100.00", "'civicrm_financial_item'");
- $this->assertEquals($cValue1, "-100.00", "Verify Amount");
- $this->assertEquals($fValue1, "-100.00", "Verify Amount");
- $cValue2 = $this->_getPremiumActualCost($contId, NULL, NULL, "100.00", "'civicrm_contribution'");
- $fValue2 = $this->_getPremiumActualCost($item2['id'], NULL, NULL, "100.00", "'civicrm_financial_item'");
- $this->assertEquals($cValue2, "100.00", "Verify Amount");
- $this->assertEquals($fValue2, "100.00", "Verify Amount");
- }
+ );
+ $item1 = $item2 = array();
+ CRM_Financial_BAO_FinancialItem::retrieve($itemParams, $item1);
+ $this->assertEquals($item1['amount'], "-100.00", "Verify Amount for New Financial Item");
+ $itemParams['amount'] = '100.00';
+ CRM_Financial_BAO_FinancialItem::retrieve($itemParams, $item2);
+ $this->assertEquals($item2['amount'], "100.00", "Verify Amount for New Financial Item");
+
+ $cValue1 = $this->_getPremiumActualCost($contId, NULL, NULL, "-100.00", "'civicrm_contribution'");
+ $fValue1 = $this->_getPremiumActualCost($item1['id'], NULL, NULL, "-100.00", "'civicrm_financial_item'");
+ $this->assertEquals($cValue1, "-100.00", "Verify Amount");
+ $this->assertEquals($fValue1, "-100.00", "Verify Amount");
+ $cValue2 = $this->_getPremiumActualCost($contId, NULL, NULL, "100.00", "'civicrm_contribution'");
+ $fValue2 = $this->_getPremiumActualCost($item2['id'], NULL, NULL, "100.00", "'civicrm_financial_item'");
+ $this->assertEquals($cValue2, "100.00", "Verify Amount");
+ $this->assertEquals($fValue2, "100.00", "Verify Amount");
+ }
/**
* @param int $entityId
* @return null|string
*/
function _getPremiumActualCost($entityId, $from = NULL, $to = NULL, $cost = NULL, $entityTable = NULL, $select = "ft.total_amount AS amount") {
- $financialAccount = CRM_Contribute_PseudoConstant::financialAccount();
- $query = "SELECT
+ $financialAccount = CRM_Contribute_PseudoConstant::financialAccount();
+ $query = "SELECT
{$select}
FROM civicrm_financial_trxn ft
INNER JOIN civicrm_entity_financial_trxn eft ON eft.financial_trxn_id = ft.id AND eft.entity_id = {$entityId}";
- if ($entityTable) {
- $query .= " AND eft.entity_table = {$entityTable}";
- }
- if (!empty($to)) {
- $to = array_search($to, $financialAccount);
- $query .= " AND ft.to_financial_account_id = {$to}";
- }
- if (!empty($from)) {
- $from = array_search($from, $financialAccount);
- $query .= " AND ft.from_financial_account_id = {$from}";
- }
- if (!empty($cost)) {
- $query .= " AND eft.amount = {$cost}";
- }
- $query .= " ORDER BY ft.id DESC LIMIT 1";
- $result = CRM_Core_DAO::singleValueQuery($query);
- return $result;
- }
+ if ($entityTable) {
+ $query .= " AND eft.entity_table = {$entityTable}";
+ }
+ if (!empty($to)) {
+ $to = array_search($to, $financialAccount);
+ $query .= " AND ft.to_financial_account_id = {$to}";
+ }
+ if (!empty($from)) {
+ $from = array_search($from, $financialAccount);
+ $query .= " AND ft.from_financial_account_id = {$from}";
+ }
+ if (!empty($cost)) {
+ $query .= " AND eft.amount = {$cost}";
+ }
+ $query .= " ORDER BY ft.id DESC LIMIT 1";
+ $result = CRM_Core_DAO::singleValueQuery($query);
+ return $result;
+ }
/**
* @param int $contId
* @return null|string
*/
function _getFinancialTrxnAmount($contId) {
- $query = "SELECT
+ $query = "SELECT
SUM( ft.total_amount ) AS total
FROM civicrm_financial_trxn AS ft
LEFT JOIN civicrm_entity_financial_trxn AS ceft ON ft.id = ceft.financial_trxn_id
WHERE ceft.entity_table = 'civicrm_contribution'
AND ceft.entity_id = {$contId}";
- $result = CRM_Core_DAO::singleValueQuery($query);
- return $result;
- }
+ $result = CRM_Core_DAO::singleValueQuery($query);
+ return $result;
+ }
/**
* @param int $contId
* @return null|string
*/
function _getFinancialItemAmount($contId) {
- $lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution'));
- $query = "SELECT
+ $lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution'));
+ $query = "SELECT
SUM(amount)
FROM civicrm_financial_item
WHERE entity_table = 'civicrm_line_item'
AND entity_id = {$lineItem}";
- $result = CRM_Core_DAO::singleValueQuery($query);
- return $result;
- }
+ $result = CRM_Core_DAO::singleValueQuery($query);
+ return $result;
+ }
/**
* @param int $contId
* @return null|string
*/
function _getTotalContributedAmount($contId) {
- $query = "SELECT
+ $query = "SELECT
SUM(amount)
FROM civicrm_entity_financial_trxn
WHERE entity_table = 'civicrm_contribution'
AND entity_id = {$contId}";
- $result = CRM_Core_DAO::singleValueQuery($query);
- return $result;
- }
+ $result = CRM_Core_DAO::singleValueQuery($query);
+ return $result;
+ }
/**
* @param $amount
* @param string $status
* @return array
*/
- public function _testOfflineContribution($amount, $status="Completed") {
-
- $this->openCiviPage("contribute/add", "reset=1&context=standalone", "_qf_Contribution_upload");
+ public function _testOfflineContribution($amount, $status = "Completed") {
- // create new contact using dialog
- $contact = $this->createDialogContact();
+ $this->openCiviPage("contribute/add", "reset=1&context=standalone", "_qf_Contribution_upload");
- // select financial type
- $this->select( "financial_type_id", "value=1" );
+ // create new contact using dialog
+ $contact = $this->createDialogContact();
- //Contribution status
- $this->select("contribution_status_id", "label=$status");
+ // select financial type
+ $this->select( "financial_type_id", "value=1" );
- // total amount
- $this->type("total_amount", $amount);
+ //Contribution status
+ $this->select("contribution_status_id", "label=$status");
- // select payment instrument type
- $this->select("payment_instrument_id", "label=Credit Card");
+ // total amount
+ $this->type("total_amount", $amount);
+ // select payment instrument type
+ $this->select("payment_instrument_id", "label=Credit Card");
- $this->type("trxn_id", "P20901X1" . rand(100, 10000));
+ $this->type("trxn_id", "P20901X1" . rand(100, 10000));
+ //Custom Data
+ //$this->click('CIVICRM_QFID_3_6');
- //Custom Data
- //$this->click('CIVICRM_QFID_3_6');
+ // Clicking save.
+ $this->clickLink("_qf_Contribution_upload");
- // Clicking save.
- $this->clickLink("_qf_Contribution_upload");
+ // Is status message correct?
+ $this->checkCRMAlert("The contribution record has been saved.");
- // Is status message correct?
- $this->checkCRMAlert("The contribution record has been saved.");
+ $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']");
+ // verify if Membership is created
- $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']");
- // verify if Membership is created
+ //click through to the Membership view screen
+ $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='View']");
- //click through to the Membership view screen
- $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='View']");
-
- $expected = array(
+ $expected = array(
'Financial Type' => 'Donation',
'Total Amount' => '100.00',
'Contribution Status' => $status,
- );
- $this->webtestVerifyTabularData($expected);
- $this->click("_qf_ContributionView_cancel-bottom");
+ );
+ $this->webtestVerifyTabularData($expected);
+ $this->click("_qf_ContributionView_cancel-bottom");
return $contact;
- }
+ }
}
$this->type("invoice_id", time());
$this->webtestFillDate('thankyou_date');
-
//Premium section
$this->click("Premium");
$this->waitForElementPresent("fulfilled_date");
public function _initialize() {
if (!$this->initialized) {
// log in
- $this->webtestLogin();
+ $this->webtestLogin();
// build names
$hash = substr(sha1(rand()), 0, 7);
$this->click('CIVICRM_QFID_1_is_monetary');
$processorName = 'Test Processor';
$this->click("xpath=//tr[@class='crm-event-manage-fee-form-block-payment_processor']/td[2]/label[text()='$processorName']");
- $this->select('financial_type_id','label=Event Fee');
- $this->type("label[1]",'Junior Stars');
- $this->type("value[1]",'500.00');
- $this->type("label[2]",'Super Stars');
- $this->type("value[2]",'1000.00');
+ $this->select('financial_type_id', 'label=Event Fee');
+ $this->type("label[1]", 'Junior Stars');
+ $this->type("value[1]", '500.00');
+ $this->type("label[2]", 'Super Stars');
+ $this->type("value[2]", '1000.00');
$this->check('default');
$this->click('_qf_Fee_upload-bottom');
$this->waitForText('crm-notification-container', "'Fees' information has been saved.");
// intro text for registration page
$registerIntro = 'Fill in all the fields below and click Continue.';
- // Go to Online Registration tab
- $this->click('link=Online Registration');
- $this->waitForElementPresent('_qf_Registration_upload-bottom');
- $this->click('is_online_registration');
- $this->assertChecked('is_online_registration');
-
- //Requires Approvel
- $this->click('requires_approval');
- $this->assertChecked('requires_approval');
- $this->click('_qf_Registration_upload-bottom');
- $this->waitForText('crm-notification-container', "'Online Registration' information has been saved.");
-
- // verify event input on info page
- // start at Manage Events listing
- $this->openCiviPage('event/manage', 'reset=1');
- $this->click("link=$eventTitle");
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $firstName = substr(sha1(rand()), 0, 7);
- $this->webtestAddContact($firstName, 'Anderson', TRUE);
- $contactName = "Anderson, $firstName";
- $displayName = "$firstName Anderson";
- $this->openCiviPage("event/register", "reset=1&id=$id", '_qf_Register_upload-bottom');
- $this->type('first_name',$firstName);
-
- //fill in last name
- $lastName = 'Recuron'.substr(sha1(rand()), 0, 7);
- $this->type('last_name', $contactName);
- $email = $firstName . '@example.com';
- $this->type('email-Primary', $email);
- $this->click('_qf_Register_upload');
- $this->waitForElementPresent("_qf_Confirm_next");
- $this->click('_qf_Confirm_next');
+ // Go to Online Registration tab
+ $this->click('link=Online Registration');
+ $this->waitForElementPresent('_qf_Registration_upload-bottom');
+ $this->click('is_online_registration');
+ $this->assertChecked('is_online_registration');
+
+ //Requires Approvel
+ $this->click('requires_approval');
+ $this->assertChecked('requires_approval');
+ $this->click('_qf_Registration_upload-bottom');
+ $this->waitForText('crm-notification-container', "'Online Registration' information has been saved.");
+
+ // verify event input on info page
+ // start at Manage Events listing
+ $this->openCiviPage('event/manage', 'reset=1');
+ $this->click("link=$eventTitle");
+ $this->waitForPageToLoad($this->getTimeoutMsec());
+ $firstName = substr(sha1(rand()), 0, 7);
+ $this->webtestAddContact($firstName, 'Anderson', TRUE);
+ $contactName = "Anderson, $firstName";
+ $displayName = "$firstName Anderson";
+ $this->openCiviPage("event/register", "reset=1&id=$id", '_qf_Register_upload-bottom');
+ $this->type('first_name', $firstName);
+
+ //fill in last name
+ $lastName = 'Recuron'.substr(sha1(rand()), 0, 7);
+ $this->type('last_name', $contactName);
+ $email = $firstName . '@example.com';
+ $this->type('email-Primary', $email);
+ $this->click('_qf_Register_upload');
+ $this->waitForElementPresent("_qf_Confirm_next");
+ $this->click('_qf_Confirm_next');
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->waitForElementPresent("xpath=//div[@class='section']");
- $this->assertTextPresent("Thank You for Registering");
+ $this->waitForElementPresent("xpath=//div[@class='section']");
+ $this->assertTextPresent("Thank You for Registering");
}
* @param $status
*/
public function _testEnableParticipantStatuses($status) {
- // enable participant status
- if ($this->isElementPresent("xpath=//td[@class='crm-participant-label crm-editable crm-editable-enabled'][contains(text(), '{$status}')]/../td[9]/span/a[2][text()='Enable']")) {
- $this->click("xpath=//td[@class='crm-participant-label crm-editable crm-editable-enabled'][contains(text(), '{$status}')]/../td[9]/span/a[2][text()='Enable']");
- $this->waitForElementPresent("xpath=//td[@class='crm-participant-label crm-editable crm-editable-enabled'][contains(text(), '{$status}')]/../td[9]/span/a[2][text()='Disable']");
- }
- }
+ // enable participant status
+ if ($this->isElementPresent("xpath=//td[@class='crm-participant-label crm-editable crm-editable-enabled'][contains(text(), '{$status}')]/../td[9]/span/a[2][text()='Enable']")) {
+ $this->click("xpath=//td[@class='crm-participant-label crm-editable crm-editable-enabled'][contains(text(), '{$status}')]/../td[9]/span/a[2][text()='Enable']");
+ $this->waitForElementPresent("xpath=//td[@class='crm-participant-label crm-editable crm-editable-enabled'][contains(text(), '{$status}')]/../td[9]/span/a[2][text()='Disable']");
+ }
+ }
}
foreach($contacts as $contact) {
$this->verifyText("xpath=//div[@id='participantSearch']//table//tbody//tr/td[@class='crm-participant-sort_name']/a[text()='{$contact['sort_name']}']/../../td[9]", preg_quote($status));
$this->verifyText("xpath=//div[@id='participantSearch']//table//tbody//tr/td[@class='crm-participant-sort_name']/a[text()='{$contact['sort_name']}']/../../td[4]/a", preg_quote($eventName));
-}
+ }
}
public function testAjaxCustomGroupLoad() {
$this->webtestLogin();
$customSets = array(
- array('entity' => 'ParticipantEventName', 'subEntity' => 'Fall Fundraiser Dinner',
+ array(
+ 'entity' => 'ParticipantEventName',
+ 'subEntity' => 'Fall Fundraiser Dinner',
'triggerElement' => array('name' => "event_id", 'type' => "select2")),
- array('entity' => 'ParticipantRole', 'subEntity' => 'Attendee','triggerElement' => array('name' => 'role_id', 'type' => "select"))
+ array('entity' => 'ParticipantRole', 'subEntity' => 'Attendee', 'triggerElement' => array('name' => 'role_id', 'type' => "select"))
);
$pageUrl = array('url' => "participant/add", 'args' => "reset=1&action=add&context=standalone");
$this->customFieldSetLoadOnTheFlyCheck($customSets, $pageUrl, TRUE);
$this->webtestLogin();
$customSets = array(
- array('entity' => 'ParticipantEventType', 'subEntity' => '- Any -',
+ array(
+ 'entity' => 'ParticipantEventType',
+ 'subEntity' => '- Any -',
'triggerElement' => array('name' => "event_id", 'type' => "select")),
- array('entity' => 'ParticipantEventName', 'subEntity' => '- Any -',
+ array(
+ 'entity' => 'ParticipantEventName',
+ 'subEntity' => '- Any -',
'triggerElement' => array('name' => "event_id", 'type' => "select")),
- array('entity' => 'ParticipantEventName', 'subEntity' => 'Rain-forest Cup Youth Soccer Tournament',
+ array(
+ 'entity' => 'ParticipantEventName',
+ 'subEntity' => 'Rain-forest Cup Youth Soccer Tournament',
'triggerElement' => array('name' => "event_id", 'type' => "select")),
- array('entity' => 'ParticipantRole', 'subEntity' => '- Any -','triggerElement' => array('type' => "checkbox")),
- array('entity' => 'ParticipantRole', 'subEntity' => 'Volunteer','triggerElement' => array('type' => "checkbox"))
+ array('entity' => 'ParticipantRole', 'subEntity' => '- Any -', 'triggerElement' => array('type' => "checkbox")),
+ array('entity' => 'ParticipantRole', 'subEntity' => 'Volunteer', 'triggerElement' => array('type' => "checkbox"))
);
$return = $this->addCustomGroupField($customSets);
case 'Select':
$options = array(
- 1 => array('label' => 'Chicken',
+ 1 => array(
+ 'label' => 'Chicken',
'amount' => '30.00',
'financial_type_id' => 'Donation'
),
case 'Radio':
$options = array(
- 1 => array('label' => 'Yes',
+ 1 => array(
+ 'label' => 'Yes',
'amount' => '50.00',
'financial_type_id' => 'Donation'
case 'CheckBox':
$options = array(
- 1 => array('label' => 'First Night',
+ 1 => array(
+ 'label' => 'First Night',
'amount' => '15.00',
'financial_type_id' => 'Donation'
),
$this->waitForElementPresent('_qf_Fee_upload_done-bottom');
$this->click('CIVICRM_QFID_1_is_monetary');
$this->click("xpath=//tr[@class='crm-event-manage-fee-form-block-payment_processor']/td[2]/label[text()='$processorName']");
- $this->select('financial_type_id','label=Event Fee');
+ $this->select('financial_type_id', 'label=Event Fee');
$this->select('price_set_id', 'label=' . $setTitle);
-
// intro text for registration page
$registerIntro = 'Fill in all the fields below and click Continue.';
$this->clickLink('_qf_Fee_upload-bottom', 'link=Online Registration', FALSE);
$this->waitForElementPresent('_qf_Fee_upload-bottom');
$this->click('CIVICRM_QFID_1_is_monetary');
$this->click("xpath=//tr[@class='crm-event-manage-fee-form-block-payment_processor']/td[2]/label[text()='$processorName']");
- $this->select('financial_type_id','label=Event Fee');
+ $this->select('financial_type_id', 'label=Event Fee');
$this->select('price_set_id', 'label=' . $setTitle);
$this->clickLink('_qf_Fee_upload-bottom', 'link=Online Registration', FALSE);
$this->click('link=Fees');
$this->waitForElementPresent('_qf_Fee_upload-bottom');
$this->click('CIVICRM_QFID_1_is_monetary');
- $this->select('financial_type_id','label=Event Fee');
+ $this->select('financial_type_id', 'label=Event Fee');
$this->select('price_set_id', 'label=' . $setTitle);
$this->click('_qf_Fee_upload-bottom');
- $this->waitForText("crm-notification-container","'Fees' information has been saved.");
+ $this->waitForText("crm-notification-container", "'Fees' information has been saved.");
$this->openCiviPage('participant/add', 'reset=1&action=add&context=standalone', '_qf_Participant_upload-bottom');
$this->click('link=Fees');
$this->waitForElementPresent('_qf_Fee_upload-bottom');
$this->click('CIVICRM_QFID_1_is_monetary');
- $this->select('financial_type_id','label=Event Fee');
+ $this->select('financial_type_id', 'label=Event Fee');
$this->select('price_set_id', 'label=' . $setTitle);
$templateId = $this->urlArg('id');
$this->click('_qf_Fee_upload-bottom');
$this->openCiviPage("admin/price", "reset=1");
$this->click("xpath=//table[@id='option11']/tbody/tr/td[4]/span[2]/ul/li[3]/a");
// Check confirmation alert.
- $this->assertTrue((bool)preg_match("/^Are you sure you want to delete this price set?/",
+ $this->assertTrue((bool) preg_match("/^Are you sure you want to delete this price set?/",
$this->getConfirmation()
));
$this->chooseOkOnNextConfirmation();
// check for proper info message displayed regarding status
$this->chooseCancelOnNextConfirmation();
$this->click('_qf_Participant_upload-bottom');
- $this->assertTrue((bool)preg_match("/Payment amount is less than the amount owed. Expected participant status is 'Partially paid'. Are you sure you want to set the participant status to Registered/", $this->getConfirmation()));
+ $this->assertTrue((bool) preg_match("/Payment amount is less than the amount owed. Expected participant status is 'Partially paid'. Are you sure you want to set the participant status to Registered/", $this->getConfirmation()));
// select partially paid status again and click on save
$this->select('status_id', 'label=Partially paid');
// verify balance
$text = $this->getText("xpath=id('AdditionalPayment')/div[2]//table/tbody/tr[3]/td[2]");
- $this->assertTrue((bool)preg_match("/{$balance}/", $text));
+ $this->assertTrue((bool) preg_match("/{$balance}/", $text));
// check form rule error
$errorBalance = $balance + 1;
$this->clickLink("_qf_Search_refresh");
$this->clickLink("xpath=//div[@id='participantSearch']/table/tbody/tr[1]/td[@class='crm-participant-sort_name']/a[text()='{$sortName}']/../../td[11]/span/a[text()='View']", "xpath=//table[@class='selector row-highlight']/tbody/tr/td[8]/span/a[text()='View']", FALSE);
- $this->clickLink("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='View']", "_qf_ParticipantView_cancel-bottom", false);
+ $this->clickLink("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='View']", "_qf_ParticipantView_cancel-bottom", FALSE);
$this->webtestVerifyTabularData(
array(
$this->webtestFillDate('event_start_date_low', '-2 year');
$this->webtestFillDate('event_end_date_high', '+1 year');
-
$this->click("_qf_Search_refresh");
$this->waitForElementPresent("xpath=//form[@id='Search']/div[3]/div/div[1]/div");
// We're using Quick Add block on the main page for this.
$firstContactName = 'TestExport' . substr(sha1(rand()), 0, 7);
- list($emailContactFirst,$prefixLabelContactFrst,$suffixLabelContactFrst,$genderLabelContactFrst) = WebTest_Export_ContactTest::webtestAddContactWithGenderPrefixSuffix($firstContactName, "Smith", "$firstContactName.smith@example.org", Null);
+ list($emailContactFirst, $prefixLabelContactFrst, $suffixLabelContactFrst, $genderLabelContactFrst) = WebTest_Export_ContactTest::webtestAddContactWithGenderPrefixSuffix($firstContactName, "Smith", "$firstContactName.smith@example.org", NULL);
$sortFirstName = "Smith, $firstContactName";
$displayFirstName = "$firstContactName Smith";
$this->waitForAjaxContent();
$secondContactName = 'TestExport2' . substr(sha1(rand()), 0, 7);
- list($emailContactSecond,$prefixLabelContactScnd,$suffixLabelContactScnd,$genderLabelContactScnd) = WebTest_Export_ContactTest::webtestAddContactWithGenderPrefixSuffix($secondContactName, "John", "$secondContactName.john@example.org", Null);
+ list($emailContactSecond, $prefixLabelContactScnd, $suffixLabelContactScnd, $genderLabelContactScnd) = WebTest_Export_ContactTest::webtestAddContactWithGenderPrefixSuffix($secondContactName, "John", "$secondContactName.john@example.org", NULL);
$sortSecondName = "John, $secondContactName";
$displaySecondName = "$secondContactName John";
$this->select("suffix_id", "value=$suffix");
$this->click("demographics");
$this->waitForElementPresent("civicrm_gender_Female_1");
- $this->click($genderLabel,"value=$gender");
+ $this->click($genderLabel, "value=$gender");
$this->waitForElementPresent('_qf_Contact_upload_view-bottom');
$this->click('_qf_Contact_upload_view-bottom');
$this->waitForPageToLoad($this->getTimeoutMsec());
- $prefixLabel = WebTest_Export_ContactTest::getOptionLabel('individual_prefix',$prefix);
- $suffixLabel = WebTest_Export_ContactTest::getOptionLabel('individual_suffix',$suffix);
- $genderLabel = WebTest_Export_ContactTest::getOptionLabel('gender',$gender);
- return array($email,$prefixLabel,$suffixLabel,$genderLabel);
+ $prefixLabel = WebTest_Export_ContactTest::getOptionLabel('individual_prefix', $prefix);
+ $suffixLabel = WebTest_Export_ContactTest::getOptionLabel('individual_suffix', $suffix);
+ $genderLabel = WebTest_Export_ContactTest::getOptionLabel('gender', $gender);
+ return array($email, $prefixLabel, $suffixLabel, $genderLabel);
}
/**
*
* @return array|int
*/
- public function getOptionLabel($optionGroupName,$optionValue){
+ public function getOptionLabel($optionGroupName, $optionValue){
$params = array(
'version' => 3,
'sequential' => 1,
'value' => $optionValue,
'return' => 'label'
);
- $optionLabel = $this->webtest_civicrm_api("OptionValue", "getvalue",$params);
+ $optionLabel = $this->webtest_civicrm_api("OptionValue", "getvalue", $params);
return $optionLabel;
}
}
$this->click($selector);
// Wait for file to be downloaded
- for ($i=1; $i<15; ++$i) {
+ for ($i = 1; $i < 15; ++$i) {
sleep(2);
if (file_exists($file)) {
return $file;
* Array of header and rows according to row index.
* eg: array(
* 1 => array(
- // Row index 1
- // column name 'First Name', value 'Jones'
+ // Row index 1
+ // column name 'First Name', value 'Jones'
* 'First Name' => 'Jones',
* 'Last Name' => 'Franklin'
* ),
* 2 => array(
- // Row index 2
+ // Row index 2
* 'First Name' => 'Rajan',
* 'Last Name' => 'mayekar'
* ),
// Add new Financial Account
$orgName = 'Alberta '.substr(sha1(rand()), 0, 7);
- $uniqueName = explode(" ",$orgName);
+ $uniqueName = explode(" ", $orgName);
$financialAccountTitle = 'Financial Account '.substr(sha1(rand()), 0, 4);
$financialAccountDescription = "{$financialAccountTitle} Description";
$accountingCode = 1033;
$this->clickLink("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Edit']", '_qf_FinancialAccount_cancel-botttom', FALSE);
//Varify Data after Adding new Financial Account
- $verifyData = array('name' => $financialAccountTitle,
+ $verifyData = array(
+ 'name' => $financialAccountTitle,
'description' => $financialAccountDescription,
'accounting_code' => $accountingCode,
'tax_rate' => $taxRate,
if ($orgNameEdit) {
$orgNameEdit = 'NGO '.substr(sha1(rand()), 0, 7);
$this->webtestAddOrganization($orgNameEdit);
- $uniqueName = explode(" ",$orgNameEdit);
+ $uniqueName = explode(" ", $orgNameEdit);
}
$this->_testEditFinancialAccount($editfinancialAccount,
$this->waitForElementPresent("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Edit']");
$this->clickLink("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Edit']", '_qf_FinancialAccount_cancel-botttom', FALSE);
- $verifyData = array( 'name' => $financialAccountTitle,
+ $verifyData = array(
+ 'name' => $financialAccountTitle,
'description' => $financialAccountDescription,
'accounting_code' => $accountingCode,
'tax_rate' => $taxRate,
$this->assertEquals($orgName, $this->getText("xpath=//*[@id='s2id_contact_id']/a/span[1]"));
$this->_assertFinancialAccount($verifyData);
- $verifySelectFieldData = array('financial_account_type_id' => $financialAccountType);
+ $verifySelectFieldData = array('financial_account_type_id' => $financialAccountType);
$this->_assertSelectVerify($verifySelectFieldData);
$this->click('_qf_FinancialAccount_cancel-botttom');
$this->waitForElementPresent("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Delete']");
//Add new Financial Type
$financialType['name'] = 'FinancialType '.substr(sha1(rand()), 0, 4);
- $financialType['is_deductible'] = true;
- $financialType['is_reserved'] = false;
+ $financialType['is_deductible'] = TRUE;
+ $financialType['is_reserved'] = FALSE;
$this->addeditFinancialType($financialType);
$expected = array(
array(
$this->click("xpath=id('ltype')/div/table/tbody/tr/td[1][text()='$financialType[name]']/../td[7]/span/a[text()='Accounts']");
$this->waitForElementPresent('newfinancialTypeAccount');
- foreach ($expected as $value => $label) {
+ foreach ($expected as $value => $label) {
$this->verifyText("xpath=//div[@id='ltype']/div/table/tbody/tr/td[2][text()='$label[financial_account]']/../td[1]", preg_quote($label['account_relationship']));
}
//edit financial type
$financialType['oldname'] = $financialType['name'];
$financialType['name'] = 'Edited FinancialType '.substr(sha1(rand()), 0, 4);
- $financialType['is_deductible'] = true;
- $financialType['is_reserved'] = false;
- $this->addeditFinancialType($financialType , 'Edit');
+ $financialType['is_deductible'] = TRUE;
+ $financialType['is_reserved'] = FALSE;
+ $this->addeditFinancialType($financialType, 'Edit');
//delete financialtype
- $this->addeditFinancialType($financialType , 'Delete');
+ $this->addeditFinancialType($financialType, 'Delete');
}
}
$this->clickAt("xpath=//div[@class='select2-result-label']");
// ...again, waiting for the box with contact name to show up (span with delete token class indicates that it's present)...
- $this->waitForText("xpath=//div[@id='s2id_target_contact_id']","$contactFirstName1");
+ $this->waitForText("xpath=//div[@id='s2id_target_contact_id']", "$contactFirstName1");
// Now we're doing the same for "Assigned To" field.
// Typing contact's name into the field (using typeKeys(), not type()!)...
$this->clickAt("xpath=//div[@class='select2-result-label']");
// ...again, waiting for the box with contact name to show up...
- $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']","$contactFirstName2");
+ $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']", "$contactFirstName2");
}
}
$this->click("css=ul#civicrm-menu li.crm-Customize_Data_and_Screens");
$this->clickLink("xpath=//div[@id='root-menu-div']//a[text()='Profiles']");
-
$this->assertTextPresent("CiviCRM Profile");
// Verify Reserved Profiles
$this->click("css=ul#civicrm-menu li.crm-Customize_Data_and_Screens");
$this->clickLink("xpath=//div[@id='root-menu-div']//a[text()='Activity Types']");
-
// Verify activity types
$this->assertTextPresent("Meeting");
$this->assertTextPresent("Print PDF Letter");
'state' => 'State',
'country' => 'Country',
);
- foreach( $customDataParams['headers'] as $key =>$value){
+ foreach( $customDataParams['headers'] as $key => $value){
$headers[$key] = $value;
}
- $rows = array( 0 =>
+ $rows = array(
+ 0 =>
array(
'first_name' => $firstName1,
// clicking save
$this->click('_qf_Field_done-bottom');
- $this->waitForText('crm-notification-container',"Custom field '{$customField}' has been saved.");
+ $this->waitForText('crm-notification-container', "Custom field '{$customField}' has been saved.");
$this->waitForElementPresent("xpath=//span[text()='$customField']");
$customFieldId = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody//tr/td/span[text()='$customField']/../../td[8]/span/a@href"));
$customFieldId = $customFieldId[1];
$this->waitForElementPresent('_qf_Field_done-bottom');
$customField1 = 'Customfield_int ' . substr(sha1(rand()), 0, 4);
$this->type('label', $customField1);
- $this->select("data_type[0]","value=1");
+ $this->select("data_type[0]", "value=1");
// clicking save
$this->click('_qf_Field_done-bottom');
$this->waitForElementPresent('_qf_Field_done-bottom');
$customField2 = 'Customfield_Number ' . substr(sha1(rand()), 0, 4);
$this->type('label', $customField2);
- $this->select("data_type[0]","value=2");
+ $this->select("data_type[0]", "value=2");
// clicking save
$this->click('_qf_Field_done-bottom');
$this->click("newCustomField");
$this->waitForElementPresent('_qf_Field_done-bottom');
$customField3 = 'Customfield_alp_select' . substr(sha1(rand()), 0, 4);
- $customFieldId3 = $this->_createMultipleValueCustomField($customField3,'Select');
+ $customFieldId3 = $this->_createMultipleValueCustomField($customField3, 'Select');
// create custom field - "alphanumeric radio"
$this->click("newCustomField");
$this->waitForElementPresent('_qf_Field_done-bottom');
$customField4 = 'Customfield_alp_radio' . substr(sha1(rand()), 0, 4);
- $customFieldId4 = $this->_createMultipleValueCustomField($customField4,'Radio');
+ $customFieldId4 = $this->_createMultipleValueCustomField($customField4, 'Radio');
// create custom field - "alphanumeric checkbox"
$this->click("newCustomField");
$this->waitForElementPresent('_qf_Field_done-bottom');
$customField5 = 'Customfield_alp_checkbox' . substr(sha1(rand()), 0, 4);
- $customFieldId5 = $this->_createMultipleValueCustomField($customField5,'CheckBox');
+ $customFieldId5 = $this->_createMultipleValueCustomField($customField5, 'CheckBox');
// create custom field - "alphanumeric multiselect"
$this->click("newCustomField");
$this->waitForElementPresent('_qf_Field_done-bottom');
$customField6 = 'Customfield_alp_multiselect' . substr(sha1(rand()), 0, 4);
- $customFieldId6 = $this->_createMultipleValueCustomField($customField6,'Multi-Select');
+ $customFieldId6 = $this->_createMultipleValueCustomField($customField6, 'Multi-Select');
// create custom field - "alphanumeric advmultiselect"
$this->click("newCustomField");
$this->waitForElementPresent('_qf_Field_done-bottom');
$customField7 = 'Customfield_alp_advmultiselect' . substr(sha1(rand()), 0, 4);
- $customFieldId7 = $this->_createMultipleValueCustomField($customField7,'AdvMulti-Select');
+ $customFieldId7 = $this->_createMultipleValueCustomField($customField7, 'AdvMulti-Select');
// create custom field - "alphanumeric autocompleteselect"
$this->click("newCustomField");
$this->waitForElementPresent('_qf_Field_done-bottom');
$customField8 = 'Customfield_alp_autocompleteselect' . substr(sha1(rand()), 0, 4);
- $customFieldId8 = $this->_createMultipleValueCustomField($customField8,'Autocomplete-Select');
+ $customFieldId8 = $this->_createMultipleValueCustomField($customField8, 'Autocomplete-Select');
// create custom field - Money
$this->click("newCustomField");
$this->waitForElementPresent('_qf_Field_done-bottom');
$customField9 = 'Customfield_Money' . substr(sha1(rand()), 0, 4);
$this->type('label', $customField9);
- $this->select("data_type[0]","value=3");
+ $this->select("data_type[0]", "value=3");
// clicking save
$this->click('_qf_Field_done-bottom');
$this->waitForElementPresent('_qf_Field_done-bottom');
$customField10 = 'Customfield_Date' . substr(sha1(rand()), 0, 4);
$this->type('label', $customField10);
- $this->select("data_type[0]","value=5");
- $this->select("date_format","value=yy-mm-dd");
+ $this->select("data_type[0]", "value=5");
+ $this->select("date_format", "value=yy-mm-dd");
// clicking save
$this->click('_qf_Field_done-bottom');
*
* @return array
*/
- public function _createMultipleValueCustomField( $customFieldName, $type ){
+ public function _createMultipleValueCustomField($customFieldName, $type){
$this->type('label', $customFieldName);
- $this->select("data_type[0]","value=0");
- $this->select("data_type[1]","value=".$type);
- $this->type("option_label_1","label1");
- $this->type("option_value_1","label1");
- $this->type("option_label_2","label2");
- $this->type("option_value_2","label2");
+ $this->select("data_type[0]", "value=0");
+ $this->select("data_type[1]", "value=".$type);
+ $this->type("option_label_1", "label1");
+ $this->type("option_value_1", "label1");
+ $this->type("option_label_2", "label2");
+ $this->type("option_value_2", "label2");
// clicking save
$this->click('_qf_Field_done-bottom');
);
$rows = array(
- array('first_name' => 'A' . substr(sha1(rand()), 0, 7),
+ array(
+ 'first_name' => 'A' . substr(sha1(rand()), 0, 7),
'middle_name' => substr(sha1(rand()), 0, 7),
'last_name' => substr(sha1(rand()), 0, 7) . 'and',
'email' => substr(sha1(rand()), 0, 7) . '@example.com',
'state' => 'NY',
'country' => 'United States',
),
- array('first_name' => 'S' . substr(sha1(rand()), 0, 7),
+ array(
+ 'first_name' => 'S' . substr(sha1(rand()), 0, 7),
'middle_name' => substr(sha1(rand()), 0, 7),
'last_name' => substr(sha1(rand()), 0, 7) . 'sum',
'email' => substr(sha1(rand()), 0, 7) . '@example.com',
);
$rows = array(
- array('first_name' => $firstName1,
+ array(
+ 'first_name' => $firstName1,
'last_name' => 'Anderson',
"custom_{$customDataParams[0]}" => 'This is a test field',
),
);
$rows = array(
- array('first_name' => substr(sha1(rand()), 0, 7),
+ array(
+ 'first_name' => substr(sha1(rand()), 0, 7),
'middle_name' => substr(sha1(rand()), 0, 7),
'last_name' => 'Anderson',
'email' => substr(sha1(rand()), 0, 7) . '@example.com',
'state' => 'NY',
'country' => 'United States',
),
- array('first_name' => substr(sha1(rand()), 0, 7),
+ array(
+ 'first_name' => substr(sha1(rand()), 0, 7),
'middle_name' => substr(sha1(rand()), 0, 7),
'last_name' => 'Summerson',
'email' => substr(sha1(rand()), 0, 7) . '@example.com',
);
$rows = array(
- array('organization_name' => 'org_' . substr(sha1(rand()), 0, 7),
+ array(
+ 'organization_name' => 'org_' . substr(sha1(rand()), 0, 7),
'email' => substr(sha1(rand()), 0, 7) . '@example.org',
'phone' => '9949912154',
'address_1' => 'Add 1',
'state' => 'NY',
'country' => 'United States',
),
- array('organization_name' => 'org_' . substr(sha1(rand()), 0, 7),
+ array(
+ 'organization_name' => 'org_' . substr(sha1(rand()), 0, 7),
'email' => substr(sha1(rand()), 0, 7) . '@example.org',
'phone' => '6949412154',
'address_1' => 'Add 1',
);
$rows = array(
- array('household_name' => 'household_' . substr(sha1(rand()), 0, 7),
+ array(
+ 'household_name' => 'household_' . substr(sha1(rand()), 0, 7),
'email' => substr(sha1(rand()), 0, 7) . '@example.org',
'phone' => '3949912154',
'address_1' => 'Add 1',
'state' => 'NY',
'country' => 'United States',
),
- array('household_name' => 'household_' . substr(sha1(rand()), 0, 7),
+ array(
+ 'household_name' => 'household_' . substr(sha1(rand()), 0, 7),
'email' => substr(sha1(rand()), 0, 7) . '@example.org',
'phone' => '5949412154',
'address_1' => 'Add 1',
);
$rows = array(
- array('first_name' => substr(sha1(rand()), 0, 7),
+ array(
+ 'first_name' => substr(sha1(rand()), 0, 7),
'middle_name' => substr(sha1(rand()), 0, 7),
'last_name' => 'Anderson',
'email' => substr(sha1(rand()), 0, 7) . '@example.com',
'state' => 'NY',
'country' => 'United States',
),
- array('first_name' => substr(sha1(rand()), 0, 7),
+ array(
+ 'first_name' => substr(sha1(rand()), 0, 7),
'middle_name' => substr(sha1(rand()), 0, 7),
'last_name' => 'Summerson',
'email' => substr(sha1(rand()), 0, 7) . '@example.com',
);
$rows = array(
- array('organization_name' => 'org_' . substr(sha1(rand()), 0, 7),
+ array(
+ 'organization_name' => 'org_' . substr(sha1(rand()), 0, 7),
'email' => substr(sha1(rand()), 0, 7) . '@example.org',
'phone' => '9949912154',
'address_1' => 'Add 1',
'state' => 'NY',
'country' => 'United States',
),
- array('organization_name' => 'org_' . substr(sha1(rand()), 0, 7),
+ array(
+ 'organization_name' => 'org_' . substr(sha1(rand()), 0, 7),
'email' => substr(sha1(rand()), 0, 7) . '@example.org',
'phone' => '6949412154',
'address_1' => 'Add 1',
);
$rows = array(
- array('household_name' => 'household_' . substr(sha1(rand()), 0, 7),
+ array(
+ 'household_name' => 'household_' . substr(sha1(rand()), 0, 7),
'email' => substr(sha1(rand()), 0, 7) . '@example.org',
'phone' => '3949912154',
'address_1' => 'Add 1',
'state' => 'NY',
'country' => 'United States',
),
- array('household_name' => 'household_' . substr(sha1(rand()), 0, 7),
+ array(
+ 'household_name' => 'household_' . substr(sha1(rand()), 0, 7),
'email' => substr(sha1(rand()), 0, 7) . '@example.org',
'phone' => '5949412154',
'address_1' => 'Add 1',
);
$rows = array(
- array('first_name' => substr(sha1(rand()), 0, 7),
+ array(
+ 'first_name' => substr(sha1(rand()), 0, 7),
'middle_name' => substr(sha1(rand()), 0, 7),
'last_name' => 'Anderson',
'email' => substr(sha1(rand()), 0, 7) . '@example.com',
'country' => 'United States',
'birth_date' => '1998-12-25',
),
- array('first_name' => substr(sha1(rand()), 0, 7),
+ array(
+ 'first_name' => substr(sha1(rand()), 0, 7),
'middle_name' => substr(sha1(rand()), 0, 7),
'last_name' => 'Summerson',
'email' => substr(sha1(rand()), 0, 7) . '@example.com',
);
$rows = array(
- array('first_name' => substr(sha1(rand()), 0, 7),
+ array(
+ 'first_name' => substr(sha1(rand()), 0, 7),
'middle_name' => substr(sha1(rand()), 0, 7),
'last_name' => 'Anderson',
'email' => substr(sha1(rand()), 0, 7) . '@example.com',
'country' => 'United States',
'birth_date' => '12/23/98',
),
- array('first_name' => substr(sha1(rand()), 0, 7),
+ array(
+ 'first_name' => substr(sha1(rand()), 0, 7),
'middle_name' => substr(sha1(rand()), 0, 7),
'last_name' => 'Summerson',
'email' => substr(sha1(rand()), 0, 7) . '@example.com',
);
$rows = array(
- array('first_name' => substr(sha1(rand()), 0, 7),
+ array(
+ 'first_name' => substr(sha1(rand()), 0, 7),
'middle_name' => substr(sha1(rand()), 0, 7),
'last_name' => 'Anderson',
'email' => substr(sha1(rand()), 0, 7) . '@example.com',
'country' => 'United States',
'birth_date' => '11/12/1995',
),
- array('first_name' => substr(sha1(rand()), 0, 7),
+ array(
+ 'first_name' => substr(sha1(rand()), 0, 7),
'middle_name' => substr(sha1(rand()), 0, 7),
'last_name' => 'Summerson',
'email' => substr(sha1(rand()), 0, 7) . '@example.com',
);
$rows = array(
- array('first_name' => substr(sha1(rand()), 0, 7),
+ array(
+ 'first_name' => substr(sha1(rand()), 0, 7),
'middle_name' => substr(sha1(rand()), 0, 7),
'last_name' => 'Anderson',
'email' => substr(sha1(rand()), 0, 7) . '@example.com',
'country' => 'United States',
'birth_date' => 'December 12, 1998',
),
- array('first_name' => substr(sha1(rand()), 0, 7),
+ array(
+ 'first_name' => substr(sha1(rand()), 0, 7),
'middle_name' => substr(sha1(rand()), 0, 7),
'last_name' => 'Summerson',
'email' => substr(sha1(rand()), 0, 7) . '@example.com',
);
$rows = array(
- array('first_name' => substr(sha1(rand()), 0, 7),
+ array(
+ 'first_name' => substr(sha1(rand()), 0, 7),
'middle_name' => substr(sha1(rand()), 0, 7),
'last_name' => 'Anderson',
'email' => substr(sha1(rand()), 0, 7) . '@example.com',
'country' => 'United States',
'birth_date' => '25/12/98',
),
- array('first_name' => substr(sha1(rand()), 0, 7),
+ array(
+ 'first_name' => substr(sha1(rand()), 0, 7),
'middle_name' => substr(sha1(rand()), 0, 7),
'last_name' => 'Summerson',
'email' => substr(sha1(rand()), 0, 7) . '@example.com',
);
$rows = array(
- array('first_name' => substr(sha1(rand()), 0, 7),
+ array(
+ 'first_name' => substr(sha1(rand()), 0, 7),
'middle_name' => substr(sha1(rand()), 0, 7),
'last_name' => 'Anderson',
'email' => substr(sha1(rand()), 0, 7) . '@example.com',
'country' => 'United States',
'birth_date' => '25/12/1998',
),
- array('first_name' => substr(sha1(rand()), 0, 7),
+ array(
+ 'first_name' => substr(sha1(rand()), 0, 7),
'middle_name' => substr(sha1(rand()), 0, 7),
'last_name' => 'Summerson',
'email' => substr(sha1(rand()), 0, 7) . '@example.com',
);
$rows = array(
- array('first_name' => isset($individualFields['first_name']) ? $individualFields['first_name'] : substr(sha1(rand()), 0, 7),
+ array(
+ 'first_name' => isset($individualFields['first_name']) ? $individualFields['first_name'] : substr(sha1(rand()), 0, 7),
'middle_name' => isset($individualFields['middle_name']) ? $individualFields['middle_name'] : substr(sha1(rand()), 0, 7),
'last_name' => isset($individualFields['last_name']) ? $individualFields['last_name'] : 'Anderson',
'email' => isset($individualFields['email']) ? $individualFields['email'] : substr(sha1(rand()), 0, 7) . '@example.com',
'state' => 'NY',
'country' => 'United States',
),
- array('first_name' => substr(sha1(rand()), 0, 7),
+ array(
+ 'first_name' => substr(sha1(rand()), 0, 7),
'middle_name' => substr(sha1(rand()), 0, 7),
'last_name' => 'Summerson',
'email' => substr(sha1(rand()), 0, 7) . '@example.com',
'country' => 'Country',
);
$rows = array(
- array('organization_name' => isset($organizationFields['organization_name']) ? $organizationFields['organization_name'] : 'org_' . substr(sha1(rand()), 0, 7),
+ array(
+ 'organization_name' => isset($organizationFields['organization_name']) ? $organizationFields['organization_name'] : 'org_' . substr(sha1(rand()), 0, 7),
'email' => isset($organizationFields['email']) ? $organizationFields['email'] : substr(sha1(rand()), 0, 7) . 'example.org',
'phone' => '9949912154',
'address_1' => 'Add 1',
'state' => 'NY',
'country' => 'United States',
),
- array('organization_name' => 'org_' . substr(sha1(rand()), 0, 7),
+ array(
+ 'organization_name' => 'org_' . substr(sha1(rand()), 0, 7),
'email' => substr(sha1(rand()), 0, 7) . '@example.org',
'phone' => '6949412154',
'address_1' => 'Add 1',
);
$rows = array(
- array('household_name' => isset($householdFields['household_name']) ? $householdFields['household_name'] : 'household_' . substr(sha1(rand()), 0, 7),
+ array(
+ 'household_name' => isset($householdFields['household_name']) ? $householdFields['household_name'] : 'household_' . substr(sha1(rand()), 0, 7),
'email' => isset($householdFields['email']) ? $householdFields['email'] : substr(sha1(rand()), 0, 7) . '@example.com',
'phone' => '3949912154',
'address_1' => 'Add 1',
'state' => 'NY',
'country' => 'United States',
),
- array('household_name' => 'household_' . substr(sha1(rand()), 0, 7),
+ array(
+ 'household_name' => 'household_' . substr(sha1(rand()), 0, 7),
'email' => substr(sha1(rand()), 0, 7) . '@example.org',
'phone' => '5949412154',
'address_1' => 'Add 1',
);
$rows = array(
- array('first_name' => substr(sha1(rand()), 0, 7),
+ array(
+ 'first_name' => substr(sha1(rand()), 0, 7),
'middle_name' => substr(sha1(rand()), 0, 7),
'last_name' => 'Anderson',
'email' => substr(sha1(rand()), 0, 7) . '@example.com',
'state' => 'NY',
'country' => 'United States',
),
- array('first_name' => substr(sha1(rand()), 0, 7),
+ array(
+ 'first_name' => substr(sha1(rand()), 0, 7),
'middle_name' => substr(sha1(rand()), 0, 7),
'last_name' => 'Summerson',
'email' => substr(sha1(rand()), 0, 7) . '@example.com',
$headers,
$rows,
$contactType = 'Individual',
- $mode = 'Skip',
+ $mode = 'Skip',
$fieldMapper = array(),
- $other = array()
+ $other = array()
) {
// Go to contact import page.
*
* @param string $type
* Import type (csv/sql).
- * @todo:currently only supports csv, need to work on sql import
+ * @todo:currently only supports csv, need to work on sql import
*/
public function importContacts($headers, $rows, $contactType = 'Individual', $mode = 'Skip', $fieldMapper = array(), $other = array(), $type = 'csv') {
$this->waitForPageToLoad($this->getTimeoutMsec());
// Check confirmation alert.
- $this->assertTrue((bool)preg_match("/^Are you sure you want to Import now[\s\S]$/", $this->getConfirmation()));
+ $this->assertTrue((bool) preg_match("/^Are you sure you want to Import now[\s\S]$/", $this->getConfirmation()));
$this->chooseOkOnNextConfirmation();
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->waitForElementPresent("_qf_Fee_upload-bottom");
$this->click("CIVICRM_QFID_1_is_monetary");
$this->click("xpath=//tr[@class='crm-event-manage-fee-form-block-payment_processor']/td[2]/label[text()='$processorName']");
- $this->select( "financial_type_id", "value=4" );
+ $this->select( "financial_type_id", "value=4" );
$counter = 1;
foreach ($params['fee_level'] as $label => $amount) {
// verify event input on info page
// start at Manage Events listing
$this->openCiviPage('event/manage', 'reset=1');
- $this->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input",$params['title']);
+ $this->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input", $params['title']);
$this->click("_qf_SearchEvent_refresh");
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->clickLink("link=" . $params['title'], NULL);
'country' => 'Country',
'contact_relationships' =>
array(
- '4_a_b' => array('organization_name' => 'Organization Name',
+ '4_a_b' => array(
+ 'organization_name' => 'Organization Name',
'organization_email' => 'Organization Email',
'organization_add' => 'Organization Street Address',
'organization_city' => 'Organization City',
);
$rows = array(
- array('first_name' => substr(sha1(rand()), 0, 7),
+ array(
+ 'first_name' => substr(sha1(rand()), 0, 7),
'middle_name' => substr(sha1(rand()), 0, 7),
'last_name' => 'Anderson',
'email' => substr(sha1(rand()), 0, 7) . '@example.com',
'state' => 'NY',
'country' => 'United States',
'contact_relationships' =>
- array('4_a_b' => array('organization_name' => 'Org ' . substr(sha1(rand()), 0, 7),
+ array(
+ '4_a_b' => array(
+ 'organization_name' => 'Org ' . substr(sha1(rand()), 0, 7),
'organization_email' => substr(sha1(rand()), 0, 7) . 'org@example.org',
'organization_add' => 'Org Street Address',
'organization_city' => 'Org City',
'organization_state' => 'NY',
'organization_country' => 'United States',
),
- '7_a_b' => array('household_name' => 'House ' . substr(sha1(rand()), 0, 7),
+ '7_a_b' => array(
+ 'household_name' => 'House ' . substr(sha1(rand()), 0, 7),
'household_email' => substr(sha1(rand()), 0, 7) . 'house@example.org',
'household_add' => 'House Street Address',
'household_city' => 'House City',
'household_state' => 'NY',
'household_country' => 'United States',
),
- '2_a_b' => array('spouse_f_name' => substr(sha1(rand()), 0, 7),
+ '2_a_b' => array(
+ 'spouse_f_name' => substr(sha1(rand()), 0, 7),
'spouse_l_name' => substr(sha1(rand()), 0, 7),
'spouse_email' => substr(sha1(rand()), 0, 7) . 'spouse@example.org',
'spouse_add' => 'Spouse Street Address',
),
),
),
- array('first_name' => substr(sha1(rand()), 0, 7),
+ array(
+ 'first_name' => substr(sha1(rand()), 0, 7),
'middle_name' => substr(sha1(rand()), 0, 7),
'last_name' => 'Summerson',
'email' => substr(sha1(rand()), 0, 7) . '@example.com',
'state' => 'NY',
'country' => 'United States',
'contact_relationships' =>
- array('4_a_b' => array('organization_name' => 'Org ' . substr(sha1(rand()), 0, 7),
+ array(
+ '4_a_b' => array(
+ 'organization_name' => 'Org ' . substr(sha1(rand()), 0, 7),
'organization_email' => substr(sha1(rand()), 0, 7) . 'org@example.org',
'organization_add' => 'Org Street Address',
'organization_city' => 'Org City',
'organization_state' => 'NY',
'organization_country' => 'United States',
),
- '7_a_b' => array('household_name' => 'House ' . substr(sha1(rand()), 0, 7),
+ '7_a_b' => array(
+ 'household_name' => 'House ' . substr(sha1(rand()), 0, 7),
'household_email' => substr(sha1(rand()), 0, 7) . 'house@example.org',
'household_add' => 'House Street Address',
'household_city' => 'House City',
'household_state' => 'NY',
'household_country' => 'United States',
),
- '2_a_b' => array('spouse_f_name' => substr(sha1(rand()), 0, 7),
+ '2_a_b' => array(
+ 'spouse_f_name' => substr(sha1(rand()), 0, 7),
'spouse_l_name' => substr(sha1(rand()), 0, 7),
'spouse_email' => substr(sha1(rand()), 0, 7) . 'spouse@example.org',
'spouse_add' => 'Spouse Street Address',
),
),
);
- // for Employee of relationship
+ // for Employee of relationship
$fieldMapper = array(
'mapper[10][0]' => '5_a_b',
'mapper[10][1]' => 'organization_name',
$this->waitForPageToLoad($this->getTimeoutMsec());
// Is status message correct.
- $this->waitForText('crm-notification-container', "The mailing component '$componentName' has been saved.");
+ $this->waitForText('crm-notification-container', "The mailing component '$componentName' has been saved.");
// Verify text.
$this->assertTrue($this->isElementPresent("xpath=//table/tbody//tr/td[text()='{$componentName}']/../td[2][text()='Footer']/../td[3][text()='{$subject}']/../td[4][text()='{$txtMsg}']/../td[5][text()='{$htmlMsg}']"), "The row doesn't consists of proper component details");
$this->waitForPageToLoad($this->getTimeoutMsec());
// Is status message correct.
- $this->waitForText('crm-notification-container', "The mailing component '$componentName' has been saved.");
+ $this->waitForText('crm-notification-container', "The mailing component '$componentName' has been saved.");
// Verify text
$this->assertTrue($this->isElementPresent("xpath=//table/tbody//tr/td[text()='{$componentName}']/../td[2][text()='Reply']/../td[3][text()='{$subject}']/../td[4][text()='{$txtMsg}']/../td[5][text()='{$htmlMsg}']"), "The row doesn't consists of proper component details");
// verify successful deliveries
$this->verifyText("xpath=//table//tr[td/a[text()='Successful Deliveries']]/descendant::td[2]", preg_quote("1 (100.00%)"));
- $summaryInfoLinks = array('Intended Recipients', 'Successful Deliveries', 'Tracked Opens', 'Click-throughs', 'Forwards', 'Replies', 'Bounces', 'Unsubscribe Requests','Opt-out Requests');
+ $summaryInfoLinks = array('Intended Recipients', 'Successful Deliveries', 'Tracked Opens', 'Click-throughs', 'Forwards', 'Replies', 'Bounces', 'Unsubscribe Requests', 'Opt-out Requests');
//check for report and adv search links
foreach($summaryInfoLinks as $value) {
$this->assertTrue($this->isElementPresent("xpath=//fieldset/legend[text()='Delivery Summary']/../table//tr[td/a[text()='{$value}']]/descendant::td[3]/span/a[1][text()='Report']"), "Report link missing for {$value}");
$this->assertTrue($this->isElementPresent("xpath=//fieldset/legend[text()='Delivery Summary']/../table//tr[td/a[text()='{$value}']]/descendant::td[3]/span/a[2][text()='Advanced Search']"), "Advance Search link missing for {$value}");
-}
+ }
// verify mailing name
$this->verifyText("xpath=//table//tr[td[1]/text()='Mailing Name']/descendant::td[2]", preg_quote("Mailing $mailingName Webtest"));
),
'Successful Deliveries' =>
array(
- 'report' => array('report_name' => 'Mailing Details', 'Mailing' => "Mailing $mailingName Webtest",
+ 'report' => array(
+ 'report_name' => 'Mailing Details',
+ 'Mailing' => "Mailing $mailingName Webtest",
"Delivery Status" => " Successful"),
'search' => array('Mailing Name IN' => "\"Mailing {$mailingName} Webtest", 'Mailing Delivery -' => "Successful")
),
),
'Forwards' =>
array(
- 'report' => array('report_name' => 'Mailing Details', 'Mailing' => "Mailing $mailingName Webtest",
+ 'report' => array(
+ 'report_name' => 'Mailing Details',
+ 'Mailing' => "Mailing $mailingName Webtest",
'Forwarded' => 'Is equal to Yes'),
'search' => array('Mailing Name IN' => "\"Mailing {$mailingName} Webtest", 'Mailing: -' => "Forwards")
),
'Replies' =>
array(
- 'report' => array('report_name' => 'Mailing Details', 'Mailing' => "Mailing $mailingName Webtest",
+ 'report' => array(
+ 'report_name' => 'Mailing Details',
+ 'Mailing' => "Mailing $mailingName Webtest",
'Replied' => 'Is equal to Yes'),
'search' => array('Mailing Name IN' => "\"Mailing {$mailingName} Webtest", 'Mailing: Trackable Replies -' => "Replied")
),
),
'Unsubscribe Requests' =>
array(
- 'report' => array('report_name' => 'Mailing Details', 'Mailing' => "Mailing $mailingName Webtest",
+ 'report' => array(
+ 'report_name' => 'Mailing Details',
+ 'Mailing' => "Mailing $mailingName Webtest",
'Unsubscribed' => 'Is equal to Yes'),
'search' => array('Mailing Name IN' => "\"Mailing {$mailingName} Webtest", 'Mailing: -' => "Unsubscribe Requests")
),
'Opt-out Requests' =>
array(
- 'report' => array('report_name' => 'Mailing Details', 'Mailing' => "Mailing $mailingName Webtest",
+ 'report' => array(
+ 'report_name' => 'Mailing Details',
+ 'Mailing' => "Mailing $mailingName Webtest",
'Opted-out' => 'Is equal to Yes'),
'search' => array('Mailing Name IN' => "\"Mailing {$mailingName} Webtest", 'Mailing: -' => "Opt-out Requests")
),
$this->assertElementContainsText('page-title', "{$value}");
continue;
}
- $this->assertTrue($this->isElementPresent("xpath=//form//div[3]/table/tbody//tr/th[contains(text(),'{$key}')]/../td[contains(text(),'{$value}')]"),"Criteria check for {$key} failed for Report for {$summaryInfo}");
+ $this->assertTrue($this->isElementPresent("xpath=//form//div[3]/table/tbody//tr/th[contains(text(),'{$key}')]/../td[contains(text(),'{$value}')]"), "Criteria check for {$key} failed for Report for {$summaryInfo}");
} else {
$this->assertElementContainsText('page-title', "Advanced Search");
$assertedValue = $this->isElementPresent("xpath=//div[@class='crm-results-block']//div[@class='qill'][contains(text(),'{$key} {$value}')]");
if (!$assertedValue) {
$assertedValue = $this->isTextPresent("{$key} {$value}");
}
- $this->assertTrue($assertedValue,"Criteria check for {$key} failed for Advance Search for {$summaryInfo}");
+ $this->assertTrue($assertedValue, "Criteria check for {$key} failed for Advance Search for {$summaryInfo}");
}
}
}
$this->webtestLogin();
// Start spooling mail
- $mut = new CiviMailUtils($this, true);
+ $mut = new CiviMailUtils($this, TRUE);
// Add a contact
$fname = substr(sha1(rand()), 0, 6);
switch ($type) {
case 'Radio':
$options = array(
- 1 => array('label' => "$memTypeTitle1",
+ 1 => array(
+ 'label' => "$memTypeTitle1",
'membership_type_id' => $memTypeId1,
'amount' => '100.00',
),
case 'CheckBox':
$options = array(
- 1 => array('label' => "$memTypeTitle1",
+ 1 => array(
+ 'label' => "$memTypeTitle1",
'membership_type_id' => $memTypeId1,
'amount' => '100.00',
),
$this->waitForElementPresent('_qf_MembershipType_cancel-bottom');
$this->type('name', "Membership Type $title");
- $this->select2('member_of_contact_id',$title);
+ $this->select2('member_of_contact_id', $title);
$this->type('minimum_fee', '100');
$this->select( 'financial_type_id', 'value=2' );
$this->click('_qf_MembershipType_upload-bottom');
$this->waitForElementPresent('link=Add Membership Type');
- $this->waitForText('crm-notification-container',"The membership type 'Membership Type $title' has been saved.");
+ $this->waitForText('crm-notification-container', "The membership type 'Membership Type $title' has been saved.");
$this->openCiviPage("contact/add", "reset=1&ct=Individual");
$this->waitForElementPresent('_qf_MembershipType_cancel-bottom');
$this->type('name', "Membership Type $title");
- $this->select2('member_of_contact_id',$title);
+ $this->select2('member_of_contact_id', $title);
$this->type('minimum_fee', '100');
$this->select( 'financial_type_id', 'value=2' );
$this->click('_qf_MembershipType_upload-bottom');
$this->waitForElementPresent('link=Add Membership Type');
- $this->waitForText('crm-notification-container',"The membership type 'Membership Type $title' has been saved.");
+ $this->waitForText('crm-notification-container', "The membership type 'Membership Type $title' has been saved.");
$this->openCiviPage("contact/add", "reset=1&ct=Individual");
$this->waitForElementPresent('_qf_MembershipType_cancel-bottom');
$this->type('name', "Membership Type $title");
- $this->select2('member_of_contact_id',$title);
+ $this->select2('member_of_contact_id', $title);
$this->type('minimum_fee', '100');
$this->select( 'financial_type_id', 'value=2' );
$this->click('_qf_MembershipType_upload-bottom');
$this->waitForElementPresent('link=Add Membership Type');
- $this->waitForText('crm-notification-container',"The membership type 'Membership Type $title' has been saved.");
+ $this->waitForText('crm-notification-container', "The membership type 'Membership Type $title' has been saved.");
$this->openCiviPage("contact/add", "reset=1&ct=Individual");
$firstName = "John_" . substr(sha1(rand()), 0, 7);
$this->waitForElementPresent('_qf_MembershipType_cancel-bottom');
$this->type('name', "Membership Type $title");
- $this->select2('member_of_contact_id',$title);
+ $this->select2('member_of_contact_id', $title);
$this->type('minimum_fee', '100');
$this->select( 'financial_type_id', 'value=2' );
$this->click('_qf_MembershipType_upload-bottom');
$this->waitForElementPresent('link=Add Membership Type');
- $this->waitForText('crm-notification-container',"The membership type 'Membership Type $title' has been saved.");
+ $this->waitForText('crm-notification-container', "The membership type 'Membership Type $title' has been saved.");
$this->openCiviPage("contact/add", "reset=1&ct=Individual");
$this->click('relationship_type_id');
$this->select('relationship_type_id', 'label=Employee of');
-
$this->select2('related_contact_id', $title1, TRUE);
$description = 'Well here is some description !!!!';
$this->_testSignUpOrRenewMembership($sid, $contactParams, $memTypeTitle1, $memTypeTitle2, $renew = TRUE);
}
- public function testAddPriceSetWithMultipleTerms() {
+ public function testAddPriceSetWithMultipleTerms() {
// Log in using webtestLogin() method
$this->webtestLogin();
$this->type('label', $fields[0]);
$this->select('html_type', "value={$fields[1]}");
$options = array(
- 1 => array('label' => $memTypeTitle1."_1",
+ 1 => array(
+ 'label' => $memTypeTitle1."_1",
'membership_type_id' => $memTypeId1,
'amount' => 50.00,
'membership_num_terms' => 1,
// Sleep should never be used for wait for anything to load from the server
// Justification for this instance: FIXME
sleep(1);
- $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[4]/input",$values['membership_num_terms']);
- $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[5]/input",$values['label']);
- $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[6]/input",$values['amount']);
+ $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[4]/input", $values['membership_num_terms']);
+ $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[5]/input", $values['label']);
+ $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[6]/input", $values['amount']);
if($i > 3){
$this->click('link=another choice');
}
switch ($type) {
case 'Radio':
$options = array(
- 1 => array('label' => "$memTypeTitle1",
+ 1 => array(
+ 'label' => "$memTypeTitle1",
'membership_type_id' => $memTypeId1,
'amount' => 100.00,
),
case 'CheckBox':
$options = array(
- 1 => array('label' => "$memTypeTitle1",
+ 1 => array(
+ 'label' => "$memTypeTitle1",
'membership_type_id' => $memTypeId1,
'amount' => 100.00,
),
// save the renewed membership
$this->click('_qf_MembershipRenewal_upload-bottom');
-
// page was loaded
$this->waitForTextPresent($sourceText);
'End date' => $endDate,
);
$this->webtestVerifyTabularData($verifyMembershipRenewData);
- }
+ }
public function testOfflineMemberRenewOverride() {
$this->webtestLogin();
// save the renewed membership
$this->click('_qf_MembershipRenewal_upload-bottom');
-
// page was loaded
$this->waitForTextPresent($sourceText);
// save the renewed membership
$this->click('_qf_MembershipRenewal_upload-bottom');
-
// page was loaded
$this->waitForTextPresent($sourceText);
$this->waitForText('crm-notification-container', "{$membershipTypes['membership_type']} membership for $firstName Memberson has been added.");
$this->waitForText('crm-notification-container', "A membership confirmation and receipt has been sent to {$firstName}@memberson.com.");
-
$this->waitForElementPresent("xpath=//div[@id='memberships']//table/tbody/tr/td[9]/span[2][text()='more']/ul/li/a[text()='Renew']");
// click through to the Membership Renewal Link
$this->click("xpath=//div[@id='memberships']//table/tbody/tr/td[9]/span[2][text()='more']/ul/li/a[text()='Renew']");
// save the renewed membership
$this->click('_qf_MembershipRenewal_upload-bottom');
-
// page was loaded
$this->waitForTextPresent($sourceText);
$this->type("duration_interval", "1");
$this->select("duration_unit", "label=year");
-
$this->click("_qf_MembershipType_upload-bottom");
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->type("duration_interval", "1");
$this->select("duration_unit", "label=year");
-
$this->click("_qf_MembershipType_upload-bottom");
$this->waitForPageToLoad($this->getTimeoutMsec());
static $pageId = NULL;
if (!$pageId) {
- $this->webtestLogin();
+ $this->webtestLogin();
//add payment processor.
$hash = substr(sha1(rand()), 0, 7);
$this->type("duration_interval", "1");
$this->select("duration_unit", "label=year");
-
$this->click("_qf_MembershipType_upload-bottom");
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->type("duration_interval", "1");
$this->select("duration_unit", "label=year");
-
$this->click("_qf_MembershipType_upload-bottom");
$this->waitForPageToLoad($this->getTimeoutMsec());
);
//make sure we do have required permissions.
- $permissions = array("edit-1-make-online-contributions", "edit-1-profile-listings-and-forms");
+ $permissions = array("edit-1-make-online-contributions", "edit-1-profile-listings-and-forms");
$this->changePermissions($permissions);
// now logout and do membership test that way
$this->type('label', $fields[0]);
$this->select('html_type', "value={$fields[1]}");
$options = array(
- 1 => array('label' => $memTypeTitle1."_1",
+ 1 => array(
+ 'label' => $memTypeTitle1."_1",
'membership_type_id' => $memTypeId1,
'amount' => 50.00,
'membership_num_terms' => 1,
$this->select("membership_type_id_{$index}", "value={$values['membership_type_id']}");
$this->waitForElementPresent("xpath=//table[@id='optionField']/tbody/tr[$i]/td[4]/input");
- $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[4]/input",$values['membership_num_terms']);
- $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[5]/input",$values['label']);
- $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[6]/input",$values['amount']);
+ $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[4]/input", $values['membership_num_terms']);
+ $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[5]/input", $values['label']);
+ $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[6]/input", $values['amount']);
if($i > 3){
$this->click('link=another choice');
}
}
elseif ($usedFor == 'Membership') {
$this->click('extends[3]');
- $this->waitForElementPresent( 'financial_type_id' );
+ $this->waitForElementPresent( 'financial_type_id' );
$this->select("css=select.crm-form-select", "label={$contributionType}");
}
switch ($type) {
case 'Radio':
$options = array(
- 1 => array('label' => "$memTypeTitle1",
+ 1 => array(
+ 'label' => "$memTypeTitle1",
'membership_type_id' => $memTypeId1,
'amount' => 100.00,
),
case 'CheckBox':
$options = array(
- 1 => array('label' => "$memTypeTitle1",
+ 1 => array(
+ 'label' => "$memTypeTitle1",
'membership_type_id' => $memTypeId1,
'amount' => 100.00,
),
// Select membership type 1
$this->waitForElementPresent("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label");
if ($memTypeId != 'No thank you') {
- $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//div/span/label/span[1][contains(text(),'$memTypeId')]");
+ $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//div/span/label/span[1][contains(text(),'$memTypeId')]");
}
else {
$this->webtestLogin();
//Find Contribution
- $this->openCiviPage("contribute/search","reset=1", "contribution_date_low");
+ $this->openCiviPage("contribute/search", "reset=1", "contribution_date_low");
$this->type("sort_name", "$lastName $firstName");
$this->clickLink("_qf_Search_refresh", "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']");
$this->waitForElementPresent("new_title");
if ($this->isElementPresent("member_price_set_id")) {
- $this->waitForElementPresent("member_price_set_id");
+ $this->waitForElementPresent("member_price_set_id");
- $this->select("member_price_set_id", "label=- none -");
+ $this->select("member_price_set_id", "label=- none -");
}
$this->waitForElementPresent("membership_type-block");
$this->waitForElementPresent("new_title");
if ($this->isElementPresent("member_price_set_id")) {
- $this->waitForElementPresent("member_price_set_id");
+ $this->waitForElementPresent("member_price_set_id");
- $this->select("member_price_set_id", "label=- none -");
+ $this->select("member_price_set_id", "label=- none -");
}
$this->waitForElementPresent("membership_type-block");
// add softcredit details
$totalAmount = 100;
$financialType = 'Donation';
- $this->clickLink('is_different_contribution_contact','total_amount',FALSE);
+ $this->clickLink('is_different_contribution_contact', 'total_amount', FALSE);
$this->select('soft_credit_type_id', 'Gift');
$this->select2('soft_credit_contact_id', $giftMembercontactName);
- $this->select('financial_type_id','Donation');
+ $this->select('financial_type_id', 'Donation');
$this->type('total_amount', $totalAmount);
$this->select('payment_instrument_id', 'Check');
$this->select('contribution_status_id', 'Completed');
// fill in Record Membership Payment?
$this->click("record_contribution", "value=1");
$this->waitForElementPresent("contribution_status_id");
- // let financial type be default
+ // let financial type be default
// let the amount be default
$test = $this;
$this->customFieldSetLoadOnTheFlyCheck($customSets, $pageUrl,
function() use ($test) {
- $test->select('membership_type_id_0', 'value=1');
+ $test->select('membership_type_id_0', 'value=1');
}
);
}
//Check whether the next two payments are done or not
$this->waitForElementPresent("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='View Payment']");
- $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[7]","Completed");
- $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[4]/td[7]","Completed");
+ $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[7]", "Completed");
+ $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[4]/td[7]", "Completed");
//Cancel the contribution made for amount of 300.00
$this->waitForElementPresent("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='View Payment']");
$this->waitForElementPresent("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[7]");
// verify that first paayment is cancelled and the rest two payments are revert back to the pending status
- $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[2]/td[7]","Cancelled");
- $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[7]","Pending");
- $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[4]/td[7]","Pending");
+ $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[2]/td[7]", "Cancelled");
+ $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[7]", "Pending");
+ $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[4]/td[7]", "Pending");
// Check whether a new payment with pending status is added at the last or not
- $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[14]/td[7]","Pending");
+ $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[14]/td[7]", "Pending");
// verify that Balance sum is correct
- $this->verifyText("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[4]","1,200.00");
+ $this->verifyText("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[4]", "1,200.00");
}
}
$this->select("contribution_page_id", "value=3");
-
//PaymentReminders
$this->click("PaymentReminders");
$this->waitForElementPresent("additional_reminder_day");
public function testAddPledgePaymentWithAdjustPledgePaymentSchedule() {
$this->webtestLogin();
$this->openCiviPage('admin/setting/localization', 'reset=1');
- $this->select("currencyLimit-f","value=FJD");
+ $this->select("currencyLimit-f", "value=FJD");
$this->click("add");
$this->click("_qf_Localization_next-bottom");
$this->waitForPageToLoad($this->getTimeoutMsec());
// check contact name on pledge form
$this->assertElementContainsText('css=tr.crm-pledge-form-block-displayName', "$firstName $lastName");
- $this->select("currency","value=FJD");
+ $this->select("currency", "value=FJD");
$this->type("amount", "30");
$this->type("installments", "3");
$this->select("frequency_unit", "value=week");
$this->type("frequency_day", "2");
$this->webtestFillDate('acknowledge_date', 'now');
- $this->select( "financial_type_id", "label=Donation");
+ $this->select( "financial_type_id", "label=Donation");
$this->select("contribution_page_id", "value=3");
-
//PaymentReminders
$this->click("PaymentReminders");
$this->waitForElementPresent("additional_reminder_day");
)
);
$this->openCiviPage('admin/setting/localization', 'reset=1');
- $this->select("currencyLimit-t","value=FJD");
+ $this->select("currencyLimit-t", "value=FJD");
$this->click("remove");
$this->click("_qf_Localization_next-bottom");
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->select("contribution_page_id", "value=3");
-
-
//PaymentReminders
$this->click("PaymentReminders");
$this->waitForElementPresent("additional_reminder_day");
$this->select("contribution_page_id", "value=3");
-
//PaymentReminders
$this->click("PaymentReminders");
$this->waitForElementPresent("additional_reminder_day");
$this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a");
$this->waitForElementPresent("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[7]");
- $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[7]","Pending");
+ $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[7]", "Pending");
$this->waitForElementPresent("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td");
// verify that payment owed amount is correct (250.00)
- $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td","250.00");
+ $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td", "250.00");
// verify that Total Paid and Balance sums are correct
- $this->verifyText("xpath=//div[@class='view-content' and contains(., 'view pledge payments')]/table[@class='selector row-highlight']//tbody/tr[1]/td[3]","470.00");
- $this->verifyText("xpath=//div[@class='view-content' and contains(., 'view pledge payments')]/table[@class='selector row-highlight']//tbody/tr[1]/td[4]","1,930.00");
+ $this->verifyText("xpath=//div[@class='view-content' and contains(., 'view pledge payments')]/table[@class='selector row-highlight']//tbody/tr[1]/td[3]", "470.00");
+ $this->verifyText("xpath=//div[@class='view-content' and contains(., 'view pledge payments')]/table[@class='selector row-highlight']//tbody/tr[1]/td[4]", "1,930.00");
}
}
$this->select('contribution_page_id', 'value=3');
-
//PaymentReminders
$this->click('PaymentReminders');
$this->waitForElementPresent('additional_reminder_day');
$this->type('first_name', $params['firstname']);
$params['lastname'] = 'Anderson' . substr(sha1(rand()), 0, 3);
$this->type('last_name', $params['lastname']);
- $params['email'] = $params['firstname'].$params['lastname'].'@exa.com';
+ $params['email'] = $params['firstname'].$params['lastname'].'@exa.com';
$this->type('email-Primary', $params['email']);
$this->waitForElementPresent("//div[@id='crm-profile-block']//div/div[2]/select");
- $this->select("//div[@id='crm-profile-block']//div/div[2]/select",'value=1');
+ $this->select("//div[@id='crm-profile-block']//div/div[2]/select", 'value=1');
}
else {
$this->waitForElementPresent("//div[@id='crm-profile-block']//div/div[2]/select");
- $this->select("//div[@id='crm-profile-block']//div/div[2]/select",'value=1');
+ $this->select("//div[@id='crm-profile-block']//div/div[2]/select", 'value=1');
}
if ($dialog) {
$gid = $this->urlArg('gid');
-
//Add field to profile
$this->waitForElementPresent("field_name[0]");
$this->click('field_name[0]');
$groupName = 'group_' . substr(sha1(rand()), 0, 7);
$this->WebtestAddGroup($groupName);
- // Add new profile.
+ // Add new profile.
$this->openCiviPage('admin/uf/group', 'reset=1');
$this->click('newCiviCRMProfile-top');
$this->click('_qf_Group_next');
$this->waitForPageToLoad($this->getTimeoutMsec());
-
//check for profile create
$this->waitForText('crm-notification-container', "Profile '{$profileTitle}' has been added. You can add fields to this profile now.");
$gid = $this->urlArg('gid');
$this->click("//option[@value='$countryID']");
$this->click("xpath=//tr[@class='crm-localization-form-block-provinceLimit']/td[2]/table//tbody/tr/td[2]/input[@name='add']");
}
- $added = true;
+ $added = TRUE;
}
if ($added) {
$this->click("_qf_Localization_next-bottom");
$this->openCiviPage("admin/setting/localization", "reset=1", "_qf_Localization_next-bottom");
$enabledCountries = $this->getSelectOptions("countryLimit-t");
$enabledStates = $this->getSelectOptions("provinceLimit-t");
- $removed = false;
+ $removed = FALSE;
foreach($newCountry as $countryID => $countryName) {
- $this->addSelection("countryLimit-t", "label=$countryName");
- $this->click("xpath=//select[@id='countryLimit-t']/option[@value='$countryID']");
- $this->click("xpath=//tr[@class='crm-localization-form-block-countryLimit']/td[2]/table//tbody/tr/td[2]/input[@name='remove']");
-
- $this->addSelection("provinceLimit-t", "label=$countryName");
- $this->click("//option[@value='$countryID']");
- $this->click("xpath=//tr[@class='crm-localization-form-block-provinceLimit']/td[2]/table//tbody/tr/td[2]/input[@name='remove']");
- $removed = true;
+ $this->addSelection("countryLimit-t", "label=$countryName");
+ $this->click("xpath=//select[@id='countryLimit-t']/option[@value='$countryID']");
+ $this->click("xpath=//tr[@class='crm-localization-form-block-countryLimit']/td[2]/table//tbody/tr/td[2]/input[@name='remove']");
+
+ $this->addSelection("provinceLimit-t", "label=$countryName");
+ $this->click("//option[@value='$countryID']");
+ $this->click("xpath=//tr[@class='crm-localization-form-block-provinceLimit']/td[2]/table//tbody/tr/td[2]/input[@name='remove']");
+ $removed = TRUE;
}
if ($removed) {
$this->click("_qf_Localization_next-bottom");
$this->click('_qf_Edit_next');
-
// assert for subscription message
$this->isTextPresent("Your subscription request has been submitted for");
* @param string $dataName
* @param array $browser
*/
- function __construct($name = NULL, array$data = array(
- ), $dataName = '', array$browser = array()) {
+ function __construct($name = NULL, array$data = array(), $dataName = '', array$browser = array()) {
parent::__construct($name, $data, $dataName, $browser);
require_once 'CiviTest/ReleaseTestSettings.php';
$this->click("xpath=//div[@id='Contact']//table/tbody//tr/td/a/strong[text() = '$reportName']");
$this->waitForPageToLoad($this->getTimeoutMsec());
- // Is filter statistics present?
+ // Is filter statistics present?
$this->assertElementContainsText("xpath=//tr/th[@class='statistics'][text()='Contact Name']/../td", "Contains $firstName", "Statistics did not found!");
// Is Contact Name present in result?
$this->waitForElementPresent("xpath=//table[@class='contact-activity-selector-activity dataTable no-footer']/tbody/tr/td[8]/span/a[2]");
$this->click("xpath=//table[@class='contact-activity-selector-activity dataTable no-footer']/tbody/tr/td[8]/span/a[2]");
$this->waitForElementPresent("_qf_Activity_cancel-bottom");
- $this->select("status_id","value=2");
+ $this->select("status_id", "value=2");
$this->click('_qf_Activity_upload-bottom');
$this->waitForText("crm-notification-container", "Activity has been saved.");
$this->waitForElementPresent("xpath=//table[@class='contact-activity-selector-activity dataTable no-footer']/tbody/tr/td[7][text()='Completed']");
$this->waitForElementPresent("xpath=//div[@class='view-content']//div[@class='action-link']/a");
$this->click("xpath=//div[@class='view-content']//div[@class='action-link']/a");
$this->waitForElementPresent("_qf_Case_cancel-bottom");
- $this->type('activity_subject',"subject".rand());
- $this->select('case_type_id','value=1');
+ $this->type('activity_subject', "subject".rand());
+ $this->select('case_type_id', 'value=1');
$this->click('_qf_Case_upload-bottom');
$this->waitForElementPresent("xpath=//form[@id='Search']/div[2]/div/table/tbody/tr[2]/td[9]/span[1]/a[1][text()='Manage']");
$this->click("xpath=//form[@id='Search']/div[2]/div/table/tbody/tr[2]/td[9]/span[1]/a[1][text()='Manage']");
$this->waitForElementPresent("xpath=//form[@id='CaseView']/div[2]/table/tbody/tr/td[4]/a");
$this->click("xpath=//form[@id='CaseView']/div[2]/table/tbody/tr/td[4]/a");
$this->waitForElementPresent("_qf_Activity_cancel-bottom");
- $this->select("case_status_id","value=2");
+ $this->select("case_status_id", "value=2");
$this->click("_qf_Activity_upload-top");
$this->waitForElementPresent("_qf_CaseView_cancel-bottom");
$this->click("_qf_CaseView_cancel-bottom");
}
}
- //visit the logging contact summary report
- $this->openCiviPage('report/logging/contact/summary', 'reset=1');
- foreach ($filters as $type => $filter) {
- if ($type == 'text' ) {
- foreach ($filter as $filterName => $filterValue) {
- $this->type($filterName, $filterValue);
+ //visit the logging contact summary report
+ $this->openCiviPage('report/logging/contact/summary', 'reset=1');
+ foreach ($filters as $type => $filter) {
+ if ($type == 'text' ) {
+ foreach ($filter as $filterName => $filterValue) {
+ $this->type($filterName, $filterValue);
+ }
}
}
- }
- $this->click("_qf_LoggingSummary_submit");
- $this->waitForPageToLoad($this->getTimeoutMsec());
+ $this->click("_qf_LoggingSummary_submit");
+ $this->waitForPageToLoad($this->getTimeoutMsec());
}
}
}
/**
* This class is intended to test ACL permission using the multisite module
*
- * @package CiviCRM_APIv3
- * @subpackage API_Contact
+ * @package CiviCRM_APIv3
+ * @subpackage API_Contact
*/
class api_v3_ACLCachingTest extends CiviUnitTestCase {
public function setUp() {
parent::setUp();
}
-/**
- * (non-PHPdoc)
- * @see CiviUnitTestCase::tearDown()
- */
+ /**
+ * (non-PHPdoc)
+ * @see CiviUnitTestCase::tearDown()
+ */
public function tearDown() {
$tablesToTruncate = array(
'civicrm_activity',
}
public function testActivityCreateCustomBefore() {
- $values = $this->callAPISuccess('custom_field', 'getoptions', array('field' => 'custom_group_id',));
+ $values = $this->callAPISuccess('custom_field', 'getoptions', array('field' => 'custom_group_id'));
$this->assertTrue($values['count'] == 0);
$this->CustomGroupCreate(array('extends' => 'Activity'));
$groupCount = $this->callAPISuccess('custom_group', 'getcount', array('extends' => 'activity'));
* @return array
*/
public static function entities() {
- return array(array('contribution'), array('participant'),);// @todo array('pledge' => 'pledge')
+ return array(array('contribution'), array('participant'));// @todo array('pledge' => 'pledge')
}
/**
*
* (PHP 5)
*
- * @copyright Copyright CiviCRM LLC (C) 2009
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* GNU Affero General Public License version 3
- * @version $Id:
- * @package CiviCRM
+ * @version $Id:
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Test APIv3 civicrm_activity_* functions
*
- * @package CiviCRM_APIv3
- * @todo determine where help functions should sit (here or 'up the tree'), & best way to define API dir
+ * @package CiviCRM_APIv3
+ * @todo determine where help functions should sit (here or 'up the tree'), & best way to define API dir
*/
class api_v3_APIStandardsTest extends CiviUnitTestCase {
/**
* Test class for API functions
*
- * @package CiviCRM_APIv3
+ * @package CiviCRM_APIv3
*/
class api_v3_APITest extends CiviUnitTestCase {
public $DBResetRequired = FALSE;
- protected $_apiversion =3;
+ protected $_apiversion = 3;
public function testAPIReplaceVariables() {
$result = array();
*/
public function testAPIWrapperIncludeNoFile() {
-
$result = $this->callAPIFailure('RandomFile', 'get', array(), 'API (RandomFile,get) does not exist (join the API team and implement it!)');
}
$this->assertEquals($expected, $actual, sprintf('input=%s expected=%s actual=%s', $input, $expected, $actual));
}
}
-/**
- * Test that calling via wrapper works
- */
+ /**
+ * Test that calling via wrapper works
+ */
public function testv3Wrapper() {
try{
$result = civicrm_api3('contact', 'get', array());
/**
* Test APIv3 civicrm_action_schedule functions
*
- * @package CiviCRM_APIv3
- * @subpackage API_ActionSchedule
+ * @package CiviCRM_APIv3
+ * @subpackage API_ActionSchedule
*/
class api_v3_ActionScheduleTest extends CiviUnitTestCase {
$this->assertTrue(is_numeric($actionSchedule['id']), "In line " . __LINE__);
$this->assertTrue($actionSchedule['id'] > 0, "In line " . __LINE__);
$newCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_action_schedule');
- $this->assertEquals($oldCount+1, $newCount);
+ $this->assertEquals($oldCount + 1, $newCount);
}
/**
'start_action_condition' => 'before',
'start_action_date' => 'activity_date_time',
'is_repeat' => 1,
- 'repetition_frequency_unit'=> 'day',
+ 'repetition_frequency_unit' => 'day',
'repetition_frequency_interval' => 3,
'end_frequency_unit' => 'hour',
'end_frequency_interval' => 0,
$this->assertTrue($actionSchedule['id'] > 0, "In line " . __LINE__);
$this->assertEquals($actionSchedule['values'][$actionSchedule['id']]['start_action_offset'][0], $params['start_action_offset']);
$newCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_action_schedule');
- $this->assertEquals($oldCount+1, $newCount);
+ $this->assertEquals($oldCount + 1, $newCount);
}
/**
* Test APIv3 civicrm_activity_contact* functions
*
- * @package CiviCRM_APIv3
- * @subpackage API_Activity
+ * @package CiviCRM_APIv3
+ * @subpackage API_Activity
*/
class api_v3_ActivityContactTest extends CiviUnitTestCase {
protected $_apiversion;
//create one
$create = $this->callAPISuccess('activity_contact', 'create', $this->_params);
- $result = $this->callAPIAndDocument('activity_contact', 'delete', array('id' => $create['id'],), __FUNCTION__, __FILE__);
+ $result = $this->callAPIAndDocument('activity_contact', 'delete', array('id' => $create['id']), __FUNCTION__, __FILE__);
$this->assertEquals(1, $result['count']);
$get = $this->callAPISuccess('activity_contact', 'get', array(
'id' => $create['id'],
*
* (PHP 5)
*
- * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
- * @copyright Copyright CiviCRM LLC (C) 2009
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* GNU Affero General Public License version 3
- * @version $Id: ActivityTest.php 31254 2010-12-15 10:09:29Z eileen $
- * @package CiviCRM
+ * @version $Id: ActivityTest.php 31254 2010-12-15 10:09:29Z eileen $
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Test APIv3 civicrm_activity_* functions
*
- * @package CiviCRM_APIv3
- * @subpackage API_Activity
+ * @package CiviCRM_APIv3
+ * @subpackage API_Activity
*/
class api_v3_ActivityTest extends CiviUnitTestCase {
*/
public function testActivityCreateTextStatus() {
-
$params = array(
'source_contact_id' => $this->_contactID,
'subject' => 'Make-it-Happen Meeting',
$contact = $this->callAPISuccess('Contact', 'Create', array(
'first_name' => "The Rock",
- 'last_name' =>'roccky',
+ 'last_name' => 'roccky',
'contact_type' => 'Individual',
'version' => 3,
'api.activity.create' => array(
- 'id' => $activity['id'], 'assignee_contact_id' => '$value.id',
+ 'id' => $activity['id'],
+ 'assignee_contact_id' => '$value.id',
),
));
$params['target_contact_id'] = array($contact2 => $contact2);
$activity = $this->callAPISuccess('Activity', 'Create', $params);
- $activityget = $this->callAPISuccess('Activity', 'get', array('id' => $activity['id'], 'target_contact_id' => $contact2,'return.target_contact_id' => 1));
+ $activityget = $this->callAPISuccess('Activity', 'get', array('id' => $activity['id'], 'target_contact_id' => $contact2, 'return.target_contact_id' => 1));
$this->assertEquals($activity['id'], $activityget['id'], 'In line ' . __LINE__);
$this->assertEquals($contact2, $activityget['values'][$activityget['id']]['target_contact_id'][0], 'In line ' . __LINE__);
- $activityget = $this->callAPISuccess('activity', 'get', array('target_contact_id' => $this->_contactID,'return.target_contact_id' => 1,'id' => $activity['id']));
+ $activityget = $this->callAPISuccess('activity', 'get', array('target_contact_id' => $this->_contactID, 'return.target_contact_id' => 1, 'id' => $activity['id']));
if ($activityget['count'] > 0) {
$this->assertNotEquals($contact2, $activityget['values'][$activityget['id']]['target_contact_id'][0], 'In line ' . __LINE__);
}
'status_id' => '2'));
$this->assertEquals(0, $result['count'], 'No activities of status 1 should exist');
-
}
/*
'version' => $this->_apiversion,
'id' => $activityId,
);
- $result = $this->callAPISuccess($this->_entity, 'get',$getParams );
+ $result = $this->callAPISuccess($this->_entity, 'get', $getParams );
$assignee = $result['values'][$result['id']]['assignee_contact_id'];
$target = $result['values'][$result['id']]['target_contact_id'];
$this->assertEquals(2, count($assignee), ' in line ' . __LINE__);
*
* (PHP 5)
*
- * @package CiviCRM
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Test APIv3 civicrm_activity_* functions
*
- * @package CiviCRM_APIv3
- * @subpackage API_Activity
+ * @package CiviCRM_APIv3
+ * @subpackage API_Activity
*/
class api_v3_ActivityTypeTest extends CiviUnitTestCase {
/**
* Test APIv3 civicrm_activity_* functions
*
- * @package CiviCRM_APIv3
- * @subpackage API_Contact
+ * @package CiviCRM_APIv3
+ * @subpackage API_Contact
*/
require_once 'CiviTest/CiviUnitTestCase.php';
* Class api_v3_AddressTest
*/
class api_v3_AddressTest extends CiviUnitTestCase {
- protected $_apiversion =3;
+ protected $_apiversion = 3;
protected $_contactID;
protected $_locationType;
protected $_params;
}
/**
- * Create an address with a master ID and ensure that a relationship is created
- */
+ * Create an address with a master ID and ensure that a relationship is created
+ */
public function testCreateAddressWithMasterRelationshipOrganization() {
$address = $this->callAPISuccess('address', 'create', $this->_params);
$individualID = $this->individualCreate();
$individualParams['master_id'] = $address2['id'];
$individualParams['id'] = $individualAddress['id'];
$this->callAPISuccess('address', 'create', $individualParams);
- $this->callAPISuccessGetCount('relationship', array('contact_id_a' => $individualID,), 2);
+ $this->callAPISuccessGetCount('relationship', array('contact_id_a' => $individualID), 2);
$this->markTestIncomplete('Remainder of test checks that employer relationship is disabled when new one is created but turns out to be not happening - by design?');
$this->callAPISuccessGetCount('relationship', array('contact_id_a' => $individualID, 'is_active' => FALSE), 1);
$this->callAPISuccessGetCount('relationship', array('contact_id_a' => $individualID, 'is_active' => TRUE, 'contact_id_b' => $organisation2ID), 1);
//create one
$create = $this->callAPISuccess('address', 'create', $this->_params);
- $result = $this->callAPIAndDocument('address', 'delete', array('id' => $create['id'],), __FUNCTION__, __FILE__);
+ $result = $this->callAPIAndDocument('address', 'delete', array('id' => $create['id']), __FUNCTION__, __FILE__);
$this->assertEquals(1, $result['count'], 'In line ' . __LINE__);
$get = $this->callAPISuccess('address', 'get', array(
'location_type_id' => $this->_locationType->id,
$this->callAPISuccess('address', 'create', $this->_params);
$subfile = "AddressLike";
$description = "Demonstrates Use of Like";
- $params = array('street_address' => array('LIKE' => '%mb%'),
+ $params = array(
+ 'street_address' => array('LIKE' => '%mb%'),
'sequential' => 1,
);
$result = $this->callAPIAndDocument('Address', 'Get', $params, __FUNCTION__, __FILE__, $description, $subfile);
*
* (PHP 5)
*
- * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
- * @copyright Copyright CiviCRM LLC (C) 2009
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* GNU Affero General Public License version 3
- * @version $Id: AllTests.php 31254 2010-12-15 10:09:29Z eileen $
- * @package CiviCRM
+ * @version $Id: AllTests.php 31254 2010-12-15 10:09:29Z eileen $
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Class containing all API v3 test suites
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class api_v3_AllTests extends CiviTestSuite {
private static $instance = NULL;
/**
* Test class for Batch API - civicrm_batch_*
*
- * @package CiviCRM_APIv3
+ * @package CiviCRM_APIv3
*/
class api_v3_BatchTest extends CiviUnitTestCase {
/**
* Test APIv3 civicrm_activity_* functions
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class api_v3_CRM11793Test extends CiviUnitTestCase {
*
* (PHP 5)
*
- * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
- * @copyright Copyright CiviCRM LLC (C) 2009
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* GNU Affero General Public License version 3
- * @version $Id: ActivityTest.php 31254 2010-12-15 10:09:29Z eileen $
- * @package CiviCRM
+ * @version $Id: ActivityTest.php 31254 2010-12-15 10:09:29Z eileen $
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Test APIv3 civicrm_case_* functions
*
- * @package CiviCRM_APIv3
+ * @package CiviCRM_APIv3
*/
class api_v3_CaseTest extends CiviCaseTestCase {
protected $_params;
protected $_entity;
- protected $_apiversion =3;
+ protected $_apiversion = 3;
protected $followup_activity_type_value;
/**
*/
public function testCaseTypeUpdate() {
// Create Case Type
- $params = array(
+ $params = array(
'title' => 'Application',
'name' => 'Application',
'is_active' => 1,
*/
public function testCaseTypeDelete_New() {
// Create Case Type
- $params = array(
+ $params = array(
'title' => 'Application',
'name' => 'Application',
'is_active' => 1,
*
* (PHP 5)
*
- * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
- * @copyright Copyright CiviCRM LLC (C) 2009
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* GNU Affero General Public License version 3
- * @version $Id: ConstantTest.php 31254 2010-12-15 10:09:29Z eileen $
- * @package CiviCRM_APIv3
- * @subpackage API_Constant
+ * @version $Id: ConstantTest.php 31254 2010-12-15 10:09:29Z eileen $
+ * @package CiviCRM_APIv3
+ * @subpackage API_Constant
*
* This file is part of CiviCRM
*
/**
* Test APIv3 civicrm_activity_* functions
*
- * @package CiviCRM_APIv3
- * @subpackage API_Constant
+ * @package CiviCRM_APIv3
+ * @subpackage API_Constant
*/
class api_v3_ConstantTest extends CiviUnitTestCase {
protected $_apiversion = 3;
*
* (PHP 5)
*
- * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
- * @copyright Copyright CiviCRM LLC (C) 2009
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* GNU Affero General Public License version 3
- * @version $Id: ContactTest.php 31254 2010-12-15 10:09:29Z eileen $
- * @package CiviCRM
+ * @version $Id: ContactTest.php 31254 2010-12-15 10:09:29Z eileen $
+ * @package CiviCRM
*
* This file is part of CiviCRM
*
/**
* Test APIv3 civicrm_contact* functions
*
- * @package CiviCRM_APIv3
- * @subpackage API_Contact
+ * @package CiviCRM_APIv3
+ * @subpackage API_Contact
*/
class api_v3_ContactTest extends CiviUnitTestCase {
protected $_params;
protected $_contactID;
- protected $_financialTypeId =1;
+ protected $_financialTypeId = 1;
/**
* Test setup for every test
$this->assertTrue(is_numeric($contact['id']), "In line " . __LINE__);
$this->assertTrue($contact['id'] > 0, "In line " . __LINE__);
$newCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_contact');
- $this->assertEquals($oldCount+1, $newCount);
+ $this->assertEquals($oldCount + 1, $newCount);
$this->assertDBState('CRM_Contact_DAO_Contact',
$contact['id'],
'email' => 'man1@yahoo.com',
'contact_type' => 'Does not Exist',
);
- $this->callAPIFailure('contact', 'create', $params,"'Does not Exist' is not a valid option for field contact_type");
+ $this->callAPIFailure('contact', 'create', $params, "'Does not Exist' is not a valid option for field contact_type");
}
/**
));
// do it again as an update to check it doesn't cause an error
$employerResult = $this->callAPISuccess('contact', 'create', array_merge($this->_params, array(
- 'current_employer' => 'new employer org', 'id' => $employerResult['id'])
+ 'current_employer' => 'new employer org',
+ 'id' => $employerResult['id'])
));
$expectedCount = 1;
$this->callAPISuccess('contact', 'getcount', array(
$employerResult = $this->callAPISuccess('contact', 'create', array_merge($this->_params, array(
'current_employer' => 'new employer org',)
));
- $relationship = $this->callAPISuccess('relationship','get', array(
+ $relationship = $this->callAPISuccess('relationship', 'get', array(
'contact_id_a' => $employerResult['id'],
- ));
+ ));
//disable & check it is disabled
$this->callAPISuccess('relationship', 'create', array('id' => $relationship['id'], 'is_active' => 0));
- $this->callAPISuccess('relationship','getvalue', array(
+ $this->callAPISuccess('relationship', 'getvalue', array(
'id' => $relationship['id'],
'return' => 'is_active'
), 0);
//re-set the current employer - thus enabling the relationshp
$this->callAPISuccess('contact', 'create', array_merge($this->_params, array(
- 'current_employer' => 'new employer org', 'id' => $employerResult['id'])
+ 'current_employer' => 'new employer org',
+ 'id' => $employerResult['id'])
));
//check is_active is now 1
- $relationship = $this->callAPISuccess('relationship','getsingle', array(
+ $relationship = $this->callAPISuccess('relationship', 'getsingle', array(
'return' => 'is_active',));
- $this->assertEquals(1, $relationship['is_active']);
+ $this->assertEquals(1, $relationship['is_active']);
}
/**
$this->callAPISuccess('contact', 'get', $params);
// testing as string
- $params = array('filter.group_id' => array($groupId, 26),
+ $params = array(
+ 'filter.group_id' => array($groupId, 26),
'contact_type' => 'Individual',
);
$result = $this->callAPIAndDocument('contact', 'get', $params, __FUNCTION__, __FILE__, $description, $subFile);
$this->assertEquals(1, $result['count']);
//test in conjunction with other criteria
- $params = array('filter.group_id' => array($groupId, 26),
+ $params = array(
+ 'filter.group_id' => array($groupId, 26),
'contact_type' => 'Organization',
);
- $this->callAPISuccess('contact', 'get', $params);
- $params = array('filter.group_id' => array(26, 27),
+ $this->callAPISuccess('contact', 'get', $params);
+ $params = array(
+ 'filter.group_id' => array(26, 27),
'contact_type' => 'Individual',
);
$result = $this->callAPISuccess('contact', 'get', $params);
'is_active' => 1,
'relationship_type_id' => $relTypeId,
));
- }
+ }
// Add second employer
$params['employer_id'] = $employer2;
)
);
-
-
$params = array(
'id' => 23,
'first_name' => 'abcd',
$extraParams = array('nick_name' => 'Bob', 'phone' => '456', 'email' => 'e@mail.com');
$contactID = $this->individualCreate($extraParams);
//actually it turns out the above doesn't create a phone
- $this->callAPISuccess('phone', 'create', array('contact_id' => $contactID, 'phone' => '456',));
+ $this->callAPISuccess('phone', 'create', array('contact_id' => $contactID, 'phone' => '456'));
$result = $this->callAPISuccess('contact', 'getsingle', array('id' => $contactID));
foreach ($extraParams as $key => $value) {
$this->assertEquals($result[$key], $value);
'api.contribution.create.1' => array(
'receive_date' => '2011-01-01',
'total_amount' => 120.00,
- 'financial_type_id' => $this->_financialTypeId =1,
+ 'financial_type_id' => $this->_financialTypeId = 1,
'payment_instrument_id' => 1,
'non_deductible_amount' => 10.00,
'fee_amount' => 50.00,
),
);
-
$result = $this->callAPISuccess('Contact', 'create', $params);
$params = array(
'id' => $result['id'],
'custom_' . $andmoreids['custom_field_id'][1] => "vegemite",
);
-
$result = $this->callAPISuccess('Contact', 'create', $params);
$result = $this->callAPISuccess('Contact', 'create', array(
- 'contact_type' => 'Individual', 'id' => $result['id'], 'custom_' . $moreids['custom_field_id'][0] => "value 3", 'custom_' . $ids['custom_field_id'] => "value 4",
+ 'contact_type' => 'Individual',
+ 'id' => $result['id'], 'custom_' .
+ $moreids['custom_field_id'][0] => "value 3", 'custom_' .
+ $ids['custom_field_id'] => "value 4",
));
$params = array(
2 child functions - one receives values from the parent (Contact) and the other child (Tag). ";
$subfile = "APIChainedArrayValuesFromSiblingFunction";
$params = array(
- 'display_name' => 'batman', 'contact_type' => 'Individual',
+ 'display_name' => 'batman',
+ 'contact_type' => 'Individual',
'api.tag.create' => array('name' => '$value.id', 'description' => '$value.display_name', 'format.only_id' => 1),
'api.entity_tag.create' => array('tag_id' => '$value.api.tag.create'),
);
/* it will be ignored if there is not exactly 1 result";
$subFile = "FormatSingleValue";
$params = array('id' => 17, 'return' => 'display_name');
- $result = $this->callAPIAndDocument('Contact', 'getvalue', $params, __FUNCTION__, __FILE__, $description, $subFile,'getvalue');
+ $result = $this->callAPIAndDocument('Contact', 'getvalue', $params, __FUNCTION__, __FILE__, $description, $subFile, 'getvalue');
$this->assertEquals('Test Contact', $result);
$this->callAPISuccess('Contact', 'Delete', $params);
}
*/
public function testContactCreationPermissions() {
$params = array(
- 'contact_type' => 'Individual', 'first_name' => 'Foo',
+ 'contact_type' => 'Individual',
+ 'first_name' => 'Foo',
'last_name' => 'Bear',
'check_permissions' => TRUE,
);
}
public function testContactUpdatePermissions() {
- $params = array('contact_type' => 'Individual', 'first_name' => 'Foo', 'last_name' => 'Bear', 'check_permissions' => TRUE,);
+ $params = array('contact_type' => 'Individual', 'first_name' => 'Foo', 'last_name' => 'Bear', 'check_permissions' => TRUE);
$result = $this->callAPISuccess('contact', 'create', $params);
$config = CRM_Core_Config::singleton();
- $params = array('id' => $result['id'], 'contact_type' => 'Individual', 'last_name' => 'Bar', 'check_permissions' => TRUE,);
+ $params = array('id' => $result['id'], 'contact_type' => 'Individual', 'last_name' => 'Bar', 'check_permissions' => TRUE);
$config->userPermissionClass->permissions = array('access CiviCRM');
$result = $this->callAPIFailure('contact', 'update', $params);
public function testReturnCityProfile () {
$contactID = $this->individualCreate();
CRM_Core_Config::singleton()->defaultSearchProfileID = 1;
- $this->callAPISuccess('address', 'create', array('contact_id' => $contactID, 'city' => 'Cool City', 'location_type_id' => 1,));
+ $this->callAPISuccess('address', 'create', array('contact_id' => $contactID, 'city' => 'Cool City', 'location_type_id' => 1));
$result = $this->callAPISuccess('contact', 'get', array('city' => 'Cool City', 'return' => 'contact_type'));
$this->assertEquals(1, $result['count']);
}
$this->assertEquals(end($result['contact_sub_type']), $updateParams['contact_sub_type'], "In line " . __LINE__);
$this->callAPISuccess('contact', 'delete', $params);
-
$params = array(
'label' => 'sub2_organization',
'name' => 'sub2_organization',
/**
* Test APIv3 civicrm_contribute_recur* functions
*
- * @package CiviCRM_APIv3
- * @subpackage API_Contribution
+ * @package CiviCRM_APIv3
+ * @subpackage API_Contribution
*/
class api_v3_ContributionPageTest extends CiviUnitTestCase {
protected $id = 0;
protected $contactIds = array();
protected $_entity = 'contribution_page';
- protected $contribution_result = null;
+ protected $contribution_result = NULL;
protected $_priceSetParams = array();
/**
* Payment processor details
);
$this->callAPIAndDocument('contribution_page', 'submit', $submitParams, __FUNCTION__, __FILE__, 'submit contribution page', NULL, 'Submit');
- $contributions = $this->callAPISuccess('contribution', 'get', array('contribution_page_id' => $this->_ids['contribution_page'],));
+ $contributions = $this->callAPISuccess('contribution', 'get', array('contribution_page_id' => $this->_ids['contribution_page']));
$this->assertCount(2, $contributions['values']);
$ids = array_keys($contributions['values']);
$this->assertEquals('10.00', $contributions['values'][$ids[0]]['total_amount']);
$this->params['recur_frequency_unit'] = 'month';
$this->setUpMembershipContributionPage();
$dummyPP = CRM_Core_Payment::singleton('live', $this->_paymentProcessor);
- $dummyPP->setDoDirectPaymentResult(array('contribution_status_id' => 1, 'trxn_id' => 'create_first_success',));
+ $dummyPP->setDoDirectPaymentResult(array('contribution_status_id' => 1, 'trxn_id' => 'create_first_success'));
$submitParams = array(
'price_' . $this->_ids['price_field'][0] => reset($this->_ids['price_field_value']),
//$this->callAPISuccess('line_item', 'getsingle', array('contribution_id' => $contribution['id'], 'entity_id' => $membership['id']));
//renew it with processor setting completed - should extend membership
$submitParams['contact_id'] = $contribution['contact_id'];
- $dummyPP->setDoDirectPaymentResult(array('contribution_status_id' => 1, 'trxn_id' => 'create_second_success',));
+ $dummyPP->setDoDirectPaymentResult(array('contribution_status_id' => 1, 'trxn_id' => 'create_second_success'));
$this->callAPISuccess('contribution_page', 'submit', $submitParams);
$this->callAPISuccess('contribution', 'getsingle', array('id' => array('NOT IN' => array($contribution['id'])), 'contribution_page_id' => $this->_ids['contribution_page'], 'contribution_status_id' => 1));
$renewedMembership = $this->callAPISuccessGetSingle('membership', array('id' => $membershipPayment['membership_id']));
$this->params['recur_frequency_unit'] = 'month';
$this->setUpMembershipContributionPage();
$dummyPP = CRM_Core_Payment::singleton('live', $this->_paymentProcessor);
- $dummyPP->setDoDirectPaymentResult(array('contribution_status_id' => 2,));
+ $dummyPP->setDoDirectPaymentResult(array('contribution_status_id' => 2));
$submitParams = array(
'price_' . $this->_ids['price_field'][0] => reset($this->_ids['price_field_value']),
'frequency_interval' => 1,
'frequency_unit' => 'month',)
);
- $dummyPP->setDoDirectPaymentResult(array('contribution_status_id' => 2,));
+ $dummyPP->setDoDirectPaymentResult(array('contribution_status_id' => 2));
$this->callAPISuccess('contribution_page', 'submit', $submitParams);
- $newContribution = $this->callAPISuccess('contribution', 'getsingle', array('id' => array(
- 'NOT IN' => array($contribution['id'])), 'contribution_page_id' => $this->_ids['contribution_page'], 'contribution_status_id' => 2)
+ $newContribution = $this->callAPISuccess('contribution', 'getsingle', array(
+ 'id' => array(
+ 'NOT IN' => array($contribution['id'])), 'contribution_page_id' => $this->_ids['contribution_page'],
+ 'contribution_status_id' => 2)
);
$renewedMembership = $this->callAPISuccessGetSingle('membership', array('id' => $membershipPayment['membership_id']));
}
public static function setUpBeforeClass() {
- // put stuff here that should happen before all tests in this unit
+ // put stuff here that should happen before all tests in this unit
}
public static function tearDownAfterClass(){
/**
* Test APIv3 civicrm_contribute_recur* functions
*
- * @package CiviCRM_APIv3
- * @subpackage API_Contribution
+ * @package CiviCRM_APIv3
+ * @subpackage API_Contribution
*/
$result = $this->callAPISuccess($this->_entity, 'create', $this->params);
$deleteParams = array('id' => $result['id']);
$result = $this->callAPIAndDocument($this->_entity, 'delete', $deleteParams, __FUNCTION__, __FILE__);
- $checkDeleted = $this->callAPISuccess($this->_entity, 'get', array(
- ));
+ $checkDeleted = $this->callAPISuccess($this->_entity, 'get', array());
$this->assertEquals(0, $checkDeleted['count']);
}
/**
* Test APIv3 civicrm_contribute_* functions
*
- * @package CiviCRM_APIv3
- * @subpackage API_ContributionSoft
+ * @package CiviCRM_APIv3
+ * @subpackage API_ContributionSoft
*/
class api_v3_ContributionSoftTest extends CiviUnitTestCase {
//create a second soft contribution on the same hard contribution - we are testing that 'id' gets the right soft contribution id (not the contribution id)
$p['contact_id'] = $this->_softIndividual2Id;
- $this->_softcontribution2 = $this->callAPISuccess('contribution_soft', 'create', $p);
+ $this->_softcontribution2 = $this->callAPISuccess('contribution_soft', 'create', $p);
// now we have 2 - test getcount
- $softcontribution = $this->callAPISuccess('contribution_soft', 'getcount', array());
+ $softcontribution = $this->callAPISuccess('contribution_soft', 'getcount', array());
$this->assertEquals(2, $softcontribution);
//check first contribution
- $result = $this->callAPISuccess('contribution_soft', 'get', array(
+ $result = $this->callAPISuccess('contribution_soft', 'get', array(
'id' => $this->_softcontribution['id'],
));
$this->assertEquals(1, $result['count'], 'In line ' . __LINE__);
$this->assertEquals($this->_softcontribution['id'], $result['id']);
- $this->assertEquals($this->_softcontribution['id'], $result['id'], print_r($softcontribution,true));
+ $this->assertEquals($this->_softcontribution['id'], $result['id'], print_r($softcontribution, TRUE));
//test id only format - second soft credit
- $resultID2 = $this->callAPISuccess('contribution_soft', 'get', array(
+ $resultID2 = $this->callAPISuccess('contribution_soft', 'get', array(
'id' => $this->_softcontribution2['id'],
'format.only_id' => 1,
));
$this->assertEquals($this->_softcontribution2['id'], $resultID2);
//test get by contact id works
- $result = $this->callAPISuccess('contribution_soft', 'get', array(
+ $result = $this->callAPISuccess('contribution_soft', 'get', array(
'contact_id' => $this->_softIndividual2Id)
);
$this->assertEquals(1, $result['count'], 'In line ' . __LINE__);
$this->assertEquals($old_contact_id, $this->_softIndividual1Id, 'In line ' . __LINE__);
$this->assertEquals($old_amount, 10.00, 'In line ' . __LINE__);
$this->assertEquals($old_currency, 'USD', 'In line ' . __LINE__);
- $this->assertEquals($old_soft_credit_type_id, 6 , 'In line ' . __LINE__);
+ $this->assertEquals($old_soft_credit_type_id, 6, 'In line ' . __LINE__);
$params = array(
'id' => $softcontributionID,
'contribution_id' => $this->_contributionId,
/**
* Test APIv3 civicrm_contribute_* functions
*
- * @package CiviCRM_APIv3
- * @subpackage API_Contribution
+ * @package CiviCRM_APIv3
+ * @subpackage API_Contribution
*/
class api_v3_ContributionTest extends CiviUnitTestCase {
$contribution = $this->callAPIAndDocument('contribution', 'get', $params, __FUNCTION__, __FILE__);
$financialParams['id'] = $this->_financialTypeId;
- $default = null;
+ $default = NULL;
CRM_Financial_BAO_FinancialType::retrieve($financialParams, $default);
$this->assertEquals(1, $contribution['count']);
'id' => $this->_contribution['id'],
'format.only_id' => 1,
));
- $this->assertEquals($this->_contribution['id'], $contribution, print_r($contribution,true) . " in line " . __LINE__);
+ $this->assertEquals($this->_contribution['id'], $contribution, print_r($contribution, TRUE) . " in line " . __LINE__);
//test id only format
$contribution = $this->callAPISuccess('contribution', 'get', array(
'id' => $contribution2['id'],
));
}
-/**
- * We need to ensure previous tested behaviour still works as part of the api contract
- */
+ /**
+ * We need to ensure previous tested behaviour still works as part of the api contract
+ */
public function testGetContributionLegacyBehaviour() {
$p = array(
'contact_id' => $this->_individualId,
);
$contribution = $this->callAPIAndDocument('contribution', 'get', $params, __FUNCTION__, __FILE__);
$financialParams['id'] = $this->_financialTypeId;
- $default = null;
+ $default = NULL;
CRM_Financial_BAO_FinancialType::retrieve($financialParams, $default);
- $this->assertEquals(1,$contribution['count']);
+ $this->assertEquals(1, $contribution['count']);
$this->assertEquals($contribution['values'][$contribution['id']]['contact_id'], $this->_individualId);
$this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'], $this->_financialTypeId);
$this->assertEquals($contribution['values'][$contribution['id']]['contribution_type_id'], $this->_financialTypeId);
'id' => $this->_contribution['id'],
'format.only_id' => 1,
));
- $this->assertEquals($this->_contribution['id'], $contribution, print_r($contribution,true) . " in line " . __LINE__);
+ $this->assertEquals($this->_contribution['id'], $contribution, print_r($contribution, TRUE) . " in line " . __LINE__);
//test id only format
$contribution = $this->callAPISuccess('contribution', 'get', array(
'id' => $contribution2['id'],
'contribution_id' => FALSE,
'contact_id' => 1,
'total_amount' => 1,
- 'check_permissions' => false,
+ 'check_permissions' => FALSE,
'financial_type_id' => 'Donation',
);
$this->callAPISuccess('contribution', 'create', $params);
- }
+ }
/*
* ensure we continue to support contribution_type_id as part of the api commitment to
* stability
'contribution_id' => FALSE,
'contact_id' => 1,
'total_amount' => 1,
- 'check_permissions' => false,
+ 'check_permissions' => FALSE,
'contribution_type_id' => 3,
);
$contribution = $this->callAPISuccess('contribution', 'create', $params);
$params = $this->_params;
$params['custom_' . $ids['custom_field_id']] = "custom string";
- $result = $this->callAPIAndDocument($this->_entity, 'create', $params, __FUNCTION__, __FILE__);
+ $result = $this->callAPIAndDocument($this->_entity, 'create', $params, __FUNCTION__, __FILE__);
$this->assertEquals($result['id'], $result['values'][$result['id']]['id']);
$check = $this->callAPISuccess($this->_entity, 'get', array(
'return.custom_' . $ids['custom_field_id'] => 1,
);
$contribution = $this->callAPISuccess('contribution', 'create', $params);
- $lineItems = $this->callAPISuccess('line_item','get',array(
+ $lineItems = $this->callAPISuccess('line_item', 'get', array(
'entity_id' => $contribution['id'],
'entity_table' => 'civicrm_contribution',
'sequential' => 1,
$description = "Create Contribution with Nested Line Items";
$subfile = "CreateWithNestedLineItems";
- $contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__,__FILE__, $description, $subfile);
+ $contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__, $description, $subfile);
- $lineItems = $this->callAPISuccess('line_item','get',array(
+ $lineItems = $this->callAPISuccess('line_item', 'get', array(
'entity_id' => $contribution['id'],
'contribution_id' => $contribution['id'],
'entity_table' => 'civicrm_contribution',
$contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__);
$this->assertEquals($contribution['values'][$contribution['id']]['contact_id'], $this->_individualId);
$this->assertEquals($contribution['values'][$contribution['id']]['total_amount'], 100.00);
- $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'],1 );
+ $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'], 1 );
$this->assertEquals($contribution['values'][$contribution['id']]['trxn_id'], 12345);
$this->assertEquals($contribution['values'][$contribution['id']]['invoice_id'], 67890);
$this->assertEquals($contribution['values'][$contribution['id']]['source'], 'SSF');
$this->assertEquals($contribution['values'][$contribution['id']]['contribution_status_id'], 1);
- $lineItems = $this->callAPISuccess('line_item','get',array(
+ $lineItems = $this->callAPISuccess('line_item', 'get', array(
'entity_id' => $contribution['id'],
'contribution_id' => $contribution['id'],
'entity_table' => 'civicrm_contribution',
public function testCreateContributionWithPaymentInstrument() {
$params = $this->_params + array('payment_instrument' => 'EFT');
$contribution = $this->callAPISuccess('contribution', 'create', $params);
- $contribution = $this->callAPISuccess('contribution','get', array(
+ $contribution = $this->callAPISuccess('contribution', 'get', array(
'sequential' => 1,
'id' => $contribution['id']
));
$this->assertEquals('EFT', $contribution['values'][0]['payment_instrument']);
$this->callAPISuccess('contribution', 'create', array('id' => $contribution['id'], 'payment_instrument' => 'Credit Card'));
- $contribution = $this->callAPISuccess('contribution','get', array(
+ $contribution = $this->callAPISuccess('contribution', 'get', array(
'sequential' => 1,
'id' => $contribution['id']
));
public function testGetContributionByPaymentInstrument() {
$params = $this->_params + array('payment_instrument' => 'EFT');
$params2 = $this->_params + array('payment_instrument' => 'Cash');
- $this->callAPISuccess('contribution','create',$params);
- $this->callAPISuccess('contribution','create',$params2);
- $contribution = $this->callAPISuccess('contribution','get',array( 'sequential' => 1, 'contribution_payment_instrument_id' => 'Cash'));
+ $this->callAPISuccess('contribution', 'create', $params);
+ $this->callAPISuccess('contribution', 'create', $params2);
+ $contribution = $this->callAPISuccess('contribution', 'get', array( 'sequential' => 1, 'contribution_payment_instrument_id' => 'Cash'));
$this->assertArrayHasKey('payment_instrument', $contribution['values'][0]);
- $this->assertEquals('Cash',$contribution['values'][0]['payment_instrument']);
- $this->assertEquals(1,$contribution['count']);
- $contribution = $this->callAPISuccess('contribution','get',array('sequential' => 1, 'payment_instrument_id' => 'EFT'));
+ $this->assertEquals('Cash', $contribution['values'][0]['payment_instrument']);
+ $this->assertEquals(1, $contribution['count']);
+ $contribution = $this->callAPISuccess('contribution', 'get', array('sequential' => 1, 'payment_instrument_id' => 'EFT'));
$this->assertArrayHasKey('payment_instrument', $contribution['values'][0]);
- $this->assertEquals('EFT',$contribution['values'][0]['payment_instrument']);
+ $this->assertEquals('EFT', $contribution['values'][0]['payment_instrument']);
$this->assertEquals(1, $contribution['count']);
- $contribution = $this->callAPISuccess('contribution','get',array( 'sequential' => 1, 'payment_instrument_id' => 5));
+ $contribution = $this->callAPISuccess('contribution', 'get', array( 'sequential' => 1, 'payment_instrument_id' => 5));
$this->assertArrayHasKey('payment_instrument', $contribution['values'][0]);
- $this->assertEquals('EFT',$contribution['values'][0]['payment_instrument']);
- $this->assertEquals(1,$contribution['count']);
- $contribution = $this->callAPISuccess('contribution','get',array( 'sequential' => 1, 'payment_instrument' => 'EFT'));
+ $this->assertEquals('EFT', $contribution['values'][0]['payment_instrument']);
+ $this->assertEquals(1, $contribution['count']);
+ $contribution = $this->callAPISuccess('contribution', 'get', array( 'sequential' => 1, 'payment_instrument' => 'EFT'));
$this->assertArrayHasKey('payment_instrument', $contribution['values'][0]);
$this->assertEquals('EFT', $contribution['values'][0]['payment_instrument']);
$this->assertEquals(1, $contribution['count']);
$contribution = $this->callAPISuccess('contribution', 'create', array('id' => $contribution['id'], 'payment_instrument' => 'Credit Card'));
- $contribution = $this->callAPISuccess('contribution','get',array( 'sequential' => 1, 'id' => $contribution['id'], ));
+ $contribution = $this->callAPISuccess('contribution', 'get', array( 'sequential' => 1, 'id' => $contribution['id'] ));
$this->assertArrayHasKey('payment_instrument', $contribution['values'][0]);
- $this->assertEquals('Credit Card',$contribution['values'][0]['payment_instrument']);
- $this->assertEquals(1,$contribution['count']);
+ $this->assertEquals('Credit Card', $contribution['values'][0]['payment_instrument']);
+ $this->assertEquals(1, $contribution['count']);
}
/**
$description = "Demonstrates creating contribution with SoftCredit";
$subfile = "ContributionCreateWithSoftCredit";
$contact2 = $this->callAPISuccess('Contact', 'create', array('display_name' => 'superman', 'contact_type' => 'Individual'));
- $softparams = array(
+ $softparams = array(
'contact_id' => $contact2['id'],
'amount' => 50,
'soft_credit_type_id' => 3
$params = $this->_params + array('soft_credit' => array(1 => $softparams));
$contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__, $description, $subfile);
- $result = $this->callAPISuccess('contribution','get', array('return'=> 'soft_credit', 'sequential' => 1));
+ $result = $this->callAPISuccess('contribution', 'get', array('return' => 'soft_credit', 'sequential' => 1));
$this->assertEquals($softparams['contact_id'], $result['values'][0]['soft_credit'][1]['contact_id']);
$this->assertEquals($softparams['amount'], $result['values'][0]['soft_credit'][1]['amount']);
'soft_credit_to' => $contact2['id'],
);
$contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__, $description, $subfile);
- $result = $this->callAPISuccess('contribution','get', array('return'=> 'soft_credit', 'sequential' => 1));
+ $result = $this->callAPISuccess('contribution', 'get', array('return' => 'soft_credit', 'sequential' => 1));
$this->assertEquals($contact2['id'], $result['values'][0]['soft_credit'][1]['contact_id']);
// Default soft credit amount = contribution.total_amount
'honor_contact_id' => $contact2['id'],
);
$contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__, $description, $subfile);
- $result = $this->callAPISuccess('contribution','get', array('return'=> 'soft_credit', 'sequential' => 1));
+ $result = $this->callAPISuccess('contribution', 'get', array('return' => 'soft_credit', 'sequential' => 1));
$this->assertEquals($contact2['id'], $result['values'][0]['soft_credit'][1]['contact_id']);
// Default soft credit amount = contribution.total_amount
$this->assertEquals($contribution['values'][$contribution['id']]['total_amount'], 100.00);
$this->assertEquals($contribution['values'][$contribution['id']]['fee_amount'], 50.00);
$this->assertEquals($contribution['values'][$contribution['id']]['net_amount'], 50.00);
- $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'],1 );
+ $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'], 1 );
$this->assertEquals($contribution['values'][$contribution['id']]['trxn_id'], 12345);
$this->assertEquals($contribution['values'][$contribution['id']]['invoice_id'], 67890);
$this->assertEquals($contribution['values'][$contribution['id']]['source'], 'SSF');
$this->assertEquals($contribution['values'][$contribution['id']]['contribution_status_id'], 1);
- $lineItems = $this->callAPISuccess('line_item','get',array(
+ $lineItems = $this->callAPISuccess('line_item', 'get', array(
'entity_id' => $contribution['id'],
'entity_table' => 'civicrm_contribution',
$this->assertEquals(1, $lineItems['count']);
$this->assertEquals($contribution['id'], $lineItems['values'][0]['entity_id']);
$this->assertEquals($contribution['id'], $lineItems['values'][0]['contribution_id']);
- $lineItems = $this->callAPISuccess('line_item','get',array(
+ $lineItems = $this->callAPISuccess('line_item', 'get', array(
'entity_id' => $contribution['id'],
'contribution_id' => $contribution['id'],
*/
public function testCreateContributionOnline() {
CRM_Financial_BAO_PaymentProcessor::create($this->_processorParams);
- $contributionPage = $this->callAPISuccess( 'contribution_page','create', $this->_pageParams );
+ $contributionPage = $this->callAPISuccess( 'contribution_page', 'create', $this->_pageParams );
$this->assertAPISuccess($contributionPage);
$params = array(
'contact_id' => $this->_individualId,
$contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__);
$this->assertEquals($contribution['values'][$contribution['id']]['contact_id'], $this->_individualId);
$this->assertEquals($contribution['values'][$contribution['id']]['total_amount'], 100.00);
- $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'],1 );
+ $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'], 1 );
$this->assertEquals($contribution['values'][$contribution['id']]['trxn_id'], 12345);
$this->assertEquals($contribution['values'][$contribution['id']]['invoice_id'], 67890);
$this->assertEquals($contribution['values'][$contribution['id']]['source'], 'SSF');
public function testCreateContributionPayLaterOnline() {
CRM_Financial_BAO_PaymentProcessor::create($this->_processorParams);
$this->_pageParams['is_pay_later'] = 1;
- $contributionPage = $this->callAPISuccess( 'contribution_page','create',$this->_pageParams );
+ $contributionPage = $this->callAPISuccess( 'contribution_page', 'create', $this->_pageParams );
$this->assertAPISuccess($contributionPage);
$params = array(
'contact_id' => $this->_individualId,
$contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__);
$this->assertEquals($contribution['values'][$contribution['id']]['contact_id'], $this->_individualId);
$this->assertEquals($contribution['values'][$contribution['id']]['total_amount'], 100.00);
- $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'],1 );
+ $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'], 1 );
$this->assertEquals($contribution['values'][$contribution['id']]['trxn_id'], 12345);
$this->assertEquals($contribution['values'][$contribution['id']]['invoice_id'], 67890);
$this->assertEquals($contribution['values'][$contribution['id']]['source'], 'SSF');
$contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__);
$this->assertEquals($contribution['values'][$contribution['id']]['contact_id'], $this->_individualId);
$this->assertEquals($contribution['values'][$contribution['id']]['total_amount'], 100.00);
- $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'],1 );
+ $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'], 1 );
$this->assertEquals($contribution['values'][$contribution['id']]['trxn_id'], 12345);
$this->assertEquals($contribution['values'][$contribution['id']]['invoice_id'], 67890);
$this->assertEquals($contribution['values'][$contribution['id']]['source'], 'SSF');
*/
public function testCreateUpdateContributionChangeTotal() {
$contribution = $this->callAPISuccess('contribution', 'create', $this->_params);
- $lineItems = $this->callAPISuccess('line_item','getvalue', array(
+ $lineItems = $this->callAPISuccess('line_item', 'getvalue', array(
'entity_id' => $contribution['id'],
'entity_table' => 'civicrm_contribution',
'total_amount' => '125');
$contribution = $this->callAPISuccess('contribution', 'create', $newParams);
- $lineItems = $this->callAPISuccess('line_item','getvalue',array(
+ $lineItems = $this->callAPISuccess('line_item', 'getvalue', array(
'entity_id' => $contribution['id'],
'entity_table' => 'civicrm_contribution',
);
$contribution = $this->callAPISuccess('contribution', 'create', $newParams);
$contribution = $contribution['values'][$contribution['id']];
- $this->assertEquals($contribution['contribution_status_id'],'1');
+ $this->assertEquals($contribution['contribution_status_id'], '1');
$this->_checkFinancialItem($contribution['id'], 'paylater');
$this->_checkFinancialTrxn($contribution, 'payLater');
}
'contribution_status_id' => 2,
)
);
- $this->callAPIFailure('contribution', 'create', $newParams,ts('Cannot change contribution status from Completed to Pending.'));
+ $this->callAPIFailure('contribution', 'create', $newParams, ts('Cannot change contribution status from Completed to Pending.'));
}
$this->assertEquals($contribution['values'][$contributionID]['contact_id'], $this->_individualId);
$this->assertEquals($contribution['values'][$contributionID]['total_amount'], 110.00);
- $this->assertEquals($contribution['values'][$contributionID]['financial_type_id'],$this->_financialTypeId );
+ $this->assertEquals($contribution['values'][$contributionID]['financial_type_id'], $this->_financialTypeId );
$this->assertEquals($contribution['values'][$contributionID]['instrument_id'], $old_payment_instrument);
$this->assertEquals($contribution['values'][$contributionID]['non_deductible_amount'], 10.00);
$this->assertEquals($contribution['values'][$contributionID]['fee_amount'], $old_fee_amount);
* that person
*/
public function testCompleteTransaction() {
- $mut = new CiviMailUtils( $this, true );
+ $mut = new CiviMailUtils( $this, TRUE );
$this->createLoggedInUser();
- $params = array_merge($this->_params, array('contribution_status_id' => 2,));
- $contribution = $this->callAPISuccess('contribution','create', $params);
+ $params = array_merge($this->_params, array('contribution_status_id' => 2));
+ $contribution = $this->callAPISuccess('contribution', 'create', $params);
$this->callAPISuccess('contribution', 'completetransaction', array(
'id' => $contribution['id'],
));
- $contribution = $this->callAPISuccess('contribution', 'get', array('id' => $contribution['id'], 'sequential' => 1,));
+ $contribution = $this->callAPISuccess('contribution', 'get', array('id' => $contribution['id'], 'sequential' => 1));
$this->assertEquals('Completed', $contribution['values'][0]['contribution_status']);
$mut->checkMailLog(array(
'Receipt - Contribution',
* tests.
*/
public function testCompleteTransactionWithReceiptDateSet() {
- $mut = new CiviMailUtils( $this, true );
+ $mut = new CiviMailUtils( $this, TRUE );
$this->createLoggedInUser();
- $params = array_merge($this->_params, array('contribution_status_id' => 2,'receipt_date' => 'now'));
- $contribution = $this->callAPISuccess('contribution','create', $params);
- $this->callAPISuccess('contribution', 'completetransaction', array('id' => $contribution['id'],));
- $contribution = $this->callAPISuccess('contribution', 'get', array('id' => $contribution['id'], 'sequential' => 1,));
+ $params = array_merge($this->_params, array('contribution_status_id' => 2, 'receipt_date' => 'now'));
+ $contribution = $this->callAPISuccess('contribution', 'create', $params);
+ $this->callAPISuccess('contribution', 'completetransaction', array('id' => $contribution['id']));
+ $contribution = $this->callAPISuccess('contribution', 'get', array('id' => $contribution['id'], 'sequential' => 1));
$this->assertEquals('Completed', $contribution['values'][0]['contribution_status']);
$mut->checkMailLog(array(
'Receipt - Contribution',
* that person
*/
public function testCompleteTransactionWithParticipantRecord() {
- $mut = new CiviMailUtils( $this, true );
+ $mut = new CiviMailUtils( $this, TRUE );
$mut->clearMessages();
$this->createLoggedInUser();
$contributionID = $this->createPendingParticipantContribution();
public function testCompleteTransactionMembershipPriceSet() {
$this->createPriceSetWithPage('membership');
$this->setUpPendingContribution($this->_ids['price_field_value'][0]);
- $this->callAPISuccess('contribution', 'completetransaction', array('id' => $this->_ids['contribution']));
+ $this->callAPISuccess('contribution', 'completetransaction', array('id' => $this->_ids['contribution']));
$membership = $this->callAPISuccess('membership', 'getsingle', array('id' => $this->_ids['membership']));
$this->assertEquals(date('Y-m-d', strtotime('yesterday + 1 year')), $membership['end_date']);
$this->cleanUpAfterPriceSets();
public function testCompleteTransactionMembershipPriceSetTwoTerms() {
$this->createPriceSetWithPage('membership');
$this->setUpPendingContribution($this->_ids['price_field_value'][1]);
- $this->callAPISuccess('contribution', 'completetransaction', array('id' => $this->_ids['contribution']));
+ $this->callAPISuccess('contribution', 'completetransaction', array('id' => $this->_ids['contribution']));
$membership = $this->callAPISuccess('membership', 'getsingle', array('id' => $this->_ids['membership']));
$this->assertEquals(date('Y-m-d', strtotime('yesterday + 2 years')), $membership['end_date']);
$this->cleanUpAfterPriceSets();
* Test sending a mail via the API
*/
public function testSendMail() {
- $mut = new CiviMailUtils( $this, true );
- $contribution = $this->callAPISuccess('contribution','create',$this->_params);
+ $mut = new CiviMailUtils( $this, TRUE );
+ $contribution = $this->callAPISuccess('contribution', 'create', $this->_params);
$this->callAPISuccess('contribution', 'sendconfirmation', array(
'id' => $contribution['id'],
'receipt_from_email' => 'api@civicrm.org',
* Test sending a mail via the API
*/
public function testSendMailEvent() {
- $mut = new CiviMailUtils( $this, true );
- $contribution = $this->callAPISuccess('contribution','create',$this->_params);
+ $mut = new CiviMailUtils( $this, TRUE );
+ $contribution = $this->callAPISuccess('contribution', 'create', $this->_params);
$event = $this->eventCreate(array(
'is_email_confirm' => 1,
'confirm_from_email' => 'test@civicrm.org',
'Annual CiviCRM meet',
'Event',
'To: "Mr. Anthony Anderson II" <anthony_anderson@civicrm.org>',
- ), array(
-
- )
+ ), array()
);
$mut->stop();
}
/**
- * This function does a GET & compares the result against the $params
- * Use as a double check on Creates
- */
+ * This function does a GET & compares the result against the $params
+ * Use as a double check on Creates
+ */
public function contributionGetnCheck($params, $id, $delete = 1) {
$contribution = $this->callAPISuccess('Contribution', 'Get', array(
* (along with an event)
*/
public function createPendingParticipantContribution(){
- $event = $this->eventCreate(array('is_email_confirm' => 1, 'confirm_from_email' => 'test@civicrm.org',));
+ $event = $this->eventCreate(array('is_email_confirm' => 1, 'confirm_from_email' => 'test@civicrm.org'));
$participantID = $this->participantCreate(array('event_id' => $event['id'], 'status_id' => 6));
$this->_ids['participant'] = $participantID;
$params = array_merge($this->_params, array('contribution_status_id' => 2, 'financial_type_id' => 'Event Fee'));
- $contribution = $this->callAPISuccess('contribution','create', $params);
+ $contribution = $this->callAPISuccess('contribution', 'create', $params);
$this->callAPISuccess('participant_payment', 'create', array('contribution_id' => $contribution['id'], 'participant_id' => $participantID));
$this->callAPISuccess('line_item', 'get', array(
'entity_id' => $contribution['id'],
* @return null|string
*/
function _getFinancialTrxnAmount($contId) {
- $query = "SELECT
+ $query = "SELECT
SUM( ft.total_amount ) AS total
FROM civicrm_financial_trxn AS ft
LEFT JOIN civicrm_entity_financial_trxn AS ceft ON ft.id = ceft.financial_trxn_id
WHERE ceft.entity_table = 'civicrm_contribution'
AND ceft.entity_id = {$contId}";
- $result = CRM_Core_DAO::singleValueQuery($query);
- return $result;
- }
+ $result = CRM_Core_DAO::singleValueQuery($query);
+ return $result;
+ }
/**
* @param int $contId
* @return null|string
*/
function _getFinancialItemAmount($contId) {
- $lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution'));
- $query = "SELECT
+ $lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution'));
+ $query = "SELECT
SUM(amount)
FROM civicrm_financial_item
WHERE entity_table = 'civicrm_line_item'
AND entity_id = {$lineItem}";
- $result = CRM_Core_DAO::singleValueQuery($query);
- return $result;
- }
+ $result = CRM_Core_DAO::singleValueQuery($query);
+ return $result;
+ }
/**
* @param int $contId
* @param $context
*/
public function _checkFinancialItem($contId, $context) {
- if ($context != 'paylater') {
- $params = array (
- 'entity_id' => $contId,
+ if ($context != 'paylater') {
+ $params = array(
+ 'entity_id' => $contId,
'entity_table' => 'civicrm_contribution',
- );
- $trxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($params, TRUE));
- $entityParams = array(
+ );
+ $trxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($params, TRUE));
+ $entityParams = array(
'financial_trxn_id' => $trxn['financial_trxn_id'],
'entity_table' => 'civicrm_financial_item',
- );
- $entityTrxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams));
- $params = array(
+ );
+ $entityTrxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams));
+ $params = array(
'id' => $entityTrxn['entity_id'],
- );
- }
- if ($context == 'paylater') {
- $lineItems = CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution');
- foreach ($lineItems as $key=>$item) {
- $params = array(
+ );
+ }
+ if ($context == 'paylater') {
+ $lineItems = CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution');
+ foreach ($lineItems as $key => $item) {
+ $params = array(
'entity_id' => $key,
'entity_table' => 'civicrm_line_item',
- );
- $compareParams = array ('status_id' => 1);
- $this->assertDBCompareValues('CRM_Financial_DAO_FinancialItem', $params, $compareParams);
- }
- }
- elseif ($context == 'refund') {
- $compareParams = array(
+ );
+ $compareParams = array('status_id' => 1);
+ $this->assertDBCompareValues('CRM_Financial_DAO_FinancialItem', $params, $compareParams);
+ }
+ }
+ elseif ($context == 'refund') {
+ $compareParams = array(
'status_id' => 1,
'financial_account_id' => 1,
'amount' => -100,
- );
- }
- elseif ($context == 'cancelPending') {
- $compareParams = array(
+ );
+ }
+ elseif ($context == 'cancelPending') {
+ $compareParams = array(
'status_id' => 3,
'financial_account_id' => 1,
'amount' => -100,
- );
- }
- elseif ($context == 'changeFinancial') {
- $lineKey = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution'));
- $params = array(
+ );
+ }
+ elseif ($context == 'changeFinancial') {
+ $lineKey = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution'));
+ $params = array(
'entity_id' => $lineKey,
'amount' => -100,
- );
- $compareParams = array(
+ );
+ $compareParams = array(
'financial_account_id' => 1,
- );
- $this->assertDBCompareValues('CRM_Financial_DAO_FinancialItem', $params, $compareParams);
- $params = array(
+ );
+ $this->assertDBCompareValues('CRM_Financial_DAO_FinancialItem', $params, $compareParams);
+ $params = array(
'financial_account_id' => 3,
'entity_id' => $lineKey,
- );
- $compareParams = array(
+ );
+ $compareParams = array(
'amount' => 100,
- );
- }
- if ($context != 'paylater') {
- $this->assertDBCompareValues('CRM_Financial_DAO_FinancialItem', $params, $compareParams);
- }
- }
+ );
+ }
+ if ($context != 'paylater') {
+ $this->assertDBCompareValues('CRM_Financial_DAO_FinancialItem', $params, $compareParams);
+ }
+ }
/**
* @param $contribution
* @param int $instrumentId
*/
public function _checkFinancialTrxn($contribution, $context, $instrumentId = NULL) {
- $trxnParams = array(
- 'entity_id' => $contribution['id'],
+ $trxnParams = array(
+ 'entity_id' => $contribution['id'],
'entity_table' => 'civicrm_contribution',
- );
- $trxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($trxnParams, TRUE));
- $params = array(
+ );
+ $trxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($trxnParams, TRUE));
+ $params = array(
'id' => $trxn['financial_trxn_id'],
- );
- if ($context == 'payLater') {
- $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
- $compareParams = array(
+ );
+ if ($context == 'payLater') {
+ $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
+ $compareParams = array(
'status_id' => 1,
'from_financial_account_id' => CRM_Contribute_PseudoConstant::financialAccountType($contribution['financial_type_id'], $relationTypeId),
- );
- }
- elseif ($context == 'refund') {
- $compareParams = array(
+ );
+ }
+ elseif ($context == 'refund') {
+ $compareParams = array(
'to_financial_account_id' => 6,
'total_amount' => -100,
'status_id' => 7,
- );
- }
- elseif ($context == 'cancelPending') {
- $compareParams = array(
+ );
+ }
+ elseif ($context == 'cancelPending') {
+ $compareParams = array(
'from_financial_account_id' => 7,
'total_amount' => -100,
'status_id' => 3,
- );
- }
- elseif ($context == 'changeFinancial' || $context == 'paymentInstrument') {
- $entityParams = array(
- 'entity_id' => $contribution['id'],
+ );
+ }
+ elseif ($context == 'changeFinancial' || $context == 'paymentInstrument') {
+ $entityParams = array(
+ 'entity_id' => $contribution['id'],
'entity_table' => 'civicrm_contribution',
'amount' => -100,
- );
- $trxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams));
- $trxnParams1 = array(
+ );
+ $trxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams));
+ $trxnParams1 = array(
'id' => $trxn['financial_trxn_id'],
- );
- $compareParams = array(
+ );
+ $compareParams = array(
'total_amount' => -100,
'status_id' => 1,
- );
- if ($context == 'paymentInstrument') {
- $compareParams += array(
+ );
+ if ($context == 'paymentInstrument') {
+ $compareParams += array(
'to_financial_account_id' => CRM_Financial_BAO_FinancialTypeAccount::getInstrumentFinancialAccount(4),
'payment_instrument_id' => 4,
- );
- }
- else {
- $compareParams['to_financial_account_id'] = 12;
- }
- $this->assertDBCompareValues('CRM_Financial_DAO_FinancialTrxn', $trxnParams1, $compareParams);
- $compareParams['total_amount'] = 100;
- if ($context == 'paymentInstrument') {
- $compareParams['to_financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getInstrumentFinancialAccount($instrumentId);
- $compareParams['payment_instrument_id'] = $instrumentId;
- }
- else {
- $compareParams['to_financial_account_id'] = 12;
- }
- }
-
- $this->assertDBCompareValues('CRM_Financial_DAO_FinancialTrxn', $params, $compareParams);
- }
+ );
+ }
+ else {
+ $compareParams['to_financial_account_id'] = 12;
+ }
+ $this->assertDBCompareValues('CRM_Financial_DAO_FinancialTrxn', $trxnParams1, $compareParams);
+ $compareParams['total_amount'] = 100;
+ if ($context == 'paymentInstrument') {
+ $compareParams['to_financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getInstrumentFinancialAccount($instrumentId);
+ $compareParams['payment_instrument_id'] = $instrumentId;
+ }
+ else {
+ $compareParams['to_financial_account_id'] = 12;
+ }
+ }
+
+ $this->assertDBCompareValues('CRM_Financial_DAO_FinancialTrxn', $params, $compareParams);
+ }
/**
* @return mixed
*/
public function _addPaymentInstrument () {
- $gId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'payment_instrument', 'id', 'name');
- $optionParams = array(
+ $gId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'payment_instrument', 'id', 'name');
+ $optionParams = array(
'option_group_id' => $gId,
'label' => 'Test Card',
'name' => 'Test Card',
'value' => '6',
'weight' => '6',
'is_active' => 1,
-);
- $optionValue = $this->callAPISuccess('option_value', 'create', $optionParams);
- $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Asset Account is' "));
- $financialParams = array(
+ );
+ $optionValue = $this->callAPISuccess('option_value', 'create', $optionParams);
+ $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Asset Account is' "));
+ $financialParams = array(
'entity_table' => 'civicrm_option_value',
'entity_id' => $optionValue['id'],
'account_relationship' => $relationTypeId,
'financial_account_id' => 7,
- );
- CRM_Financial_BAO_FinancialTypeAccount::add($financialParams, CRM_Core_DAO::$_nullArray);
- $this->assertNotEmpty($optionValue['values'][$optionValue['id']]['value']);
- return $optionValue['values'][$optionValue['id']]['value'];
- }
+ );
+ CRM_Financial_BAO_FinancialTypeAccount::add($financialParams, CRM_Core_DAO::$_nullArray);
+ $this->assertNotEmpty($optionValue['values'][$optionValue['id']]['value']);
+ return $optionValue['values'][$optionValue['id']]['value'];
+ }
/**
* @param array $params
* @param $context
*/
- public function _checkFinancialRecords($params,$context) {
- $entityParams = array(
+ public function _checkFinancialRecords($params, $context) {
+ $entityParams = array(
'entity_id' => $params['id'],
'entity_table' => 'civicrm_contribution',
- );
+ );
$contribution = $this->callAPISuccess('contribution', 'getsingle', array('id' => $params['id']));
$this->assertEquals($contribution['total_amount'] - $contribution['fee_amount'], $contribution['net_amount']);
- if ($context == 'pending') {
- $trxn = CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams);
- $this->assertNull($trxn, 'No Trxn to be created until IPN callback');
- return;
- }
- $trxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams));
- $trxnParams = array(
+ if ($context == 'pending') {
+ $trxn = CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams);
+ $this->assertNull($trxn, 'No Trxn to be created until IPN callback');
+ return;
+ }
+ $trxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams));
+ $trxnParams = array(
'id' => $trxn['financial_trxn_id'],
- );
- if ($context != 'online' && $context != 'payLater') {
- $compareParams = array(
+ );
+ if ($context != 'online' && $context != 'payLater') {
+ $compareParams = array(
'to_financial_account_id' => 6,
'total_amount' => 100,
'status_id' => 1,
- );
- }
- if ($context == 'feeAmount') {
- $compareParams['fee_amount'] = 50;
- }
- elseif ($context == 'online') {
- $compareParams = array(
+ );
+ }
+ if ($context == 'feeAmount') {
+ $compareParams['fee_amount'] = 50;
+ }
+ elseif ($context == 'online') {
+ $compareParams = array(
'to_financial_account_id' => 12,
'total_amount' => 100,
'status_id' => 1,
- );
- }
- elseif ($context == 'payLater') {
- $compareParams = array(
+ );
+ }
+ elseif ($context == 'payLater') {
+ $compareParams = array(
'to_financial_account_id' => 7,
'total_amount' => 100,
'status_id' => 2,
- );
- }
- $this->assertDBCompareValues('CRM_Financial_DAO_FinancialTrxn',$trxnParams, $compareParams);
- $entityParams = array(
+ );
+ }
+ $this->assertDBCompareValues('CRM_Financial_DAO_FinancialTrxn', $trxnParams, $compareParams);
+ $entityParams = array(
'financial_trxn_id' => $trxn['financial_trxn_id'],
'entity_table' => 'civicrm_financial_item',
- );
- $entityTrxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams));
- $fitemParams = array(
+ );
+ $entityTrxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams));
+ $fitemParams = array(
'id' => $entityTrxn['entity_id'],
- );
- $compareParams = array(
+ );
+ $compareParams = array(
'amount' => 100,
'status_id' => 1,
'financial_account_id' => 1,
- );
- if ($context == 'payLater') {
- $compareParams = array(
+ );
+ if ($context == 'payLater') {
+ $compareParams = array(
'amount' => 100,
'status_id' => 3,
'financial_account_id' => 1,
- );
- }
- $this->assertDBCompareValues('CRM_Financial_DAO_FinancialItem', $fitemParams, $compareParams);
- if ($context == 'feeAmount') {
- $maxParams = array(
+ );
+ }
+ $this->assertDBCompareValues('CRM_Financial_DAO_FinancialItem', $fitemParams, $compareParams);
+ if ($context == 'feeAmount') {
+ $maxParams = array(
'entity_id' => $params['id'],
'entity_table' => 'civicrm_contribution',
- );
- $maxTrxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($maxParams, TRUE));
- $trxnParams = array(
+ );
+ $maxTrxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($maxParams, TRUE));
+ $trxnParams = array(
'id' => $maxTrxn['financial_trxn_id'],
- );
- $compareParams = array(
+ );
+ $compareParams = array(
'to_financial_account_id' => 5,
'from_financial_account_id' => 6,
'total_amount' => 50,
'status_id' => 1,
- );
- $trxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($params['id'], 'DESC');
- $this->assertDBCompareValues('CRM_Financial_DAO_FinancialTrxn', $trxnParams, $compareParams);
- $fitemParams = array(
+ );
+ $trxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($params['id'], 'DESC');
+ $this->assertDBCompareValues('CRM_Financial_DAO_FinancialTrxn', $trxnParams, $compareParams);
+ $fitemParams = array(
'entity_id' => $trxnId['financialTrxnId'],
'entity_table' => 'civicrm_financial_trxn',
- );
- $compareParams = array(
+ );
+ $compareParams = array(
'amount' => 50,
'status_id' => 1,
'financial_account_id' => 5,
- );
- $this->assertDBCompareValues('CRM_Financial_DAO_FinancialItem', $fitemParams, $compareParams);
- }
- }
+ );
+ $this->assertDBCompareValues('CRM_Financial_DAO_FinancialItem', $fitemParams, $compareParams);
+ }
+ }
}
/**
* Test APIv3 civicrm_country* functions
*
- * @package CiviCRM_APIv3
- * @subpackage API_Contact
+ * @package CiviCRM_APIv3
+ * @subpackage API_Contact
*/
class api_v3_CountryTest extends CiviUnitTestCase {
protected $_apiversion;
//create one
$create = $this->callAPISuccess('country', 'create', $this->_params);
- $result = $this->callAPIAndDocument('country', 'delete', array('id' => $create['id'],), __FUNCTION__, __FILE__);
+ $result = $this->callAPIAndDocument('country', 'delete', array('id' => $create['id']), __FUNCTION__, __FILE__);
$this->assertEquals(1, $result['count']);
$get = $this->callAPISuccess('country', 'get', array(
'id' => $create['id'],
public function testGet() {
$country = $this->callAPISuccess('Country', 'create', $this->_params);
$params = array(
- 'iso_code' => $this->_params['iso_code'],
+ 'iso_code' => $this->_params['iso_code'],
);
$result = $this->callAPIAndDocument('Country', 'Get', $params, __FUNCTION__, __FILE__);
$this->assertEquals($country['values'][$country['id']]['name'], $result['values'][$country['id']]['name']);
/**
* Test APIv3 civicrm_create_custom_group
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class api_v3_CustomFieldTest extends CiviUnitTestCase {
protected $_apiversion;
$n++;
}
}
-/*
- * Can't figure out the point of this?
- */
+ /*
+ * Can't figure out the point of this?
+ */
/**
* @param array $params
*/
'option_weight' => array( 1, 2),
'option_status' => array( 1, 1),
));
-*/
-
-
+ */
return $params;
}
$this->assertTrue(is_numeric($optionGroupID) && ($optionGroupID > 0));
$optionGroup = $this->callAPISuccess('option_group', 'getsingle', array(
'id' => $optionGroupID));
- $this->assertEquals($optionGroup['title'],'Country');
+ $this->assertEquals($optionGroup['title'], 'Country');
$optionValueCount = $this->callAPISuccess('option_value', 'getcount', array(
'option_group_id' => $optionGroupID));
$this->assertEquals(0, $optionValueCount);
'return' => 'option_group_id',
));
- $this->assertEquals($optionGroupID,3);
+ $this->assertEquals($optionGroupID, 3);
}
$customGroup = $this->customGroupCreate(array('extends' => 'Contact', 'title' => 'select_test_group'));
$option_values = array(
- array('weight' => 1,
+ array(
+ 'weight' => 1,
'label' => 'Label1',
'value' => 1,
'is_active' => 1,
);
$description = "Demonstrate retrieving metadata with custom field options";
$subfile = "GetFieldsOptions";
- $fields = $this->callAPIAndDocument('contact', 'getfields', $getFieldsParams, __FUNCTION__, 'ContactTest.php', $description,$subfile,'GetFields');
+ $fields = $this->callAPIAndDocument('contact', 'getfields', $getFieldsParams, __FUNCTION__, 'ContactTest.php', $description, $subfile, 'GetFields');
$this->assertArrayHasKey('options', $fields['values']['custom_' . $customField['id']]);
$this->assertEquals('Label1', $fields['values']['custom_' . $customField['id']]['options'][1]);
$getOptionsArray = array(
/**
* Test APIv3 civicrm_custom_group* functions
*
- * @package CiviCRM_APIv3
- * @subpackage API_CustomGroup
+ * @package CiviCRM_APIv3
+ * @subpackage API_CustomGroup
*/
class api_v3_CustomGroupTest extends CiviUnitTestCase {
* Check without title
*/
public function testCustomGroupCreateNoTitle() {
- $params = array('extends' => array('Contact'),
+ $params = array(
+ 'extends' => array('Contact'),
'weight' => 5,
'collapse_display' => 1,
'style' => 'Tab',
/**
* Test APIv3 civicrm_activity_* functions
*
- * @package CiviCRM_APIv3
- * @subpackage API_Contact
+ * @package CiviCRM_APIv3
+ * @subpackage API_Contact
*/
class api_v3_CustomValueContactTypeTest extends CiviUnitTestCase {
protected $_contactID;
- protected $_apiversion =3;
+ protected $_apiversion = 3;
protected $CustomGroupIndividual;
protected $individualStudent;
$this->organizationSponsor = $this->organizationCreate($params);
//refresh php cached variables
CRM_Core_PseudoConstant::flush();
- CRM_Core_BAO_CustomField::getTableColumnGroup($this->IndividualField['id'], True);
- CRM_Core_BAO_CustomField::getTableColumnGroup($this->IndiStudentField['id'], True);
+ CRM_Core_BAO_CustomField::getTableColumnGroup($this->IndividualField['id'], TRUE);
+ CRM_Core_BAO_CustomField::getTableColumnGroup($this->IndiStudentField['id'], TRUE);
}
public function tearDown() {
$params = array(
'id' => $this->organization,
'contact_type' => 'Organization',
- "custom_{$this->IndividualField['id']}" => 'Test String', 'debug' => 1,// so that undefined_fields is returned
+ "custom_{$this->IndividualField['id']}" => 'Test String',
+ 'debug' => 1, // so that undefined_fields is returned
);
$contact = $this->callAPISuccess('contact', 'create', $params);
public function testAddCustomDataEmptyToIndividual() {
$contact = $this->callAPIFailure('contact', 'create', array(),
'Mandatory key(s) missing from params array: contact_type'
- );
+ );
}
/**
'contact_id' => $this->organizationSponsor,
'contact_type' => 'Organization',
"custom_{$this->IndiStudentField['id']}" => 'Test String',
- 'debug' => 1,// so that undefined_fields is returned
+ 'debug' => 1, // so that undefined_fields is returned
);
$contact = $this->callAPISuccess('contact', 'create', $params);
$params = array(
'contact_id' => $this->individualStudent,
'contact_type' => 'Individual',
- "custom_{$this->IndiStudentField['id']}" => 'Test String', );
+ "custom_{$this->IndiStudentField['id']}" => 'Test String', );
$result = $this->callAPISuccess('contact', 'create', $params);
$params = array(
'contact_id' => $this->individualParent,
'contact_type' => 'Individual',
- "custom_{$this->IndiStudentField['id']}" => 'Test String', 'debug' => 1,// so that undefined_fields is returned
+ "custom_{$this->IndiStudentField['id']}" => 'Test String',
+ 'debug' => 1, // so that undefined_fields is returned
);
$contact = $this->callAPISuccess('contact', 'create', $params);
$this->assertTrue(is_array($contact['undefined_fields']), __LINE__);
$params = array(
'contact_id' => $this->individual,
'contact_type' => 'Individual',
- "custom_" . $this->IndividualField['id'] => 'Test String', );
+ "custom_" . $this->IndividualField['id'] => 'Test String', );
$contact = $this->callAPISuccess('contact', 'create', $params);
'contact_id' => $this->individualStudent,
'contact_type' => 'Individual',
'contact_sub_type' => 'Student',
- "custom_{$this->IndiStudentField['id']}" => 'Test String', );
+ "custom_{$this->IndiStudentField['id']}" => 'Test String', );
$contact = $this->callAPISuccess('contact', 'create', $params);
$this->assertAPISuccess($contact);
$params = array(
'contact_id' => $this->individualStudent,
'contact_type' => 'Individual',
- 'contact_sub_type' => 'Student', "return.custom_{$this->IndiStudentField['id']}" => 1,
+ 'contact_sub_type' => 'Student',
+ "return.custom_{$this->IndiStudentField['id']}" => 1,
);
$getContact = $this->callAPISuccess('contact', 'get', $params);
-
$this->assertEquals($getContact['values'][$this->individualStudent]["custom_{$this->IndiStudentField['id']}"], 'Test String', 'In line ' . __LINE__);
}
}
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
require_once 'CiviTest/CiviUnitTestCase.php';
* Class api_v3_CustomValueTest
*/
class api_v3_CustomValueTest extends CiviUnitTestCase {
- protected $_apiversion =3;
+ protected $_apiversion = 3;
protected $individual;
protected $params;
protected $ids;
'custom_' . $this->ids['multi2']['custom_field_id'][2] => "vegemite",
);
-
$result = $this->callAPISuccess('Contact', 'create', $params);
$contact_id = $result['id'];
$firstCustomField = $this->ids['multi']['custom_field_id'][0];
$this->assertEquals('', $result['values'][$thirdCustomField]['1']);
$this->assertEquals('value 4', $result['values'][$thirdCustomField]['2']);
}
-
+
public function testMultipleCustomValues() {
$params = array(
'first_name' => 'abc3',
$firstCustomField = $this->ids['multi']['custom_field_id'][1];
$secondCustomField = $this->ids['single']['custom_field_id'];
$thirdCustomField = $this->ids['multi']['custom_field_id'][0];
-
+
$createParams = array(
'contact_type' => 'Individual',
'id' => $contact_id,
$result = $this->callAPISuccess('CustomValue', 'Get', $params);
// delete the contact
$this->callAPISuccess('contact', 'delete', array('id' => $contact_id));
-
+
$this->assertEquals($contact_id, $result['values'][$secondCustomField]['entity_id']);
$this->assertEquals('value 1', $result['values'][$secondCustomField]['latest']);
$this->assertEquals('value 1', $result['values'][$secondCustomField][0]);
$this->assertEquals($contact_id, $result['values'][$thirdCustomField]['entity_id']);
$this->assertEquals('multi value 1', $result['values'][$thirdCustomField][1]);
$this->assertEquals('multi value 2', $result['values'][$thirdCustomField][2]);
-
+
$this->assertEquals($contact_id, $result['values'][$firstCustomField]['entity_id']);
$this->assertEquals('second multi value 1', $result['values'][$firstCustomField][1]);
$this->assertEquals('', $result['values'][$firstCustomField][2]);
/**
* Test class for Domain API - civicrm_domain_*
*
- * @package CiviCRM_APIv3
- * @subpackage API_Domain
+ * @package CiviCRM_APIv3
+ * @subpackage API_Domain
*/
class api_v3_DomainTest extends CiviUnitTestCase {
)
);
- $this->callAPISuccess('domain','create',array(
+ $this->callAPISuccess('domain', 'create', array(
'id' => 1,
'contact_id' => $domContact['id'],
)
*/
public function testGet() {
- $params = array('sequential' => 1,);
+ $params = array('sequential' => 1);
$result = $this->callAPIAndDocument('domain', 'get', $params, __FUNCTION__, __FILE__);
$this->assertType('array', $result);
$this->assertArrayHasKey('domain_email', $domain);
$this->assertArrayHasKey('domain_phone', $domain);
$this->assertArrayHasKey('domain_address', $domain);
- $this->assertEquals("my@email.com",$domain['domain_email']);
- $this->assertEquals("456-456",$domain['domain_phone']['phone']);
- $this->assertEquals("45 Penny Lane",$domain['domain_address']['street_address']);
+ $this->assertEquals("my@email.com", $domain['domain_email']);
+ $this->assertEquals("456-456", $domain['domain_phone']['phone']);
+ $this->assertEquals("45 Penny Lane", $domain['domain_address']['street_address']);
}
}
//create one
$create = $this->callAPISuccess('email', 'create', $params);
- $result = $this->callAPIAndDocument('email', 'delete', array('id' => $create['id'],), __FUNCTION__, __FILE__);
+ $result = $this->callAPIAndDocument('email', 'delete', array('id' => $create['id']), __FUNCTION__, __FILE__);
$this->assertEquals(1, $result['count'], 'In line ' . __LINE__);
$get = $this->callAPISuccess('email', 'get', array(
'location_type_id' => $this->_locationType->id,
array(
'title' => 'Annual CiviCRM meet',
'event_type_id' => 1,
- 'start_date' => 20081021, ),
+ 'start_date' => 20081021, ),
array(
'title' => 'Annual CiviCRM meet 2',
'event_type_id' => 1,
- 'start_date' => 20101021, ),
+ 'start_date' => 20101021, ),
);
$this->events = array();
public function testGetEventByIdSort() {
$params = array(
'return.sort' => 'id ASC',
- 'return.max_results' => 1, );
+ 'return.max_results' => 1, );
$result = $this->callAPISuccess('Event', 'Get', $params);
$this->assertEquals(1, $result['id'], ' in line ' . __LINE__);
$params = array(
'options' => array(
'sort' => 'id DESC',
'limit' => 1,
- ), );
+ ), );
$result = $this->callAPISuccess('Event', 'Get', $params);
$this->assertAPISuccess($result, ' in line ' . __LINE__);
'options' => array(
'sort' => 'id ASC',
'limit' => 1,
- ), );
+ ), );
$result = $this->callAPISuccess('Event', 'Get', $params);
$this->assertEquals(1, $result['id'], ' in line ' . __LINE__);
-
}
/*
* Getting the id back of an event.
$params = array(
'isCurrent' => 1,
);
- $currentEventParams = array('start_date' => date('Y-m-d', strtotime('+ 1 day')),
+ $currentEventParams = array(
+ 'start_date' => date('Y-m-d', strtotime('+ 1 day')),
'end_date' => date('Y-m-d', strtotime('+ 1 week')),
);
$currentEventParams = array_merge($this->_params[1], $currentEventParams);
public function testGetPaymentProcessorId() {
$params = $this->_params[0];
$params['payment_processor_id'] = 1;
- $params['sequential'] =1;
+ $params['sequential'] = 1;
$result = $this->callAPISuccess('event', 'create', $params);
- $this->assertEquals( 1,$result['values'][0]['payment_processor'][0], "handing of payment processor compatibility");
+ $this->assertEquals( 1, $result['values'][0]['payment_processor'][0], "handing of payment processor compatibility");
$result = $this->callAPISuccess('event', 'get', $params);
- $this->assertEquals($result['values'][0]['payment_processor_id'], 1,"handing get payment processor compatibility");
+ $this->assertEquals($result['values'][0]['payment_processor_id'], 1, "handing get payment processor compatibility");
}
public function testInvalidData() {
$params = $this->_params[0];
- $params['sequential'] =1;
- $params['loc_block_id'] =100;
+ $params['sequential'] = 1;
+ $params['loc_block_id'] = 100;
$result = $this->callAPIFailure('event', 'create', $params);
}
public function testGetSingleReturnIsFull() {
$contactID = $this->individualCreate();
$params = array(
- 'id' => $this->_eventIds[0], 'max_participants' => 1,
+ 'id' => $this->_eventIds[0],
+ 'max_participants' => 1,
);
$result = $this->callAPISuccess('Event', 'Create', $params);
$getEventParams = array(
- 'id' => $this->_eventIds[0], 'return.is_full' => 1,
+ 'id' => $this->_eventIds[0],
+ 'return.is_full' => 1,
);
$currentEvent = $this->callAPISuccess('Event', 'getsingle', $getEventParams);
$result = $this->callAPISuccess('event', 'create', $this->_params[1]);
$params = array(
- 'id' => $result['id'], 'max_participants' => 150,
+ 'id' => $result['id'],
+ 'max_participants' => 150,
);
$this->callAPISuccess('Event', 'Create', $params);
$updated = $this->callAPISuccess('Event', 'Get', $params, __FUNCTION__, __FILE__);
*/
public function testDeleteWithEventId() {
$params = array(
- 'event_id' => $this->_eventIds[0], );
+ 'event_id' => $this->_eventIds[0], );
$result = $this->callAPISuccess('Event', 'Delete', $params);
$this->assertAPISuccess($result, 'in line ' . __LINE__);
}
'event_type_id' => 1,
'return.title' => 1,
'return.id' => 1,
- 'return.start_date' => 1, );
+ 'return.start_date' => 1, );
$result = $this->callAPISuccess('event', 'get', $params);
$this->assertEquals($result['values'][$this->_eventIds[0]]['id'], $this->_eventIds[0], 'In line ' . __LINE__);
$maxEvents = 5;
$events = array();
while ($maxEvents > 0) {
- $params = array( 'title' => 'Test Event' . $maxEvents,
+ $params = array(
+ 'title' => 'Test Event' . $maxEvents,
'event_type_id' => 2,
'start_date' => 20081021,
);
$events[$maxEvents] = $this->callAPISuccess('event', 'create', $params);
$maxEvents--;
}
- $params = array( 'event_type_id' => 2,
+ $params = array(
+ 'event_type_id' => 2,
'return.id' => 1,
'return.title' => 1,
'return.offset' => 2,
public function testEventCreationPermissions() {
$params = array(
- 'event_type_id' => 1, 'start_date' => '2010-10-03', 'title' => 'le cake is a tie', 'check_permissions' => TRUE, );
+ 'event_type_id' => 1,
+ 'start_date' => '2010-10-03',
+ 'title' => 'le cake is a tie',
+ 'check_permissions' => TRUE, );
$config = &CRM_Core_Config::singleton();
$config->userPermissionClass->permissions = array('access CiviCRM');
$result = $this->callAPIFailure('event', 'create', $params);
/**
* Test APIv3 civicrm_grant* functions
*
- * @package CiviCRM_APIv3
- * @subpackage API_Grant
+ * @package CiviCRM_APIv3
+ * @subpackage API_Grant
*/
class api_v3_GrantTest extends CiviUnitTestCase {
$result = $this->callAPISuccess($this->_entity, 'create', $this->params);
$result = $this->callAPIAndDocument($this->_entity, 'delete', array('id' => $result['id']), __FUNCTION__, __FILE__);
$this->assertAPISuccess($result, 'In line ' . __LINE__);
- $checkDeleted = $this->callAPISuccess($this->_entity, 'get', array(
- ));
+ $checkDeleted = $this->callAPISuccess($this->_entity, 'get', array());
$this->assertEquals(0, $checkDeleted['count'], 'In line ' . __LINE__);
}
/*
- * This is a test to check if setting fields one at a time alters other fields
- * Issues Hit so far =
- * 1) Currency keeps getting reset to USD - BUT this may be the only enabled currency
- * - in which case it is valid
- * 2)
- */
+ * This is a test to check if setting fields one at a time alters other fields
+ * Issues Hit so far =
+ * 1) Currency keeps getting reset to USD - BUT this may be the only enabled currency
+ * - in which case it is valid
+ * 2)
+ */
public function testCreateAutoGrant() {
$entityName = $this->_entity;
$this->_groupId2 = $this->groupCreate($group);
$this->_group = array(
- $this->_groupId1 => array('title' => 'New Test Group Created',
+ $this->_groupId1 => array(
+ 'title' => 'New Test Group Created',
'visibility' => 'Public Pages',
'in_method' => 'API',
),
public function testCreateWithoutGroupIdParams() {
$params = array(
- 'contact_id' => $this->_contactId, );
+ 'contact_id' => $this->_contactId, );
$groups = $this->callAPIFailure('group_contact', 'create', $params);
$this->assertEquals($groups['error_message'], 'Mandatory key(s) missing from params array: group_id');
public function testCreateWithoutContactIdParams() {
$params = array(
- 'group_id' => $this->_groupId1, );
+ 'group_id' => $this->_groupId1, );
$groups = $this->callAPIFailure('group_contact', 'create', $params);
$this->assertEquals($groups['error_message'], 'Mandatory key(s) missing from params array: contact_id');
}
'prefix_id' => 3,
'suffix_id' => 3,
'email' => 'amiteshwar.prasad@civicrm.org',
- 'contact_type' => 'Individual', );
+ 'contact_type' => 'Individual', );
$this->_contactId1 = $this->individualCreate($cont);
$params = array(
/**
* Test class for GroupNesting API - civicrm_group_nesting_*
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class api_v3_GroupNestingTest extends CiviUnitTestCase {
protected $_apiversion;
$result = $this->callAPIAndDocument('group_nesting', 'get', $params, __FUNCTION__, __FILE__);
// expected data loaded in setUp
$expected = array(
- 1 => array('id' => 1,
+ 1 => array(
+ 'id' => 1,
'child_group_id' => 2,
'parent_group_id' => 1,
));
*/
public function testGetWithChildGroupId() {
$params = array(
- 'child_group_id' => 4, );
+ 'child_group_id' => 4, );
$result = $this->callAPISuccess('group_nesting', 'get', $params);
// expected data loaded in setUp
$expected = array(
- 3 => array('id' => 3,
+ 3 => array(
+ 'id' => 3,
'child_group_id' => 4,
'parent_group_id' => 1,
),
*/
public function testGetWithParentGroupId() {
$params = array(
- 'parent_group_id' => 1, );
+ 'parent_group_id' => 1, );
$result = $this->callAPISuccess('group_nesting', 'get', $params);
// expected data loaded in setUp
$expected = array(
- 1 => array('id' => 1,
+ 1 => array(
+ 'id' => 1,
'child_group_id' => 2,
'parent_group_id' => 1,
),
// groups id=1 and id=2 loaded in setUp
$getparams = array(
'parent_group_id' => 1,
- 'child_group_id' => 2, );
+ 'child_group_id' => 2, );
$result = $this->callAPISuccess('group_nesting', 'get', $getparams);
$params = array('id' => $result['id']);
/**
* Test class for GroupOrganization API - civicrm_group_organization_*
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class api_v3_GroupOrganizationTest extends CiviUnitTestCase {
protected $_apiversion;
$params = array(
'organization_id' => $this->_orgID,
- 'group_id' => $this->_groupID, );
+ 'group_id' => $this->_groupID, );
$result = $this->callAPISuccess('group_organization', 'create', $params);
$paramsGet = array(
'organization_id' => $result['id'],
* Test civicrm_group_organization_get with empty params.
*/
public function testGroupOrganizationGetWithEmptyParams() {
- $params = array( );
+ $params = array();
$result = $this->callAPISuccess('group_organization', 'get', $params);
$this->assertAPISuccess($result);
*/
public function testGroupOrganizationGetWithInvalidKeys() {
$params = array(
- 'invalid_key' => 1, );
+ 'invalid_key' => 1, );
$result = $this->callAPISuccess('group_organization', 'get', $params);
$this->assertAPISuccess($result);
public function testGroupOrganizationCreate() {
$params = array(
'organization_id' => $this->_orgID,
- 'group_id' => $this->_groupID, );
+ 'group_id' => $this->_groupID, );
$result = $this->callAPIAndDocument('group_organization', 'create', $params, __FUNCTION__, __FILE__);
}
public function testGroupOrganizationCreateTwice() {
$params = array(
'organization_id' => $this->_orgID,
- 'group_id' => $this->_groupID, );
+ 'group_id' => $this->_groupID, );
$result = $this->callAPISuccess('group_organization', 'create', $params);
$result2 = $this->callAPISuccess('group_organization', 'create', $params);
$this->assertEquals($result['values'], $result2['values']);
* Check with empty params array
*/
public function testGroupOrganizationCreateWithEmptyParams() {
- $params = array( );
+ $params = array();
$result = $this->callAPIFailure('group_organization', 'create', $params);
$this->assertEquals($result['error_message'], 'Mandatory key(s) missing from params array: group_id, organization_id');
}
*/
public function testGroupOrganizationCreateWithInvalidKeys() {
$params = array(
- 'invalid_key' => 1, );
+ 'invalid_key' => 1, );
$result = $this->callAPIFailure('group_organization', 'create', $params);
$this->assertEquals($result['error_message'], 'Mandatory key(s) missing from params array: group_id, organization_id');
}
* Test civicrm_group_organization_remove with empty params.
*/
public function testGroupOrganizationDeleteWithEmptyParams() {
- $params = array( );
+ $params = array();
$result = $this->callAPIFailure('group_organization', 'delete', $params);
$this->assertEquals($result['error_message'], 'Mandatory key(s) missing from params array: id');
}
public function testGroupOrganizationDelete() {
$paramsC = array(
'organization_id' => $this->_orgID,
- 'group_id' => $this->_groupID, );
+ 'group_id' => $this->_groupID, );
$result = $this->callAPISuccess('group_organization', 'create', $paramsC);
$params = array(
*/
public function testGroupOrganizationDeleteWithInvalidKey() {
$paramsDelete = array(
- 'invalid_key' => 1, );
+ 'invalid_key' => 1, );
$result = $this->callAPIFailure('group_organization', 'delete', $paramsDelete);
$this->assertEquals($result['error_message'], 'Mandatory key(s) missing from params array: id');
}
/**
* Test class for Group API - civicrm_group_*
*
- * @package CiviCRM_APIv3
+ * @package CiviCRM_APIv3
*/
class api_v3_GroupTest extends CiviUnitTestCase {
/**
* Test APIv3 civicrm_im_* functions
*
- * @package CiviCRM_APIv3
- * @subpackage API_Contact
+ * @package CiviCRM_APIv3
+ * @subpackage API_Contact
*/
class api_v3_ImTest extends CiviUnitTestCase {
'created_id' => 1,
'groups' => array('include' => array($this->_groupID)),
);
- $this->_mut = new CiviMailUtils( $this, true );
+ $this->_mut = new CiviMailUtils( $this, TRUE );
$this->callAPISuccess('mail_settings', 'get', array('api.mail_settings.create' => array('domain' => 'chaos.org')));
}
*/
public function tearDown() {
$this->_mut->stop();
-// $this->quickCleanup(array('civicrm_mailing', 'civicrm_mailing_job', 'civicrm_contact'));
+ // $this->quickCleanup(array('civicrm_mailing', 'civicrm_mailing_job', 'civicrm_contact'));
CRM_Utils_Hook::singleton()->reset();
CRM_Mailing_BAO_MailingJob::$mailsProcessed = 0; // DGW
parent::tearDown();
*/
public function testCreateWithoutName() {
$params = array(
- 'is_active' => 1, );
+ 'is_active' => 1, );
$result = $this->callAPIFailure('job', 'create', $params,
'Mandatory key(s) missing from params array: run_frequency, name, api_entity, api_action'
);
*/
public function testDeleteWithIncorrectData() {
$params = array(
- 'id' => 'abcd', );
+ 'id' => 'abcd', );
$result = $this->callAPIFailure('job', 'delete', $params);
}
*/
public function testDelete() {
$createResult = $this->callAPISuccess('job', 'create', $this->_params);
- $params = array('id' => $createResult['id'],);
+ $params = array('id' => $createResult['id']);
$result = $this->callAPIAndDocument('job', 'delete', $params, __FUNCTION__, __FILE__);
$this->assertAPIDeleted($this->_entity, $createResult['id']);
}
/**
public function testCallUpdateGreetingMissingParams() {
- $result = $this->callAPISuccess($this->_entity, 'update_greeting', array('gt' => 1));
- $this->assertEquals('Mandatory key(s) missing from params array: ct', $result['error_message']);
+ $result = $this->callAPISuccess($this->_entity, 'update_greeting', array('gt' => 1));
+ $this->assertEquals('Mandatory key(s) missing from params array: ct', $result['error_message']);
}
public function testCallUpdateGreetingIncorrectParams() {
- $result = $this->callAPISuccess($this->_entity, 'update_greeting', array('gt' => 1, 'ct' => 'djkfhdskjfhds'));
- $this->assertEquals('ct `djkfhdskjfhds` is not valid.', $result['error_message']);
+ $result = $this->callAPISuccess($this->_entity, 'update_greeting', array('gt' => 1, 'ct' => 'djkfhdskjfhds'));
+ $this->assertEquals('ct `djkfhdskjfhds` is not valid.', $result['error_message']);
}
-/*
- * Note that this test is about tesing the metadata / calling of the function & doesn't test the success of the called function
- */
+ /*
+ * Note that this test is about tesing the metadata / calling of the function & doesn't test the success of the called function
+ */
public function testCallUpdateGreetingSuccess() {
$result = $this->callAPISuccess($this->_entity, 'update_greeting', array('gt' => 'postal_greeting', 'ct' => 'Individual'));
- }
+ }
public function testCallUpdateGreetingCommaSeparatedParamsSuccess() {
$gt = 'postal_greeting,email_greeting,addressee';
* @param int $id
* @param array $params
*/
- public function hookPreRelationship($op, $objectName, $id, &$params ) {
+ public function hookPreRelationship($op, $objectName, $id, &$params) {
if($op == 'delete') {
return;
}
protected $id = 0;
protected $contactIds = array();
protected $_entity = 'line_item';
- protected $contribution_result = null;
+ protected $contribution_result = NULL;
public $DBResetRequired = TRUE;
protected $_financialTypeId = 1;
'source' => 'SSF',
'contribution_status_id' => 1,
);
- $contribution = $this->callAPISuccess('contribution','create', $contributionParams);
+ $contribution = $this->callAPISuccess('contribution', 'create', $contributionParams);
$this->params = array(
'price_field_value_id' => 1,
'price_field_id' => 1,
}
public function testGetFieldsLineItem() {
- $result = $this->callAPISuccess($this->_entity, 'getfields', array('action' => 'create',));
+ $result = $this->callAPISuccess($this->_entity, 'getfields', array('action' => 'create'));
$this->assertEquals(1, $result['values']['entity_id']['api.required']);
}
$this->assertNotNull($result['phone_id'], 'In line ' . __LINE__);
$this->assertNotNull($result['phone_2_id'], 'In line ' . __LINE__);
$this->assertNotNull($result['address_id'], 'In line ' . __LINE__);
- $this->assertEquals($params['email']['email'], $result['email']['email'], 'In line ' . __LINE__);
- $this->assertEquals($params['phone_2']['phone'], $result['phone_2']['phone'], 'In line ' . __LINE__);
- $this->assertEquals($params['address']['street_address'], $result['address']['street_address'], 'In line ' . __LINE__);
+ $this->assertEquals($params['email']['email'], $result['email']['email'], 'In line ' . __LINE__);
+ $this->assertEquals($params['phone_2']['phone'], $result['phone_2']['phone'], 'In line ' . __LINE__);
+ $this->assertEquals($params['address']['street_address'], $result['address']['street_address'], 'In line ' . __LINE__);
// Delete block
$result = $this->callAPISuccess($this->_entity, 'delete', array('id' => $id));
}
* but don't copy it only any other classes
*/
public function testMailingNullParams() {
- $result = $this->callAPIFailure('MailingContact', 'get', null);
+ $result = $this->callAPIFailure('MailingContact', 'get', NULL);
}
public function testMailingContactGetFields() {
* belongs in the SyntaxConformance class
*/
public function testMailingContactInvalidContactID() {
- $params = array('contact_id' => 'This is not a number',);
+ $params = array('contact_id' => 'This is not a number');
$result = $this->callAPIFailure('MailingContact', 'get', $params);
}
/**
* Test that the API returns only the "Bounced" mailings when instructed to do so
*/
- public function testMailingContactBounced( ) {
+ public function testMailingContactBounced() {
$op = new PHPUnit_Extensions_Database_Operation_Insert();
//Create the User
$op->execute($this->_dbconn,
/**
* Test APIv3 civicrm_mailing_group_* functions
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class api_v3_MailingGroupTest extends CiviUnitTestCase {
protected $_groupID;
/**
* Test APIv3 civicrm_mailing_* functions
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class api_v3_MailingTest extends CiviUnitTestCase {
protected $_groupID;
public function testMailerPreview() {
// BEGIN SAMPLE DATA
- $contactID = $this->individualCreate();
+ $contactID = $this->individualCreate();
$displayName = $this->callAPISuccess('contact', 'get', array('id' => $contactID));
$displayName = $displayName['values'][$contactID]['display_name'];
$this->assertTrue(!empty($displayName));
$params['options']['force_rollback'] = 1;
// END SAMPLE DATA
- $maxIDs = array(
+ $maxIDs = array(
'mailing' => CRM_Core_DAO::singleValueQuery('SELECT MAX(id) FROM civicrm_mailing'),
'job' => CRM_Core_DAO::singleValueQuery('SELECT MAX(id) FROM civicrm_mailing_job'),
'group' => CRM_Core_DAO::singleValueQuery('SELECT MAX(id) FROM civicrm_mailing_group'),
);
// END SAMPLE DATA
- $maxIDs = array(
+ $maxIDs = array(
'mailing' => CRM_Core_DAO::singleValueQuery('SELECT MAX(id) FROM civicrm_mailing'),
'job' => CRM_Core_DAO::singleValueQuery('SELECT MAX(id) FROM civicrm_mailing_job'),
'group' => CRM_Core_DAO::singleValueQuery('SELECT MAX(id) FROM civicrm_mailing_group'),
$preview = $create['values'][$create['id']]['api.MailingRecipients.get'];
$previewIds = array_values(CRM_Utils_Array::collect('contact_id', $preview['values']));
- $this->assertEquals(array((string)$contactIDs['includeme']), $previewIds);
+ $this->assertEquals(array((string) $contactIDs['includeme']), $previewIds);
$previewEmails = array_values(CRM_Utils_Array::collect('api.email.getvalue', $preview['values']));
$this->assertEquals(array('include.me@example.org'), $previewEmails);
$previewNames = array_values(CRM_Utils_Array::collect('api.contact.getvalue', $preview['values']));
- $this->assertTrue((bool)preg_match('/Includer Person/', $previewNames[0]), "Name 'Includer Person' should appear in '" . $previewNames[0] . '"');
+ $this->assertTrue((bool) preg_match('/Includer Person/', $previewNames[0]), "Name 'Includer Person' should appear in '" . $previewNames[0] . '"');
}
public function testMailerSendTest_email() {
return $createResult['id'];
}
-//----------- civicrm_mailing_create ----------
+ //----------- civicrm_mailing_create ----------
}
/**
* Test APIv3 civicrm_membership_payment* functions
*
- * @package CiviCRM_APIv3
- * @subpackage API_Member
+ * @package CiviCRM_APIv3
+ * @subpackage API_Member
*/
class api_v3_MembershipPaymentTest extends CiviUnitTestCase {
'thankyou_date' => '20080522',
);
- $this->_contribution = $this->callAPISuccess('contribution','create', $params);
+ $this->_contribution = $this->callAPISuccess('contribution', 'create', $params);
}
///////////////// civicrm_membership_payment_create methods
protected $_membershipTypeID;
protected $_membershipStatusID;
- protected $_apiversion =3;
+ protected $_apiversion = 3;
public function setUp() {
parent::setUp();
public function testUpdate() {
$params = array(
- 'name' => 'test membership status', );
+ 'name' => 'test membership status', );
$result = $this->callAPISuccess('membership_status', 'create', $params);
$id = $result['id'];
$result = $this->callAPISuccess('membership_status', 'get', $params);
$this->assertEquals('test membership status', $result['values'][$id]['name']);
$newParams = array(
'id' => $id,
- 'name' => 'renamed', );
+ 'name' => 'renamed', );
$result = $this->callAPISuccess('membership_status', 'create', $newParams);
$result = $this->callAPISuccess('membership_status', 'get', array('id' => $id));
$this->assertEquals('renamed', $result['values'][$id]['name']);
/**
* Test APIv3 civicrm_membership functions
*
- * @package CiviCRM_APIv3
- * @subpackage API_Member
+ * @package CiviCRM_APIv3
+ * @subpackage API_Member
*/
$this->_apiversion = 3;
$this->_contactID = $this->individualCreate();
$this->_membershipTypeID = $this->membershipTypeCreate(array('member_of_contact_id' => $this->_contactID));
- $this->_membershipTypeID2 = $this->membershipTypeCreate(array('period_type' => 'fixed','fixed_period_start_day' => '301', 'fixed_period_rollover_day' => '1111'));
+ $this->_membershipTypeID2 = $this->membershipTypeCreate(array('period_type' => 'fixed', 'fixed_period_start_day' => '301', 'fixed_period_rollover_day' => '1111'));
$this->_membershipStatusID = $this->membershipStatusCreate('test status');
CRM_Member_PseudoConstant::membershipType(NULL, TRUE);
$this->_membershipID = $this->contactMembershipCreate($this->_params);
$params = array();
$this->callAPISuccess('membership', 'get', $params);
- $this->callAPISuccess('Membership', 'Delete', array('id' => $this->_membershipID,));
+ $this->callAPISuccess('Membership', 'Delete', array('id' => $this->_membershipID));
}
/**
$this->assertEquals($membership['values'][$this->_membershipID]['status_id'], $this->_membershipStatusID);
$this->assertEquals($membership['values'][$this->_membershipID]['contact_id'], $this->_contactID);
-
- $this->callAPISuccess('Membership', 'Delete', array('id' => $this->_membershipID,));
+ $this->callAPISuccess('Membership', 'Delete', array('id' => $this->_membershipID));
}
/**
public function testMembershipGetWithReturn() {
$this->contactMembershipCreate($this->_params);
$result = $this->callAPISuccess('membership', 'get', array('return' => 'end_date'));
- foreach ($result['values'] as $membership) {
+ foreach ($result['values'] as $membership) {
$this->assertEquals(array('id', 'end_date'), array_keys($membership));
}
}
'id' => $membershipID,
'source' => 'changed',
'contact_id' => $this->_contactID,
- 'status_id' => $this->_membershipStatusID, 'membership_type_id' => $this->_membershipTypeID,
+ 'status_id' => $this->_membershipStatusID,
+ 'membership_type_id' => $this->_membershipTypeID,
'skipStatusCal' => 1,
);
$result = $this->callAPISuccess('membership', 'create', $params);
if ($objectName == 'Membership' && $op == 'edit') {
$existingMembership = $this->callAPISuccessGetSingle('membership', array('id' => $params['id']));
unset($params['id'], $params['membership_id']);
- $params['join_date'] = $params['membership_start_date'] = $params['start_date']= date('Ymd000000', strtotime($existingMembership['start_date']));
+ $params['join_date'] = $params['membership_start_date'] = $params['start_date'] = date('Ymd000000', strtotime($existingMembership['start_date']));
$params = array_merge($existingMembership, $params);
$params['id'] = NULL;
}
'end_date' => '2008-12-21',
'source' => 'Payment',
'is_override' => 1,
- 'status_id' => $this->_membershipStatusID, );
+ 'status_id' => $this->_membershipStatusID, );
$this->callAPIFailure('membership', 'create', $params);
/**
* Test that if datesdate are not set they not over-ridden if id is passed in
*/
- public function testMembershipDatesNotOverridden() {
+ public function testMembershipDatesNotOverridden() {
$result = $this->callAPISuccess($this->_entity, 'create', $this->_params);
unset($this->_params['end_date'], $this->_params['start_date']);
$this->_params['id'] = $result['id'];
$this->assertEquals('2009-01-21', $result['start_date']);
$this->assertEquals('2009-12-21', $result['end_date']);
- }
+ }
}
'duration_unit' => 'month',
'duration_interval' => '10',
'period_type' => 'rolling',
- 'visibility' => 'public', );
+ 'visibility' => 'public', );
$membershiptype = $this->callAPIFailure('membership_type', 'create', $params);
$this->assertEquals($membershiptype['error_message'],
'Mandatory key(s) missing from params array: financial_type_id'
'domain_id' => '1',
'minimum_fee' => '200',
'duration_interval' => '10',
- 'visibility' => 'public', );
+ 'visibility' => 'public', );
$membershiptype = $this->callAPIFailure('membership_type', 'create', $params);
$this->assertEquals($membershiptype['error_message'],
'minimum_fee' => '200',
'duration_unit' => 'month',
'period_type' => 'rolling',
- 'visibility' => 'public', );
+ 'visibility' => 'public', );
$membershiptype = $this->callAPIFailure('membership_type', 'create', $params);
$this->assertEquals($membershiptype['error_message'],
'Mandatory key(s) missing from params array: financial_type_id, duration_interval'
'minimum_fee' => '200',
'duration_interval' => '10',
'period_type' => 'rolling',
- 'visibility' => 'public', );
+ 'visibility' => 'public', );
$membershiptype = $this->callAPIFailure('membership_type', 'create', $params);
$this->assertEquals($membershiptype['error_message'],
'duration_unit' => 'month',
'duration_interval' => '10',
'period_type' => 'rolling',
- 'visibility' => 'public', );
+ 'visibility' => 'public', );
$membershiptype = $this->callAPIFailure('membership_type', 'create', $params);
$this->assertEquals($membershiptype['error_message'], 'Mandatory key(s) missing from params array: name');
'duration_unit' => 'month',
'duration_interval' => '10',
'period_type' => 'rolling',
- 'visibility' => 'public', );
+ 'visibility' => 'public', );
$membershiptype = $this->callAPIFailure('membership_type', 'create', $params);
$this->assertEquals($membershiptype['error_message'], 'Mandatory key(s) missing from params array: domain_id');
$newMembOrgParams = array(
'organization_name' => 'New membership organisation',
'contact_type' => 'Organization',
- 'visibility' => 1, );
+ 'visibility' => 1, );
// create a new contact to update this membership type to
$newMembOrgID = $this->organizationCreate($newMembOrgParams);
'duration_unit' => 'month',
'duration_interval' => '10',
'period_type' => 'fixed',
- 'domain_id' => 1, );
+ 'domain_id' => 1, );
$this->callAPISuccess('membership_type', 'update', $params);
/**
* Test class for Template API - civicrm_msg_template*
*
- * @package CiviCRM_APIv3
+ * @package CiviCRM_APIv3
*/
class api_v3_MessageTemplateTest extends CiviUnitTestCase {
/**
);
}
- /**
+ /**
* Test create function succeeds
*/
public function testCreate() {
$this->assertNotNull($result['values'][$result['id']]['id'], 'In line ' . __LINE__);
}
-/**
- * Check the delete function succeeds
- */
+ /**
+ * Check the delete function succeeds
+ */
public function testDelete() {
$entity = $this->createTestEntity();
$result = $this->callAPIAndDocument('MessageTemplate', 'delete', array('id' => $entity['id']), __FUNCTION__, __FILE__);
'note' => 'Hello!!! m testing Note',
'contact_id' => $this->_contactID,
'modified_date' => '2011-01-31',
- 'subject' => 'Test Note', );
+ 'subject' => 'Test Note', );
$this->_note = $this->noteCreate($this->_contactID);
$this->_noteID = $this->_note['id'];
}
$this->assertArrayHasKey('id', $result);
$note = array(
- 'id' => $result['id'], );
+ 'id' => $result['id'], );
$this->noteDelete($note);
}
'contact_id' => $this->_contactID,
'modified_date' => '2011-01-31',
'subject' => "With a '",
- 'sequential' => 1, );
+ 'sequential' => 1, );
$result = $this->callAPISuccess('Note', 'Create', $params);
$this->assertAPISuccess($result, 'in line ' . __LINE__);
$this->assertEquals($result['values'][0]['note'], "Hello!!! ' testing Note", 'in line ' . __LINE__);
//CleanUP
$note = array(
- 'id' => $result['id'], );
+ 'id' => $result['id'], );
$this->noteDelete($note);
}
$this->assertAPISuccess($apiResult);
$this->assertEquals(date('Y-m-d'), date('Y-m-d', strtotime($apiResult['values'][$apiResult['id']]['modified_date'])));
$this->noteDelete(array(
- 'id' => $apiResult['id'], ));
+ 'id' => $apiResult['id'], ));
}
public function testUpdateWithoutContactId() {
$params = array(
'entity_id' => $this->_contactID,
- 'entity_table' => 'civicrm_contact', );
+ 'entity_table' => 'civicrm_contact', );
$note = $this->callAPIFailure('note', 'create', $params,
'Mandatory key(s) missing from params array: note'
);
'id' => $this->_noteID,
'contact_id' => $this->_contactID,
'note' => 'Note1',
- 'subject' => 'Hello World', );
+ 'subject' => 'Hello World', );
//Update Note
$this->callAPISuccess('note', 'create', $params);
$params = array(
'id' => 0,
);
- $deleteNote = $this->callAPIFailure('note', 'delete', $params
- , 'Mandatory key(s) missing from params array: id');
+ $deleteNote = $this->callAPIFailure('note', 'delete', $params, 'Mandatory key(s) missing from params array: id');
}
/**
*/
public function testGetOptionCreateFailOnDuplicate() {
- $params = array( 'sequential' => 1,
+ $params = array(
+ 'sequential' => 1,
'name' => 'civicrm_dup entry',
'is_reserved' => 1,
'is_active' => 1,
'options' => array('limit' => 5000),
)
);
- $params = array( 'sequential' => 1,
+ $params = array(
+ 'sequential' => 1,
'name' => 'civicrm_rolback_test',
'is_reserved' => 1,
'is_active' => 1,
$result = $this->callAPISuccess('option_value', 'get', array(
'option_group_id' => 1,
- 'value' => '1', ));
+ 'value' => '1', ));
$result2 = $this->callAPISuccess('option_value', 'get', array(
'option_group_id' => 1,
'value' => '1',
$description = "demonstrates use of Sort param (available in many api functions). Also, getsingle";
$subfile = 'SortOption';
$result = $this->callAPISuccess('option_value', 'getsingle', array(
- 'option_group_id' => 1, 'options' => array(
+ 'option_group_id' => 1,
+ 'options' => array(
'sort' => 'label ASC',
'limit' => 1,
),
));
$params = array(
- 'option_group_id' => 1, 'options' => array(
+ 'option_group_id' => 1,
+ 'options' => array(
'sort' => 'label DESC',
'limit' => 1,
),
*/
public function testGetValueOptionPagination() {
$pageSize = 10;
- $page1 = $this->callAPISuccess('option_value', 'get', array('options' => array('limit' => $pageSize), ));
+ $page1 = $this->callAPISuccess('option_value', 'get', array('options' => array('limit' => $pageSize) ));
$page2 = $this->callAPISuccess('option_value', 'get', array(
- 'options' => array('limit' => $pageSize,
+ 'options' => array(
+ 'limit' => $pageSize,
// if you use it for pagination, option.offset=pageSize*pageNumber
'offset' => $pageSize - 1,
- ), ));
+ ), ));
$this->assertEquals($pageSize, $page1['count'], "Check only 10 retrieved in the 1st page " . __LINE__);
$this->assertEquals($pageSize, $page2['count'], "Check only 10 retrieved in the 2nd page " . __LINE__);
public function testCreateOptionSpecifyComponentID() {
$result = $this->callAPISuccess('option_group', 'get', array(
'name' => 'from_email_address',
- 'sequential' => 1, 'api.option_value.create' => array('component_id' => 2, 'name' => 'my@y.com'),
+ 'sequential' => 1,
+ 'api.option_value.create' => array('component_id' => 2, 'name' => 'my@y.com'),
));
$this->assertAPISuccess($result);
$optionValueId = $result['values'][0]['api.option_value.create']['id'];
$component_id = $this->callAPISuccess('option_value', 'getvalue', array(
- 'id' => $optionValueId, 'return' => 'component_id',
+ 'id' => $optionValueId,
+ 'return' => 'component_id',
));
$this->assertEquals(2, $component_id);
}
public function testCreateOptionSpecifyComponent() {
$result = $this->callAPISuccess('option_group', 'get', array(
'name' => 'from_email_address',
- 'sequential' => 1, 'api.option_value.create' => array(
+ 'sequential' => 1,
+ 'api.option_value.create' => array(
'component_id' => 'CiviContribute',
'name' => 'my@y.com'
),
$this->assertAPISuccess($result);
$optionValueId = $result['values'][0]['api.option_value.create']['id'];
$component_id = $this->callAPISuccess('option_value', 'getvalue', array(
- 'id' => $optionValueId, 'return' => 'component_id',
+ 'id' => $optionValueId,
+ 'return' => 'component_id',
));
$this->assertEquals(2, $component_id);
}
public function testCreateOptionSpecifyComponentString() {
$result = $this->callAPISuccess('option_group', 'get', array(
'name' => 'from_email_address',
- 'sequential' => 1, 'api.option_value.create' => array(
+ 'sequential' => 1,
+ 'api.option_value.create' => array(
'component_id' => 'CiviContribute',
'name' => 'my@y.com'),
$this->assertAPISuccess($result);
$optionValueId = $result['values'][0]['api.option_value.create']['id'];
$component_id = $this->callAPISuccess('option_value', 'getvalue', array(
- 'id' => $optionValueId, 'return' => 'component_id',
+ 'id' => $optionValueId,
+ 'return' => 'component_id',
));
$this->assertEquals(2, $component_id);
}
$optionGroup = $this->callAPISuccess(
'option_group', 'get', array(
'name' => 'gender',
- 'sequential' => 1, ));
+ 'sequential' => 1, ));
$this->assertAPISuccess($optionGroup);
$params = array(
'option_group_id' => $optionGroup['id'],
- 'label' => 'my@y.com', 'weight' => 3,
+ 'label' => 'my@y.com',
+ 'weight' => 3,
);
- $optionValue = $this->callAPISuccess('option_value', 'create', $params);
+ $optionValue = $this->callAPISuccess('option_value', 'create', $params);
$this->assertAPISuccess($optionValue);
$params['weight'] = 4;
- $optionValue2 = $this->callAPISuccess('option_value', 'create', $params );
+ $optionValue2 = $this->callAPISuccess('option_value', 'create', $params );
$this->assertAPISuccess($optionValue2);
$options = $this->callAPISuccess('option_value', 'get', array('option_group_id' => $optionGroup['id']));
$this->assertNotEquals($options['values'][$optionValue['id']]['value'], $options['values'][$optionValue2['id']]['value']);
- //cleanup
+ //cleanup
$this->callAPISuccess('option_value', 'delete', array('id' => $optionValue['id']));
$this->callAPISuccess('option_value', 'delete', array('id' => $optionValue2['id']));
}
public function testCreateOptionNoName() {
$optionGroup = $this->callAPISuccess('option_group', 'get', array(
'name' => 'gender',
- 'sequential' => 1, ));
+ 'sequential' => 1, ));
$params = array('option_group_id' => $optionGroup['id'], 'label' => 'my@y.com');
- $optionValue = $this->callAPISuccess('option_value', 'create', $params);
+ $optionValue = $this->callAPISuccess('option_value', 'create', $params);
$this->assertAPISuccess($optionValue);
$this->getAndCheck($params, $optionValue['id'], 'option_value');
}
* and deleted
*/
public function testCRM11876CreateOptionPseudoConstantUpdated() {
- $optionGroupID = $this->callAPISuccess('option_group', 'getvalue', array( 'name' => 'payment_instrument',
+ $optionGroupID = $this->callAPISuccess('option_group', 'getvalue', array(
+ 'name' => 'payment_instrument',
'return' => 'id',
));
$newOption = (string) time();
array('option_group_id' => $og['id'], 'label' => 'test option value')
);
// update option value without 'option_group_id'
- $res = $this->callAPISuccess('option_value', 'create', array('id' => $ov['id'], 'is_active' => 0));
+ $res = $this->callAPISuccess('option_value', 'create', array('id' => $ov['id'], 'is_active' => 0));
$val = $this->callAPISuccess('option_value', 'getvalue', array(
- 'id' => $ov['id'], 'return' => 'is_active',
+ 'id' => $ov['id'],
+ 'return' => 'is_active',
));
$this->assertEquals($val, 0, "update with no group id is not proper" . __LINE__);
}
// update option value without 'option_group_id'
$this->callAPISuccess('option_value', 'create', array('id' => $ov['id'], 'option_group_id' => $og['id'], 'is_active' => 0));
$val = $this->callAPISuccess('option_value', 'getvalue', array(
- 'id' => $ov['id'], 'return' => 'is_active',
+ 'id' => $ov['id'],
+ 'return' => 'is_active',
));
$this->assertEquals($val, 0, "update with group id is not proper " . __LINE__);
}
/**
* Test APIv3 civicrm_participant_* functions
*
- * @package CiviCRM_APIv3
- * @subpackage API_Event
+ * @package CiviCRM_APIv3
+ * @subpackage API_Event
*/
class api_v3_ParticipantPaymentTest extends CiviUnitTestCase {
public function testPaymentCreateMissingContributionId() {
//Without Payment EntityID
$params = array(
- 'participant_id' => $this->_participantID, );
+ 'participant_id' => $this->_participantID, );
$participantPayment = $this->callAPIFailure('participant_payment', 'create', $params);
}
public function testPaymentUpdateMissingParticipantId() {
//WithoutParticipantId
$params = array(
- 'contribution_id' => '3', );
+ 'contribution_id' => '3', );
$participantPayment = $this->callAPIFailure('participant_payment', 'create', $params);
}
*/
public function testPaymentUpdateMissingContributionId() {
$params = array(
- 'participant_id' => $this->_participantID, );
+ 'participant_id' => $this->_participantID, );
$participantPayment = $this->callAPIFailure('participant_payment', 'create', $params);
}
$params = array(
'id' => $this->_participantPaymentID,
'participant_id' => $this->_participantID,
- 'contribution_id' => $contributionID, );
+ 'contribution_id' => $contributionID, );
// Update Payment
$participantPayment = $this->callAPISuccess('participant_payment', 'create', $params);
$params = array(
'id' => $this->_participantPaymentID,
'participant_id' => $this->_participantID,
- 'contribution_id' => $contributionID, );
+ 'contribution_id' => $contributionID, );
// Update Payment
$participantPayment = $this->callAPISuccess('participant_payment', 'create', $params);
$params = array(
'id' => $this->_participantPaymentID,
'participant_id' => $this->_participantID,
- 'contribution_id' => $contributionID, );
+ 'contribution_id' => $contributionID, );
// Update Payment
$participantPayment = $this->callAPISuccess('participant_payment', 'create', $params);
*/
public function testPaymentDeleteWithWrongID() {
$params = array(
- 'id' => 0, );
+ 'id' => 0, );
$deletePayment = $this->callAPIFailure('participant_payment', 'delete', $params);
$this->assertEquals($deletePayment['error_message'], 'Error while deleting participantPayment');
}
'status_id' => 1,
);
break;
+
case 'payLater':
$compareParams = array(
'to_financial_account_id' => 7,
$entity = $this->callAPISuccess('participant_status_type', 'get', array());
$result = $this->callAPIAndDocument('participant_status_type', 'delete', array('id' => $ParticipantStatusType['id']), __FUNCTION__, __FILE__);
$getCheck = $this->callAPISuccess('ParticipantStatusType', 'GET', array('id' => $ParticipantStatusType['id']));
- $checkDeleted = $this->callAPISuccess('ParticipantStatusType', 'Get', array(
- ));
+ $checkDeleted = $this->callAPISuccess('ParticipantStatusType', 'Get', array());
$this->assertEquals($entity['count'] - 1, $checkDeleted['count'], 'In line ' . __LINE__);
}
}
$this->assertEquals($result['values'][$this->_participantID]['event_id'], $this->_eventID, "in line " . __LINE__);
$this->assertEquals($result['values'][$this->_participantID]['participant_register_date'], '2007-02-19 00:00:00', "in line " . __LINE__);
$this->assertEquals($result['values'][$this->_participantID]['participant_source'], 'Wimbeldon', "in line " . __LINE__);
- $params = array(
+ $params = array(
'id' => $this->_participantID,
'return' => 'id,participant_register_date,event_id',
$event = $this->eventCreate(NULL);
$this->callAPISuccess('participant', 'create', array('event_id' => $event['id'], 'contact_id' => $this->_contactID));
-
$description = "use nested get to get an event";
$subfile = "NestedEventGet";
$params = array(
*/
public function testGetWithReturnProperties() {
$params = array(
- 'contact_id' => $this->_contactID, 'return.status_id' => 1,
+ 'contact_id' => $this->_contactID,
+ 'return.status_id' => 1,
'return.participant_status_id' => 1,
'options' => array('limit' => 1)
);
*/
public function testGetContactIdOnly() {
$params = array(
- 'contact_id' => $this->_contactID, );
+ 'contact_id' => $this->_contactID, );
$participant = $this->callAPISuccess('participant', 'get', $params);
$this->assertEquals($this->_participantID, $participant['id'],
public function testGetMultiMatchReturnFirst() {
$params = array(
'event_id' => $this->_eventID,
- 'rowCount' => 1, );
+ 'rowCount' => 1, );
$participant = $this->callAPISuccess('participant', 'get', $params);
$this->assertNotNull($participant['id']);
'role_id' => 3,
'register_date' => '2006-01-21',
'source' => 'US Open',
- 'event_level' => 'Donation', );
+ 'event_level' => 'Donation', );
$participant = $this->callAPIFailure('participant', 'create', $params);
$this->assertEquals($participant['error_message'], 'Mandatory key(s) missing from params array: event_id');
// Cleanup created participant records.
'role_id' => 3,
'register_date' => '2006-01-21',
'source' => 'US Open',
- 'event_level' => 'Donation', );
+ 'event_level' => 'Donation', );
$participant = $this->callAPIFailure('Participant', 'update', $params);
}
'role_id' => 3,
'register_date' => '2006-01-21',
'source' => 'US Open',
- 'event_level' => 'Donation', );
+ 'event_level' => 'Donation', );
$participant = $this->callAPIFailure('participant', 'create', $params);
$result = $this->participantDelete($participantId);
}
*/
public function testParticipantDelete() {
$params = array(
- 'id' => $this->_participantID, );
+ 'id' => $this->_participantID, );
$participant = $this->callAPISuccess('participant', 'delete', $params);
$this->assertAPISuccess($participant);
$this->assertDBState('CRM_Event_DAO_Participant', $this->_participantID, NULL, TRUE);
*/
public function testParticipantDeleteMissingID() {
$params = array(
- 'event_id' => $this->_eventID, );
+ 'event_id' => $this->_eventID, );
$participant = $this->callAPIFailure('participant', 'delete', $params);
$this->assertNotNull($participant['error_message']);
}
$params = array('contact_id' => $this->_contactID2, 'api.participant.delete' => 1);
$participants = $this->callAPIAndDocument('Participant', 'Get', $params, __FUNCTION__, __FILE__, $description, $subfile, 'Get');
$check = $this->callAPISuccess('participant', 'getcount', array());
- $this->assertEquals(1, $check,"only one participant should be left. line " . __LINE__);
+ $this->assertEquals(1, $check, "only one participant should be left. line " . __LINE__);
}
/**
$this->_apiversion = 3;
}
-// function tearDown() {
-//
-// $tablesToTruncate = array(
-// 'civicrm_payment_processor_type',
-// );
-// $this->quickCleanup($tablesToTruncate);
-// }
+ // function tearDown() {
+ //
+ // $tablesToTruncate = array(
+ // 'civicrm_payment_processor_type',
+ // );
+ // $this->quickCleanup($tablesToTruncate);
+ // }
///////////////// civicrm_payment_processor_type_add methods
*/
public function testPaymentProcessorTypeCreateWithoutName() {
$payProcParams = array(
- 'is_active' => 1, );
+ 'is_active' => 1, );
$result = $this->callAPIFailure('payment_processor_type', 'create', $payProcParams);
$this->assertEquals($result['error_message'],
'Mandatory key(s) missing from params array: name, title, class_name, billing_mode'
* Create payment processor type
*/
public function testPaymentProcessorTypeCreate() {
- $params = array( 'sequential' => 1,
+ $params = array(
+ 'sequential' => 1,
'name' => 'API_Test_PP',
'title' => 'API Test Payment Processor',
'class_name' => 'CRM_Core_Payment_APITest',
'title' => 'API Test Payment Processor 2',
'class_name' => 'CRM_Core_Payment_APITest 2',
'billing_mode' => 2,
- 'is_recur' => 0, );
+ 'is_recur' => 0, );
$result = $this->callAPISuccess('payment_processor_type', 'create', $params);
$this->assertNotNull($result['id']);
* Check with empty array
*/
public function testPaymentProcessorTypesGetEmptyParams() {
- $results = $this->callAPISuccess('payment_processor_type', 'get', array( ));
+ $results = $this->callAPISuccess('payment_processor_type', 'get', array());
$baselineCount = $results['count'];
$firstRelTypeParams = array(
'title' => 'API Test Payment Processor',
'class_name' => 'CRM_Core_Payment_APITest',
'billing_mode' => 1,
- 'is_recur' => 0, );
+ 'is_recur' => 0, );
$first = $this->callAPISuccess('PaymentProcessorType', 'Create', $firstRelTypeParams);
'title' => 'API Test Payment Processor 2',
'class_name' => 'CRM_Core_Payment_APITest 2',
'billing_mode' => 2,
- 'is_recur' => 0, );
+ 'is_recur' => 0, );
$second = $this->callAPISuccess('PaymentProcessorType', 'Create', $secondRelTypeParams);
- $result = $this->callAPISuccess('payment_processor_type', 'get', array( ));
+ $result = $this->callAPISuccess('payment_processor_type', 'get', array());
$this->assertEquals($baselineCount + 2, $result['count']);
$this->assertAPISuccess($result);
'title' => 'API Test Payment Processor 11',
'class_name' => 'CRM_Core_Payment_APITest_11',
'billing_mode' => 1,
- 'is_recur' => 0, );
+ 'is_recur' => 0, );
$first = $this->callAPISuccess('PaymentProcessorType', 'Create', $firstRelTypeParams);
'title' => 'API Test Payment Processor 12',
'class_name' => 'CRM_Core_Payment_APITest_12',
'billing_mode' => 2,
- 'is_recur' => 0, );
+ 'is_recur' => 0, );
$second = $this->callAPISuccess('PaymentProcessorType', 'Create', $secondRelTypeParams);
$params = array(
- 'name' => 'API_Test_PP_12', );
+ 'name' => 'API_Test_PP_12', );
$result = $this->callAPISuccess('payment_processor_type', 'get', $params);
$this->assertAPISuccess($result);
/**
* Test APIv3 civicrm_phone* functions
*
- * @package CiviCRM_APIv3
- * @subpackage API_Contact
+ * @package CiviCRM_APIv3
+ * @subpackage API_Contact
*/
class api_v3_PhoneTest extends CiviUnitTestCase {
protected $_apiversion;
//create one
$create = $this->callAPISuccess('phone', 'create', $this->_params);
- $result = $this->callAPIAndDocument('phone', 'delete', array('id' => $create['id'],), __FUNCTION__, __FILE__);
+ $result = $this->callAPIAndDocument('phone', 'delete', array('id' => $create['id']), __FUNCTION__, __FILE__);
$this->assertEquals(1, $result['count'], 'In line ' . __LINE__);
$get = $this->callAPISuccess('phone', 'get', array(
'id' => $create['id'],
public function testGet() {
$phone = $this->callAPISuccess('phone', 'create', $this->_params);
$params = array(
- 'contact_id' => $this->_params['contact_id'],
+ 'contact_id' => $this->_params['contact_id'],
'phone' => $phone['values'][$phone['id']]['phone'],
);
$result = $this->callAPIAndDocument('Phone', 'Get', $params, __FUNCTION__, __FILE__);
/**
* Test class for Pledge API - civicrm_pledge_*
*
- * @package CiviCRM_APIv3
+ * @package CiviCRM_APIv3
*/
class api_v3_PledgePaymentTest extends CiviUnitTestCase {
$contribution = $this->callAPISuccess('contribution', 'create', $contributionParams);
$params['contribution_id'] = $contribution['id'];
-
$resultCont2 = $this->callAPISuccess('pledge_payment', 'create', $params);
//make sure original is untouched & has not been updated
$this->assertGreaterThan($result['id'], $resultCont2['id'], " in line " . __LINE__);
);
$result = $this->callAPIAndDocument('pledge_payment', 'update', $updateparams, __FUNCTION__, __FILE__);
- $this->getAndCheck(array_merge($params,$updateparams), $result['id'], $this->_entity);
+ $this->getAndCheck(array_merge($params, $updateparams), $result['id'], $this->_entity);
}
public function testDeletePledgePayment() {
/**
* Test class for Pledge API - civicrm_pledge_*
*
- * @package CiviCRM_APIv3
+ * @package CiviCRM_APIv3
*/
class api_v3_PledgeTest extends CiviUnitTestCase {
protected $_params;
protected $_entity;
protected $scheduled_date;
- public $DBResetRequired = True;
+ public $DBResetRequired = TRUE;
public function setUp() {
$this->_apiversion = 3;
$result = $this->callAPISuccess($this->_entity, 'create', $params);
$this->assertAPISuccess($result, " testCreateWithCustom ");
- $this->assertAPISuccess($result, ' in line ' . __LINE__);
+ $this->assertAPISuccess($result, ' in line ' . __LINE__);
$getparams = array('id' => $result['id'], 'return.custom_' . $ids['custom_field_id'] => 1);
$check = $this->callAPISuccess($this->_entity, 'get', $getparams);
$this->callAPISuccess('pledge', 'delete', array('id' => $check['id']));
public function testGetPledge() {
-
$this->_pledge = $this->callAPISuccess('pledge', 'create', $this->_params);
$params = array(
'pledge_id' => $this->_pledge['id'],
$this->assertEquals($pledge['pledge_next_pay_amount'], 20.00, 'in line' . __LINE__);
$params2 = array(
- 'pledge_id' => $this->_pledge['id'], );
+ 'pledge_id' => $this->_pledge['id'], );
$pledge = $this->callAPISuccess('pledge', 'delete', $params2);
}
/**
$this->_pledge = $this->callAPISuccess('pledge', 'create', $this->_params);
$params = array(
- 'pledge_id' => $this->_pledge['id'], 'return.pledge_financial_type' => 1,
+ 'pledge_id' => $this->_pledge['id'],
+ 'return.pledge_financial_type' => 1,
);
$result = $this->callAPISuccess('pledge', 'get', $params);
$pledge = $result['values'][$this->_pledge['id']];
/**
* Test 'return.pledge_contribution_type' => 1 works
* This is for legacy compatibility
- */
+ */
public function testGetPledgewithReturnLegacy() {
$this->_pledge = $this->callAPISuccess('pledge', 'create', $this->_params);
$params = array(
- 'pledge_id' => $this->_pledge['id'], 'return.pledge_financial_type' => 1,
+ 'pledge_id' => $this->_pledge['id'],
+ 'return.pledge_financial_type' => 1,
);
$result = $this->callAPISuccess('pledge', 'get', $params);
$pledge = $result['values'][$this->_pledge['id']];
'create_date' => 'first saturday of march last year',
);
$pledge2 = $this->callAPISuccess('pledge', 'create', array_merge($this->_params, $overdueParams));
- $params = array( 'pledge_is_test' => 0,
+ $params = array(
+ 'pledge_is_test' => 0,
'rowCount' => 1,
);
$result = $this->callAPISuccess('pledge', 'get', $params);
- $resultSortedAsc = $this->callAPISuccess('pledge', 'get', array( 'rowCount' => 1,
+ $resultSortedAsc = $this->callAPISuccess('pledge', 'get', array(
+ 'rowCount' => 1,
'sort' => 'start_date ASC',
));
- $resultSortedDesc = $this->callAPISuccess('pledge', 'get', array( 'rowCount' => 1,
+ $resultSortedDesc = $this->callAPISuccess('pledge', 'get', array(
+ 'rowCount' => 1,
'sort' => 'start_date DESC',
));
}
/*
- * test that using original_installment_amount rather than pledge_original_installment_amount works
- * Pledge field behaviour is a bit random & so pledge has come to try to handle both unique & non -unique fields
- */
+ * test that using original_installment_amount rather than pledge_original_installment_amount works
+ * Pledge field behaviour is a bit random & so pledge has come to try to handle both unique & non -unique fields
+ */
public function testCreatePledgeWithNonUnique() {
$params = $this->_params;
$params['original_installment_amount'] = $params['pledge_original_installment_amount'];
public function testCreateCancelPledge() {
-
$result = $this->callAPISuccess('pledge', 'create', $this->_params);
$this->assertEquals(2, $result['values'][0]['status_id'], "in line " . __LINE__);
$cancelparams = array('sequential' => 1, 'id' => $result['id'], 'pledge_status_id' => 3);
$pledgeID = $this->pledgeCreate($this->_individualId);
$old_params = array(
'id' => $pledgeID,
- 'sequential' => 1, );
+ 'sequential' => 1, );
$original = $this->callAPISuccess('pledge', 'get', $old_params);
//Make sure it came back
$this->assertEquals($original['values'][0]['pledge_id'], $pledgeID, 'In line ' . __LINE__);
$old_frequency_interval = $original['values'][0]['pledge_frequency_interval'];
$old_status_id = $original['values'][0]['pledge_status'];
-
//check against values in CiviUnitTestCase::createPledge()
$this->assertEquals($old_contact_id, $this->_individualId, 'In line ' . __LINE__);
$this->assertEquals($old_frequency_unit, 'year', 'In line ' . __LINE__);
'amount' => 100,
'financial_type_id' => 1,
'start_date' => date('Ymd'),
- 'installments' => 10, );
+ 'installments' => 10, );
$pledge = $this->callAPISuccess('pledge', 'create', $params);
$new_params = array(
$pledgeID = $this->pledgeCreate($this->_individualId);
$old_params = array(
'id' => $pledgeID,
- 'sequential' => 1, );
+ 'sequential' => 1, );
$original = $this->callAPISuccess('pledge', 'get', $old_params);
//Make sure it came back
$this->assertEquals($original['values'][0]['pledge_id'], $pledgeID, 'In line ' . __LINE__);
$old_frequency_interval = $original['values'][0]['pledge_frequency_interval'];
$old_status_id = $original['values'][0]['pledge_status'];
-
//check against values in CiviUnitTestCase::createPledge()
$this->assertEquals($old_contact_id, $this->_individualId, 'In line ' . __LINE__);
$this->assertEquals($old_frequency_unit, 'year', 'In line ' . __LINE__);
'is_reserved' => 1,
);
- $price_set = $this->callAPISuccess('price_set', 'create',$priceSetparams);
+ $price_set = $this->callAPISuccess('price_set', 'create', $priceSetparams);
$this->priceSetID = $price_set['id'];
- $this->_params = array( 'price_set_id' => $this->priceSetID,
+ $this->_params = array(
+ 'price_set_id' => $this->priceSetID,
'name' => 'grassvariety',
'label' => 'Grass Variety',
'html_type' => 'Text',
);
$this->quickCleanup($tablesToTruncate);
- $delete = $this->callAPISuccess('PriceSet','delete', array(
+ $delete = $this->callAPISuccess('PriceSet', 'delete', array(
'id' => $this->priceSetID,
));
);
$getResult = $this->callAPIAndDocument($this->_entity, 'get', $getParams, __FUNCTION__, __FILE__);
$this->assertEquals(1, $getResult['count'], 'In line ' . __LINE__);
- $this->callAPISuccess('price_field','delete', array('id' => $createResult['id']));
+ $this->callAPISuccess('price_field', 'delete', array('id' => $createResult['id']));
}
public function testDeletePriceField() {
- $startCount = $this->callAPISuccess($this->_entity, 'getcount', array( ));
+ $startCount = $this->callAPISuccess($this->_entity, 'getcount', array());
$createResult = $this->callAPISuccess($this->_entity, 'create', $this->_params);
$deleteParams = array('id' => $createResult['id']);
$deleteResult = $this->callAPIAndDocument($this->_entity, 'delete', $deleteParams, __FUNCTION__, __FILE__);
$this->assertAPISuccess($deleteResult, 'In line ' . __LINE__);
- $endCount = $this->callAPISuccess($this->_entity, 'getcount', array( ));
+ $endCount = $this->callAPISuccess($this->_entity, 'getcount', array());
$this->assertEquals($startCount, $endCount, 'In line ' . __LINE__);
}
'is_reserved' => 1,
);
- $price_set = $this->callAPISuccess('price_set', 'create',$priceSetparams);
+ $price_set = $this->callAPISuccess('price_set', 'create', $priceSetparams);
$this->priceSetID = $price_set['id'];
$priceFieldparams = array(
'is_enter_qty' => 1,
'is_active' => 1,
);
- $priceField = $this->callAPISuccess('price_field','create', $priceFieldparams);
+ $priceField = $this->callAPISuccess('price_field', 'create', $priceFieldparams);
$this->priceFieldID = $priceField['id'];
$this->_params = array(
'price_field_id' => $this->priceFieldID,
'is_quick_config' => 1,
'is_reserved' => 1,
);
- $price_set1 = $this->callAPISuccess('price_set', 'create',$priceSetparams1);
+ $price_set1 = $this->callAPISuccess('price_set', 'create', $priceSetparams1);
$this->priceSetID1 = $price_set1['id'];
$priceFieldparams1 = array(
'price_set_id' => $this->priceSetID1,
'is_enter_qty' => 1,
'is_active' => 1,
);
- $priceField1 = $this->callAPISuccess('price_field','create', $priceFieldparams1);
+ $priceField1 = $this->callAPISuccess('price_field', 'create', $priceFieldparams1);
$this->priceFieldID1 = $priceField1['id'];
}
);
$this->quickCleanup($tablesToTruncate);
$this->membershipTypeDelete(array('id' => $this->_membershipTypeID));
- $this->callAPISuccess('PriceField','delete', array(
+ $this->callAPISuccess('PriceField', 'delete', array(
'id' => $this->priceFieldID1,
));
- $this->callAPISuccess('PriceSet','delete', array(
+ $this->callAPISuccess('PriceSet', 'delete', array(
'id' => $this->priceSetID1,
));
- $this->callAPISuccess('PriceField','delete', array(
+ $this->callAPISuccess('PriceField', 'delete', array(
'id' => $this->priceFieldID,
));
- $delete = $this->callAPISuccess('PriceSet','delete', array(
+ $delete = $this->callAPISuccess('PriceSet', 'delete', array(
'id' => $this->priceSetID,
));
);
$getResult = $this->callAPIAndDocument($this->_entity, 'get', $getParams, __FUNCTION__, __FILE__);
$this->assertEquals(1, $getResult['count'], 'In line ' . __LINE__);
- $this->callAPISuccess('price_field_value','delete', array('id' => $createResult['id']));
+ $this->callAPISuccess('price_field_value', 'delete', array('id' => $createResult['id']));
}
public function testDeletePriceFieldValue() {
public function testCreatePriceFieldValuewithMultipleTerms() {
$params = array(
'price_field_id' => $this->priceFieldID1,
- 'membership_type_id' => $this->_membershipTypeID,
+ 'membership_type_id' => $this->_membershipTypeID,
'name' => 'memType1',
'label' => 'memType1',
'amount' => 90,
public function testGetPriceFieldValuewithMultipleTerms() {
$params1 = array(
'price_field_id' => $this->priceFieldID1,
- 'membership_type_id' => $this->_membershipTypeID,
+ 'membership_type_id' => $this->_membershipTypeID,
'name' => 'memType1',
'label' => 'memType1',
'amount' => 90,
);
$params2 = array(
'price_field_id' => $this->priceFieldID1,
- 'membership_type_id' => $this->_membershipTypeID,
+ 'membership_type_id' => $this->_membershipTypeID,
'name' => 'memType2',
'label' => 'memType2',
'amount' => 120,
);
$result1 = $this->callAPISuccess($this->_entity, 'create', $params1);
$result2 = $this->callAPISuccess($this->_entity, 'create', $params2);
- $result = $this->callAPISuccess($this->_entity, 'get', array('price_field_id' =>$this->priceFieldID1 ));
+ $result = $this->callAPISuccess($this->_entity, 'get', array('price_field_id' => $this->priceFieldID1 ));
$this->assertEquals(2, $result['count'], 'In line ' . __LINE__);
- $this->callAPISuccess($this->_entity,'delete', array('id' => $result1['id']));
- $this->callAPISuccess($this->_entity,'delete', array('id' => $result2['id']));
+ $this->callAPISuccess($this->_entity, 'delete', array('id' => $result1['id']));
+ $this->callAPISuccess($this->_entity, 'delete', array('id' => $result2['id']));
}
}
public function setUp() {
parent::setUp();
$this->_params = array(
-# [domain_id] =>
+ # [domain_id] =>
'name' => 'default_goat_priceset',
'title' => 'Goat accessories',
'is_active' => 1,
'title' => 'Some Price Set',
'is_active' => 1,
'financial_type_id' => 1,
- 'extends' => array(1,2),
+ 'extends' => array(1, 2),
);
$createResult = $this->callAPIAndDocument($this->_entity, 'create', $createParams, __FUNCTION__, __FILE__);
}
public static function setUpBeforeClass() {
- // put stuff here that should happen before all tests in this unit
+ // put stuff here that should happen before all tests in this unit
}
public static function tearDownAfterClass(){
);
}
-// function tearDown() {
-// $this->quickCleanup(array('civicrm_product'), TRUE);
-// }
+ // function tearDown() {
+ // $this->quickCleanup(array('civicrm_product'), TRUE);
+ // }
public function testGetFields() {
$fields = $this->callAPISuccess($this->_entity, 'getfields', array('action' => 'create'));
/**
* Test APIv3 civicrm_profile_* functions
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class api_v3_ProfileTest extends CiviUnitTestCase {
protected $_apiversion;
public function testProfileGetMultipleHasBillingLocation() {
$individual = $this->_createIndividualContact();
$contactId = key($individual);
- $this->callAPISuccess('address', 'create', array('contact_id' => $contactId , 'street_address' => '25 Big Street', 'city' => 'big city', 'location_type_id' => 5));
- $this->callAPISuccess('email', 'create', array('contact_id' => $contactId , 'email' => 'big@once.com', 'location_type_id' => 2, 'is_billing' => 1));
+ $this->callAPISuccess('address', 'create', array('contact_id' => $contactId, 'street_address' => '25 Big Street', 'city' => 'big city', 'location_type_id' => 5));
+ $this->callAPISuccess('email', 'create', array('contact_id' => $contactId, 'email' => 'big@once.com', 'location_type_id' => 2, 'is_billing' => 1));
$expected = current($individual);
}
unset($params['email-primary']);
$params['email-Primary'] = 'my@mail.com';
- $this->callAPISuccess('profile', 'submit', $params);
+ $this->callAPISuccess('profile', 'submit', $params);
$profileDetails = $this->callAPISuccess('profile', 'get', $getParams);
$this->assertEquals('my@mail.com', $profileDetails['values']['email-Primary']);
}
$this->assertEquals(array_keys($membershipTypes['values']), array_keys($getoptions['values']));
$this->assertEquals(array_keys($membershipTypes['values']), array_keys($profileFields['values']['membership_type_id']['options']));
-}
+ }
/**
* Test that the fields are returned in the right order despite the faffing around that goes on
// via the api
$ufGroupParams = array(
- 'group_type' => 'Individual,Contact',// really we should remove this & test the ufField create sets it
+ 'group_type' => 'Individual,Contact', // really we should remove this & test the ufField create sets it
'name' => 'test_individual_contact_profile',
'title' => 'Flat Coffee',
'api.uf_field.create' => array(
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
require_once 'CiviTest/CiviUnitTestCase.php';
'contact_id_a' => $this->_cId_a,
'contact_id_b' => $this->_cId_b,
'relationship_type_id' => $this->_relTypeID,
- 'start_date' => '2008-12-20', 'end_date' => NULL,
+ 'start_date' => '2008-12-20',
+ 'end_date' => NULL,
'is_active' => 1,
);
$relationship = $this->callAPISuccess('relationship', 'create', $params);
'is_active' => 1,
);
-
$result = $this->callAPISuccess('CustomField', 'create', $params);
$customField = NULL;
}
public function testGetIsCurrent() {
- $rel2Params =array(
+ $rel2Params = array(
'contact_id_a' => $this->_cId_a,
'contact_id_b' => $this->_cId_b2,
'relationship_type_id' => $this->_relTypeID,
$this->AssertEquals($rel1['id'], $result['id']);
// now try not started
- $rel2Params['is_active'] =1;
- $rel2Params['start_date'] ='tomorrow';
+ $rel2Params['is_active'] = 1;
+ $rel2Params['start_date'] = 'tomorrow';
$rel2 = $this->callAPISuccess('relationship', 'create', $rel2Params);
$result = $this->callAPISuccess('relationship', 'get', $getParams);
$this->assertEquals($result['count'], 1);
$this->AssertEquals($rel1['id'], $result['id']);
// now try finished
- $rel2Params['is_active'] =1;
- $rel2Params['start_date'] ='last week';
- $rel2Params['end_date'] ='yesterday';
+ $rel2Params['is_active'] = 1;
+ $rel2Params['start_date'] = 'last week';
+ $rel2Params['end_date'] = 'yesterday';
$rel2 = $this->callAPISuccess('relationship', 'create', $rel2Params);
}
/*
$rel1 = $this->callAPISuccess('relationship', 'create', $this->_params);
$rel2 = $this->callAPISuccess('relationship', 'create', array_merge($this->_params,
- array('relationship_type_id' => $relationType2,)));
+ array('relationship_type_id' => $relationType2)));
$rel3 = $this->callAPISuccess('relationship', 'create', array_merge($this->_params,
- array('relationship_type_id' => $relationType3,)));
+ array('relationship_type_id' => $relationType3)));
$rel4 = $this->callAPISuccess('relationship', 'create', array_merge($this->_params,
- array('relationship_type_id' => $relationType4,)));
+ array('relationship_type_id' => $relationType4)));
$getParams = array(
'relationship_type_id' => array('IN' => array($relationType2, $relationType3))
);
$result = $this->callAPIAndDocument('relationship', 'get', $getParams, __FUNCTION__, __FILE__, $description, $subfile);
$this->assertEquals($result['count'], 1);
- $this->AssertEquals(array($rel1['id'],), array_keys($result['values']));
+ $this->AssertEquals(array($rel1['id']), array_keys($result['values']));
}
/**
* an incorrect one
*/
public function testGetRelationshipByTypeDAO() {
- $this->ids['relationship'] = $this->callAPISuccess($this->_entity, 'create', array('format.only_id' => TRUE,) + $this->_params);
+ $this->ids['relationship'] = $this->callAPISuccess($this->_entity, 'create', array('format.only_id' => TRUE) + $this->_params);
$result = $this->callAPISuccess($this->_entity, 'getcount', array(
'contact_id_a' => $this->_cId_a,),
1);
* an incorrect one
*/
public function testGetRelationshipByMembershipTypeReciprocal() {
- $created = $this->callAPISuccess($this->_entity, 'create', $this->_params);
+ $created = $this->callAPISuccess($this->_entity, 'create', $this->_params);
$org3 = $this->organizationCreate();
$relType2 = 5; // lets just assume built in ones aren't being messed with!
$id = $this->_relationshipTypeCreate();
// create sample relationship type.
$params = array(
- 'id' => $id,
+ 'id' => $id,
);
$result = $this->callAPIAndDocument('relationship_type', 'delete', $params, __FUNCTION__, __FILE__);
$this->assertAPIDeleted('relationship_type', $id);
/**
* Test APIv3 civicrm_report_instance_* functions
*
- * @package CiviCRM_APIv3
- * @subpackage API_Report
+ * @package CiviCRM_APIv3
+ * @subpackage API_Report
*/
class api_v3_ReportTemplateTest extends CiviUnitTestCase {
WHERE name = "CRM_Report_Form_Examplez"');
// change component to null
- $result = $this->callAPISuccess('ReportTemplate', 'create', array( 'id' => $entityId,
+ $result = $this->callAPISuccess('ReportTemplate', 'create', array(
+ 'id' => $entityId,
'component' => '',
));
$this->assertAPISuccess($result);
AND component_id IS NULL');
// deactivate
- $result = $this->callAPISuccess('ReportTemplate', 'create', array( 'id' => $entityId,
+ $result = $this->callAPISuccess('ReportTemplate', 'create', array(
+ 'id' => $entityId,
'is_active' => 0,
));
$this->assertAPISuccess($result);
WHERE name = "CRM_Report_Form_Examplez"');
// activate
- $result = $this->callAPISuccess('ReportTemplate', 'create', array( 'id' => $entityId,
+ $result = $this->callAPISuccess('ReportTemplate', 'create', array(
+ 'id' => $entityId,
'is_active' => 1,
));
$this->assertAPISuccess($result);
if(stristr($reportID, 'has existing issues')) {
$this->markTestIncomplete($reportID);
}
- $result = $this->callAPISuccess('report_template', 'getrows', array(
+ $result = $this->callAPISuccess('report_template', 'getrows', array(
'report_id' => $reportID,
));
}
if(stristr($reportID, 'has existing issues')) {
$this->markTestIncomplete($reportID);
}
- if(in_array($reportID , array('contribute/softcredit', 'contribute/bookkeeping'))) {
+ if(in_array($reportID, array('contribute/softcredit', 'contribute/bookkeeping'))) {
$this->markTestIncomplete($reportID . " has non enotices when calling statistics fn");
}
$description = "Get Statistics from a report (note there isn't much data to get in the test DB :-(";
*/
public static function getReportTemplates() {
$reportsToSkip = array(
- 'activity' => 'does not respect function signature on from clause',
+ 'activity' => 'does not respect function signature on from clause',
'walklist' => 'Notice: Undefined index: type in CRM_Report_Form_Walklist_Walklist line 155.
(suspect the select function should be removed in favour of the parent (state province field)
also, type should be added to state province & others? & potentially getAddressColumns fn should be
}
}
-
-
return $reportTemplates;
}
}
/**
* Test APIv3 civicrm_setting_* functions
*
- * @package CiviCRM_APIv3
- * @subpackage API_Core
+ * @package CiviCRM_APIv3
+ * @subpackage API_Core
*/
/**
$params = array(
'name' => 'Default Domain Name',
);
- $result = $this->callAPISuccess( 'domain','get',$params);
+ $result = $this->callAPISuccess( 'domain', 'get', $params);
if(empty($result['id'])){
- $result = $this->callAPISuccess( 'domain','create',$params );
+ $result = $this->callAPISuccess( 'domain', 'create', $params );
}
$params['name'] = 'Second Domain';
- $result = $this->callAPISuccess( 'domain','get',$params);
+ $result = $this->callAPISuccess( 'domain', 'get', $params);
if(empty($result['id'])){
- $result = $this->callAPISuccess( 'domain','create',$params );
+ $result = $this->callAPISuccess( 'domain', 'create', $params );
}
$this->_domainID2 = $result['id'];
$params['name'] = 'A-team domain';
- $result = $this->callAPISuccess( 'domain','get',$params);
+ $result = $this->callAPISuccess( 'domain', 'get', $params);
if(empty($result['id'])){
- $result = $this->callAPISuccess( 'domain','create',$params );
+ $result = $this->callAPISuccess( 'domain', 'create', $params );
}
$this->_domainID3 = $result['id'];
$this->_currentDomain = CRM_Core_Config::domainID();
public function tearDown() {
CRM_Utils_Hook::singleton()->reset();
parent::tearDown();
- $this->callAPISuccess('system','flush', array());
+ $this->callAPISuccess('system', 'flush', array());
$this->quickCleanup(array('civicrm_domain'));
}
$description = 'Demonstrate return from getfields';
$result = $this->callAPISuccess('setting', 'getfields', array());
$this->assertArrayHasKey('customCSSURL', $result['values']);
- $this->callAPISuccess('system','flush', array());
+ $this->callAPISuccess('system', 'flush', array());
}
/**
*/
public function testGetFieldsCaching() {
$settingsMetadata = array();
- CRM_Core_BAO_Cache::setItem($settingsMetadata,'CiviCRM setting Specs', 'settingsMetadata__');
- CRM_Core_BAO_Cache::setItem($settingsMetadata,'CiviCRM setting Spec', 'All');
+ CRM_Core_BAO_Cache::setItem($settingsMetadata, 'CiviCRM setting Specs', 'settingsMetadata__');
+ CRM_Core_BAO_Cache::setItem($settingsMetadata, 'CiviCRM setting Spec', 'All');
$result = $this->callAPISuccess('setting', 'getfields', array());
$this->assertArrayNotHasKey('customCSSURL', $result['values']);
$this->quickCleanup(array('civicrm_cache'));
$params = array('name' => 'advanced_search_options');
$result = $this->callAPISuccess('setting', 'getfields', $params);
$this->assertArrayNotHasKey('customCSSURL', $result['values']);
- $this->assertArrayHasKey('advanced_search_options',$result['values']);
+ $this->assertArrayHasKey('advanced_search_options', $result['values']);
}
/**
$params = array('filters' => array('group' => 'multisite'));
$result = $this->callAPISuccess('setting', 'getfields', $params);
$this->assertArrayNotHasKey('customCSSURL', $result['values']);
- $this->assertArrayHasKey('domain_group_id',$result['values']);
+ $this->assertArrayHasKey('domain_group_id', $result['values']);
}
/**
$params = array('filters' => array('prefetch' => 1));
$result = $this->callAPISuccess('setting', 'getfields', $params);
$this->assertArrayNotHasKey('disable_mandatory_tokens_check', $result['values']);
- $this->assertArrayHasKey('monetaryDecimalPoint',$result['values']);
+ $this->assertArrayHasKey('monetaryDecimalPoint', $result['values']);
}
/**
);
$result = $this->callAPIAndDocument('setting', 'create', $params, __FUNCTION__, __FILE__);
- $params = array('uniq_email_per_site' => 1,);
+ $params = array('uniq_email_per_site' => 1);
$description = "shows setting a variable for a current domain";
$result = $this->callAPIAndDocument('setting', 'create', $params, __FUNCTION__, __FILE__, $description, 'CreateSettingCurrentDomain');
$this->assertArrayHasKey(CRM_Core_Config::domainID(), $result['values']);
);
$result = $this->callAPIFailure('setting', 'create', $params);
- $params = array('track_civimail_replies' => '0',);
+ $params = array('track_civimail_replies' => '0');
$result = $this->callAPISuccess('setting', 'create', $params);
- $getResult = $this->callAPISuccess('setting','get',$params);
+ $getResult = $this->callAPISuccess('setting', 'get', $params);
$this->assertEquals(0, $getResult['values'][$this->_currentDomain]['track_civimail_replies']);
- $getResult = $this->callAPISuccess('setting','get',$params);
+ $getResult = $this->callAPISuccess('setting', 'get', $params);
$this->assertEquals(0, $getResult['values'][$this->_currentDomain]['track_civimail_replies']);
- $params = array( 'domain_id' => $this->_domainID2,
+ $params = array(
+ 'domain_id' => $this->_domainID2,
'track_civimail_replies' => '1',
);
$result = $this->callAPISuccess('setting', 'create', $params);
- $getResult = $this->callAPISuccess('setting','get',$params);
+ $getResult = $this->callAPISuccess('setting', 'get', $params);
$this->assertEquals(1, $getResult['values'][$this->_domainID2]['track_civimail_replies']);
$params = array(
'track_civimail_replies' => 'TRUE',
);
$result = $this->callAPISuccess('setting', 'create', $params);
- $getResult = $this->callAPISuccess('setting','get',$params);
+ $getResult = $this->callAPISuccess('setting', 'get', $params);
$this->assertEquals(1, $getResult['values'][$this->_domainID2]['track_civimail_replies'], "check TRUE is converted to 1");
}
'domain_id' => 'all',
'uniq_email_per_site' => 1,
);
- $result = $this->callAPIAndDocument('setting', 'create', $params, __FUNCTION__, __FILE__,$description, 'CreateAllDomains');
+ $result = $this->callAPIAndDocument('setting', 'create', $params, __FUNCTION__, __FILE__, $description, 'CreateAllDomains');
$this->assertEquals(1, $result['values'][2]['uniq_email_per_site']);
$this->assertEquals(1, $result['values'][1]['uniq_email_per_site']);
);
// we'll check it with a 'get'
$description = "shows getting a variable for all domains";
- $result = $this->callAPIAndDocument('setting', 'get', $params, __FUNCTION__, __FILE__,$description, 'GetAllDomains', 'Get');
+ $result = $this->callAPIAndDocument('setting', 'get', $params, __FUNCTION__, __FILE__, $description, 'GetAllDomains', 'Get');
$this->assertEquals(1, $result['values'][2]['uniq_email_per_site']);
$this->assertEquals(1, $result['values'][1]['uniq_email_per_site']);
$this->assertEquals(1, $result['values'][3]['uniq_email_per_site']);
$params = array(
- 'domain_id' => array(1,3),
+ 'domain_id' => array(1, 3),
'uniq_email_per_site' => 0,
);
$description = "shows setting a variable for specified domains";
- $result = $this->callAPIAndDocument('setting', 'create', $params, __FUNCTION__, __FILE__,$description, 'CreateSpecifiedDomains');
+ $result = $this->callAPIAndDocument('setting', 'create', $params, __FUNCTION__, __FILE__, $description, 'CreateSpecifiedDomains');
$this->assertEquals(0, $result['values'][3]['uniq_email_per_site']);
$this->assertEquals(0, $result['values'][1]['uniq_email_per_site']);
$params = array(
- 'domain_id' => array(1,2),
+ 'domain_id' => array(1, 2),
'return' => array('uniq_email_per_site'),
);
$description = "shows getting a variable for specified domains";
- $result = $this->callAPIAndDocument('setting', 'get', $params, __FUNCTION__, __FILE__,$description, 'GetSpecifiedDomains', 'Get');
+ $result = $this->callAPIAndDocument('setting', 'get', $params, __FUNCTION__, __FILE__, $description, 'GetSpecifiedDomains', 'Get');
$this->assertEquals(1, $result['values'][2]['uniq_email_per_site']);
$this->assertEquals(0, $result['values'][1]['uniq_email_per_site']);
);
$description = "shows get setting a variable for a given domain - if no domain is set current is assumed";
- $result = $this->callAPIAndDocument('setting', 'get', $params, __FUNCTION__, __FILE__);
+ $result = $this->callAPIAndDocument('setting', 'get', $params, __FUNCTION__, __FILE__);
$params = array(
'return' => 'uniq_email_per_site',
);
$description = "shows getting a variable for a current domain";
- $result = $this->callAPIAndDocument('setting', 'get', $params, __FUNCTION__, __FILE__, $description, 'GetSettingCurrentDomain');
+ $result = $this->callAPIAndDocument('setting', 'get', $params, __FUNCTION__, __FILE__, $description, 'GetSettingCurrentDomain');
$this->assertArrayHasKey(CRM_Core_Config::domainID(), $result['values']);
}
*/
public function testGetConfigSetting() {
$settings = $this->callAPISuccess('setting', 'get', array(
- 'name' => 'defaultCurrency', 'sequential' => 1,)
+ 'name' => 'defaultCurrency',
+ 'sequential' => 1,)
);
$this->assertEquals('USD', $settings['values'][0]['defaultCurrency']);
}
*/
public function testGetSetConfigSettingMultipleDomains() {
$settings = $this->callAPISuccess('setting', 'create', array(
- 'defaultCurrency' => 'USD', 'domain_id' => $this->_currentDomain)
+ 'defaultCurrency' => 'USD',
+ 'domain_id' => $this->_currentDomain)
);
$settings = $this->callAPISuccess('setting', 'create', array(
- 'defaultCurrency' => 'CAD', 'domain_id' => $this->_domainID2)
+ 'defaultCurrency' => 'CAD',
+ 'domain_id' => $this->_domainID2)
);
$settings = $this->callAPISuccess('setting', 'get', array(
- 'return' => 'defaultCurrency', 'domain_id' => 'all',
+ 'return' => 'defaultCurrency',
+ 'domain_id' => 'all',
)
);
$this->assertEquals('USD', $settings['values'][$this->_currentDomain]['defaultCurrency']);
* Use getValue against a config setting
*/
public function testGetValueConfigSetting() {
- $params = array( 'name' => 'monetaryThousandSeparator',
+ $params = array(
+ 'name' => 'monetaryThousandSeparator',
'group' => 'Localization Setting',
);
$result = $this->callAPISuccess('setting', 'getvalue', $params);
}
public function testGetValue() {
- $params = array( 'name' => 'petition_contacts',
+ $params = array(
+ 'name' => 'petition_contacts',
'group' => 'Campaign Preferences'
);
$description = "Demonstrates getvalue action - intended for runtime use as better caching than get";
$params = array(
'name' => 'address_format',
);
- $result = $this->callAPIAndDocument('setting', 'getdefaults', $params, __FUNCTION__, __FILE__,$description,'GetDefaults','getdefaults');
+ $result = $this->callAPIAndDocument('setting', 'getdefaults', $params, __FUNCTION__, __FILE__, $description, 'GetDefaults', 'getdefaults');
$this->assertEquals("{contact.address_name}\n{contact.street_address}\n{contact.supplemental_address_1}\n{contact.supplemental_address_2}\n{contact.city}{, }{contact.state_province}{ }{contact.postal_code}\n{contact.country}", $result['values'][CRM_Core_Config::domainID()]['address_format']);
- $params = array('name' => 'mailing_format',);
+ $params = array('name' => 'mailing_format');
$result = $this->callAPISuccess('setting', 'getdefaults', $params);
$this->assertEquals("{contact.addressee}\n{contact.street_address}\n{contact.supplemental_address_1}\n{contact.supplemental_address_2}\n{contact.city}{, }{contact.state_province}{ }{contact.postal_code}\n{contact.country}", $result['values'][CRM_Core_Config::domainID()]['mailing_format']);
$this->assertArrayHasKey(CRM_Core_Config::domainID(), $result['values']);
* Function tests reverting a specific parameter
*/
public function testRevert() {
- $params = array( 'address_format' => 'xyz',
+ $params = array(
+ 'address_format' => 'xyz',
'mailing_format' => 'bcs',
);
$result = $this->callAPISuccess('setting', 'create', $params);
$this->assertAPISuccess($result, "in line " . __LINE__);
- $revertParams = array( 'name' => 'address_format'
+ $revertParams = array(
+ 'name' => 'address_format'
);
$result = $this->callAPISuccess('setting', 'get', $params);
//make sure it's set
$this->assertEquals('xyz', $result['values'][CRM_Core_Config::domainID()]['address_format']);
$description = "Demonstrates reverting a parameter to default value";
- $result = $this->callAPIAndDocument('setting', 'revert', $revertParams, __FUNCTION__, __FILE__,$description,'','revert');
+ $result = $this->callAPIAndDocument('setting', 'revert', $revertParams, __FUNCTION__, __FILE__, $description, '', 'revert');
//make sure it's reverted
$result = $this->callAPISuccess('setting', 'get', $params);
$this->assertEquals("{contact.address_name}\n{contact.street_address}\n{contact.supplemental_address_1}\n{contact.supplemental_address_2}\n{contact.city}{, }{contact.state_province}{ }{contact.postal_code}\n{contact.country}", $result['values'][CRM_Core_Config::domainID()]['address_format']);
- $params = array( 'return' => array('mailing_format'),
+ $params = array(
+ 'return' => array('mailing_format'),
);
$result = $this->callAPISuccess('setting', 'get', $params);
//make sure it's unchanged
* Tests reverting ALL parameters (specific domain)
*/
public function testRevertAll() {
- $params = array( 'address_format' => 'xyz',
+ $params = array(
+ 'address_format' => 'xyz',
'mailing_format' => 'bcs',
);
$result = $this->callAPISuccess('setting', 'create', $params);
- $revertParams = array( );
+ $revertParams = array();
$result = $this->callAPISuccess('setting', 'get', $params);
//make sure it's set
$this->assertEquals('xyz', $result['values'][CRM_Core_Config::domainID()]['address_format']);
$params = array( 'domain_id' => 'all',
);
$result = $this->callAPISuccess('setting', 'get', $params);
- $params = array( 'address_format' => 'xyz',
+ $params = array(
+ 'address_format' => 'xyz',
'mailing_format' => 'bcs',
'domain_id' => $this->_domainID2,
);
$result = $this->callAPISuccess('setting', 'create', $params);
- $params = array( 'domain_id' => $dom['id'],
+ $params = array(
+ 'domain_id' => $dom['id'],
);
$result = $this->callAPISuccess('setting', 'get', $params);
$this->assertAPISuccess($result, "in line " . __LINE__);
- $this->assertArrayNotHasKey('tag_unconfirmed', $result['values'][$dom['id']],'setting for domain 3 should not be set. Debug this IF domain test is passing');
+ $this->assertArrayNotHasKey('tag_unconfirmed', $result['values'][$dom['id']], 'setting for domain 3 should not be set. Debug this IF domain test is passing');
$result = $this->callAPISuccess('setting', 'fill', $params);
$this->assertAPISuccess($result, "in line " . __LINE__);
$result = $this->callAPISuccess('setting', 'get', $params);
* Class api_v3_SurveyRespondantTest
*/
class api_v3_SurveyRespondantTest extends CiviUnitTestCase {
- protected $_apiversion =3;
+ protected $_apiversion = 3;
protected $params;
);
$survey = $this->callAPISuccess('survey', 'create', $surveyParams);
$surveyID = $survey['id'];
- $this->params = array (
- 'sequential' =>'1',
+ $this->params = array(
+ 'sequential' => '1',
'survey_id' => $surveyID
);
}
* Test survey respondent get.
*/
public function testGetSurveyRespondants() {
- $result = $this->callAPIAndDocument("SurveyRespondant","get", $this->params, __FUNCTION__, __FILE__);
+ $result = $this->callAPIAndDocument("SurveyRespondant", "get", $this->params, __FUNCTION__, __FILE__);
}
}
$this->assertNotNull($result['values'][$result['id']]['id'], 'In line ' . __LINE__);
}
-/**
- * Check the delete function succeeds
- */
+ /**
+ * Check the delete function succeeds
+ */
public function testDeleteSurvey() {
$entity = $this->createTestEntity();
$result = $this->callAPIAndDocument('survey', 'delete', array('id' => $entity['id']), __FUNCTION__, __FILE__);
- $checkDeleted = $this->callAPISuccess($this->entity, 'get', array(
- ));
+ $checkDeleted = $this->callAPISuccess($this->entity, 'get', array());
$this->assertEquals(0, $checkDeleted['count'], 'In line ' . __LINE__);
}
$this->toBeImplemented['get'] = array('Profile', 'CustomValue', 'Constant', 'CustomSearch', 'Extension', 'ReportTemplate', 'System', 'Setting');
$this->toBeImplemented['create'] = array('SurveyRespondant', 'OptionGroup', 'MailingRecipients', 'UFMatch', 'LocationType', 'CustomSearch', 'Extension', 'ReportTemplate', 'System');
$this->toBeImplemented['delete'] = array('MembershipPayment', 'OptionGroup', 'SurveyRespondant', 'UFJoin', 'UFMatch', 'Extension', 'LocationType', 'System');
- $this->onlyIDNonZeroCount['get'] = array('ActivityType', 'Entity', 'Domain','Setting');
+ $this->onlyIDNonZeroCount['get'] = array('ActivityType', 'Entity', 'Domain', 'Setting');
$this->deprecatedAPI = array('Location', 'ActivityType', 'SurveyRespondant');
$this->deletableTestObjects = array();
}
foreach ($entities as $entityName => $entity ) {
if(!in_array($entityName, $invalidEntities)
&& !in_array($entityName, $entitiesToFix)) {
- if(!empty(self::$componentMap[$entityName]) && empty($enabledComponents[self::$componentMap[$entityName]])) {
- CRM_Core_BAO_ConfigSetting::enableComponent(self::$componentMap[$entityName]);
- }
- $customDataEntities[] = array($entityName);
+ if(!empty(self::$componentMap[$entityName]) && empty($enabledComponents[self::$componentMap[$entityName]])) {
+ CRM_Core_BAO_ConfigSetting::enableComponent(self::$componentMap[$entityName]);
+ }
+ $customDataEntities[] = array($entityName);
}
}
return $customDataEntities;
public static function toBeSkipped_getfields($sequential = FALSE) {
$entitiesWithMetadataNotYetFixed = array('ReportTemplate', 'CustomSearch');
if ($sequential === TRUE) {
- return $entitiesWithMetadataNotYetFixed ;
+ return $entitiesWithMetadataNotYetFixed;
}
$entities = array();
foreach ($entitiesWithMetadataNotYetFixed as $e) {
}
return $entities;
}
-/**
- * Generate list of entities to test for get by id functions
- * @param bool $sequential
- * @return array Entities to be skipped
- */
+ /**
+ * Generate list of entities to test for get by id functions
+ * @param bool $sequential
+ * @return array Entities to be skipped
+ */
public static function toBeSkipped_automock($sequential = FALSE) {
- $entitiesWithoutGet = array('MailingContact', 'EntityTag', 'Participant', 'ParticipantPayment', 'Setting', 'SurveyRespondant', 'MailingRecipients', 'CustomSearch', 'Extension', 'ReportTemplate', 'System');
+ $entitiesWithoutGet = array('MailingContact', 'EntityTag', 'Participant', 'ParticipantPayment', 'Setting', 'SurveyRespondant', 'MailingRecipients', 'CustomSearch', 'Extension', 'ReportTemplate', 'System');
if ($sequential === TRUE) {
return $entitiesWithoutGet;
}
/**
- * At this stage exclude the ones that don't pass & add them as we can troubleshoot them
- */
+ * At this stage exclude the ones that don't pass & add them as we can troubleshoot them
+ */
public static function toBeSkipped_updatesingle($sequential = FALSE) {
$entitiesWithout = array(
'Attachment', // pseudo-entity; testUpdateSingleValueAlter doesn't introspect properly on it. Multiple magic fields
*/
public static function toBeSkipped_getlimit() {
$entitiesWithout = array(
- 'Case',//case api has non-std mandatory fields one of (case_id, contact_id, activity_id, contact_id)
+ 'Case', //case api has non-std mandatory fields one of (case_id, contact_id, activity_id, contact_id)
'EntityTag', // non-standard api - has inappropriate mandatory fields & doesn't implement limit
'Event', // failed 'check that a 5 limit returns 5' - probably is_template field is wrong or something, or could be limit doesn't work right
'Extension', // can't handle creating 25
*/
public static function toBeSkipped_getSqlOperators() {
$entitiesWithout = array(
- 'Case',//case api has non-std mandatory fields one of (case_id, contact_id, activity_id, contact_id)
+ 'Case', //case api has non-std mandatory fields one of (case_id, contact_id, activity_id, contact_id)
'Contact', // on the todo list!
'EntityTag', // non-standard api - has inappropriate mandatory fields & doesn't implement limit
'Extension', // can't handle creating 25
'Address' => array(
'cant_update' => array(
'state_province_id', //issues with country id - need to ensure same country
- 'master_id',//creates relationship
+ 'master_id', //creates relationship
),
- 'cant_return' => array(
- )
+ 'cant_return' => array()
),
'Batch' => array(
'cant_update' => array(
'cant_update' => array(
'billing_mode',
),
- 'break_return' => array(
- ),
- 'cant_return' => array(
- ),
+ 'break_return' => array(),
+ 'cant_return' => array(),
),
'PriceFieldValue' => array(
'cant_update' => array(
/**
* @dataProvider toBeSkipped_get
- entities that don't need a get action
+ entities that don't need a get action
*/
public function testNotImplemented_get($Entity) {
$result = civicrm_api($Entity, 'Get', array('version' => 3));
$this->assertEquals(1, $result['is_error'], 'In line ' . __LINE__);
// $this->assertContains("API ($Entity, Get) does not exist", $result['error_message']);
- $this->assertRegExp('/API (.*) does not exist/', $result['error_message']);
+ $this->assertRegExp('/API (.*) does not exist/', $result['error_message']);
}
/**
return;
}
-
$this->assertArrayHasKey('version', $result);
$this->assertEquals(3, $result['version']);
if (!in_array($Entity, $this->onlyIDNonZeroCount['get'])) {
/**
* @dataProvider toBeSkipped_create
- entities that don't need a create action
+ entities that don't need a create action
*/
public function testNotImplemented_create($Entity) {
$result = civicrm_api($Entity, 'Create', array('version' => 3));
$fields = $fields['values'];
$return = array_keys($fieldsGet['values']);
$valuesNotToReturn = $this->getKnownUnworkablesUpdateSingle($entityName, 'break_return');
- // these can't be requested as return values
+ // these can't be requested as return values
$entityValuesThatDoNotWork = array_merge(
$this->getKnownUnworkablesUpdateSingle($entityName, 'cant_update'),
$this->getKnownUnworkablesUpdateSingle($entityName, 'cant_return'),
$valuesNotToReturn
);
- $return = array_diff($return,$valuesNotToReturn);
+ $return = array_diff($return, $valuesNotToReturn);
$baoObj = new CRM_Core_DAO();
$baoObj->createTestObject($baoString, array('currency' => 'USD'), 2, 0);
$fieldName = $specs['uniquename'];
}
if ($field == 'currency' || $field == 'id' || $field == strtolower($entityName) . '_id'
- || in_array($field,$entityValuesThatDoNotWork)) {
+ || in_array($field, $entityValuesThatDoNotWork)) {
//@todo id & entity_id are correct but we should fix currency & frequency_day
continue;
}
case CRM_Utils_Type::T_TIMESTAMP:
$entity[$fieldName] = '2012-05-20';
break;
+
//case CRM_Utils_Type::T_DATETIME:
case 12:
case CRM_Utils_Type::T_TEXT:
case CRM_Utils_Type::T_LONGTEXT:
case CRM_Utils_Type::T_EMAIL:
- $entity[$fieldName] = substr('New String',0, CRM_Utils_Array::Value('maxlength',$specs,100));
+ $entity[$fieldName] = substr('New String', 0, CRM_Utils_Array::Value('maxlength', $specs, 100));
break;
case CRM_Utils_Type::T_INT:
$resetFKTo = array($fieldName => $entity[$fieldName]);
}
$entity[$fieldName] = (string) empty($entity2[$field]) ? CRM_Utils_Array::value($uniqueName, $entity2) : $entity2[$field];
- //todo - there isn't always something set here - & our checking on unset values is limited
+ //todo - there isn't always something set here - & our checking on unset values is limited
if (empty($entity[$field])) {
unset($entity[$field]);
}
/**
* @dataProvider toBeSkipped_delete
- entities that don't need a delete action
+ entities that don't need a delete action
*/
public function testNotImplemented_delete($Entity) {
$nonExistantID = 151416349;
$this->callAPISuccess($entityName, 'delete', array('id' => $baoObj2->id));
//make sure 1 less exists now
$result = $this->callAPISuccess($entityName, 'getcount', array(),
- ($createcount + $startCount) -1
+ ($createcount + $startCount) - 1
);
//make sure id #1 exists
if (in_array($entity, $entities)) {
$ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, $entity . 'Test.php');
}
- $actions = $this->callAPISuccess($entity, 'getactions', array());
+ $actions = $this->callAPISuccess($entity, 'getactions', array());
foreach ($actions['values'] as $action) {
if (substr($action, -7) == '_create' || substr($action, -4) == '_get' || substr($action, -7) == '_delete') {
//getactions can't distinguish between contribution_page.create & contribution_page.create
$baos = array();
$i = 0;
while($i < $count) {
- // create entities
+ // create entities
$baoObj = CRM_Core_DAO::createTestObject($baoString, array('currency' => 'USD'));
$this->assertTrue(is_integer($baoObj->id), 'check first id');
$this->deletableTestObjects[$baoString][] = $baoObj->id;
// Verify that chaining handles decoding
$chainResult = $this->callAPISuccess('Event', 'Get', array(
'id' => $eventId,
- 'api.event.get' => array(
- ),
+ 'api.event.get' => array(),
));
$this->assertEquals('CiviCRM <> TheRest', $chainResult['values'][$eventId]['title']);
$this->assertEquals('TheRest <> CiviCRM', $chainResult['values'][$eventId]['description']);
));
//$this->assertTrue((bool)$setValueDescriptionResult['is_error']); // not supported by setValue
$this->assertEquals('setValueDescription: TheRest <> CiviCRM', $setValueDescriptionResult['values']['description']);
-}
+ }
/**
* Verify that write operations (create/update) use partial HTML-encoding
/**
* Test APIv3 civicrm_tag_* functions
*
- * @package CiviCRM_APIv3
- * @subpackage API_Core
+ * @package CiviCRM_APIv3
+ * @subpackage API_Core
*/
class api_v3_TagTest extends CiviUnitTestCase {
- protected $_apiversion =3;
+ protected $_apiversion = 3;
/**
* @ids array of values to be cleaned up in the tear down
*/
* Test civicrm_tag_create with empty params.
*/
public function testCreateEmptyParams() {
- $result = $this->callAPIFailure('tag', 'create', array(),'Mandatory key(s) missing from params array: name');
+ $result = $this->callAPIFailure('tag', 'create', array(), 'Mandatory key(s) missing from params array: name');
}
/**
'pay_later_text' => 'I will pay later',
'pay_later_receipt' => "I will pay later",
'is_monetary' => TRUE,
- 'is_billing_required' => True
+ 'is_billing_required' => TRUE
);
$this->_priceSetParams = array(
'is_quick_config' => 0,
'is_reserved' => 0
);
- // Financial Account with 20% tax rate
+ // Financial Account with 20% tax rate
$financialAccountSetparams = array(
#[domain_id] =>
'name' => 'vat full taxrate account'.substr(sha1(rand()), 0, 7),
'is_reserved' => 0,
'is_active' => 1,
);
- $priceField = $this->callAPISuccess('financial_type','create', $financialType);
+ $priceField = $this->callAPISuccess('financial_type', 'create', $financialType);
$this->financialtypeID = $priceField['id'];
$financialRelationParams = array(
'entity_table' => 'civicrm_financial_type',
);
$halfFinancialType = CRM_Financial_BAO_FinancialType::add($halfFinancialtypeHalftax);
- $this->halfFinancialTypeId = $halfFinancialType->id ;
+ $this->halfFinancialTypeId = $halfFinancialType->id;
$financialRelationHalftax = array(
'entity_table' => 'civicrm_financial_type',
'entity_id' => $this->halfFinancialTypeId,
$halfFinancialRelation = CRM_Financial_BAO_FinancialTypeAccount::add($financialRelationHalftax);
// Enable component contribute setting
- $contributeSetting = array (
+ $contributeSetting = array(
'invoicing' => 1,
'invoice_prefix' => 'INV_',
'credit_notes_prefix' => 'CN_',
$this->_ids['contributionId'] = $contribution['id'];
$this->assertEquals($contribution['values'][$contribution['id']]['contact_id'], $this->_individualId, 'In line ' . __LINE__);
$this->assertEquals($contribution['values'][$contribution['id']]['total_amount'], 120.00, 'In line ' . __LINE__);
- $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'],$this->financialtypeID, 'In line ' . __LINE__ );
+ $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'], $this->financialtypeID, 'In line ' . __LINE__ );
$this->assertEquals($contribution['values'][$contribution['id']]['trxn_id'], 12345, 'In line ' . __LINE__);
$this->assertEquals($contribution['values'][$contribution['id']]['invoice_id'], 67890, 'In line ' . __LINE__);
$this->assertEquals($contribution['values'][$contribution['id']]['source'], 'SSF', 'In line ' . __LINE__);
$description = "Create Contribution with Nested Line Items";
$subfile = "CreateWithNestedLineItems";
- $contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__,__FILE__, $description, $subfile);
+ $contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__, $description, $subfile);
- $lineItems = $this->callAPISuccess('line_item','get',array(
+ $lineItems = $this->callAPISuccess('line_item', 'get', array(
'entity_id' => $contribution['id'],
'contribution_id' => $contribution['id'],
'entity_table' => 'civicrm_contribution',
$contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__);
$this->assertEquals($contribution['values'][$contribution['id']]['contact_id'], $this->_individualId, 'In line ' . __LINE__);
$this->assertEquals($contribution['values'][$contribution['id']]['total_amount'], 120.00, 'In line ' . __LINE__);
- $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'],$this->financialtypeID, 'In line ' . __LINE__ );
+ $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'], $this->financialtypeID, 'In line ' . __LINE__ );
$this->assertEquals($contribution['values'][$contribution['id']]['trxn_id'], 12345, 'In line ' . __LINE__);
$this->assertEquals($contribution['values'][$contribution['id']]['invoice_id'], 67890, 'In line ' . __LINE__);
$this->assertEquals($contribution['values'][$contribution['id']]['source'], 'SSF', 'In line ' . __LINE__);
$contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__);
$this->assertEquals($contribution['values'][$contribution['id']]['contact_id'], $this->_individualId, 'In line ' . __LINE__);
$this->assertEquals($contribution['values'][$contribution['id']]['total_amount'], 120.00, 'In line ' . __LINE__);
- $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'],$this->financialtypeID, 'In line ' . __LINE__ );
+ $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'], $this->financialtypeID, 'In line ' . __LINE__ );
$this->assertEquals($contribution['values'][$contribution['id']]['trxn_id'], 12345, 'In line ' . __LINE__);
$this->assertEquals($contribution['values'][$contribution['id']]['invoice_id'], 67890, 'In line ' . __LINE__);
$this->assertEquals($contribution['values'][$contribution['id']]['source'], 'SSF', 'In line ' . __LINE__);
'contribution_status_id' => 1,
);
$contribution = $this->callAPISuccess('contribution', 'create', $this->contributionParams);
- $lineItems = $this->callAPISuccess('line_item','getvalue', array(
+ $lineItems = $this->callAPISuccess('line_item', 'getvalue', array(
'entity_id' => $contribution['id'],
'entity_table' => 'civicrm_contribution',
'sequential' => 1,
);
$contribution = $this->callAPISuccess('contribution', 'update', $newParams);
- $lineItems = $this->callAPISuccess('line_item','getvalue',array(
+ $lineItems = $this->callAPISuccess('line_item', 'getvalue', array(
'entity_id' => $contribution['id'],
'entity_table' => 'civicrm_contribution',
'sequential' => 1,
* Test class for UFGroup API - civicrm_uf_*
* @todo Split UFGroup and UFJoin tests
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class api_v3_UFGroupTest extends CiviUnitTestCase {
// ids from the uf_group_test.xml fixture
protected $_ufFieldId;
protected $_contactId;
protected $_groupId;
- protected $_apiversion =3;
+ protected $_apiversion = 3;
protected $params;
protected function setUp() {
$ufGroup = $this->callAPISuccess('uf_group', 'create', array(
'group_type' => 'Contact',
'help_pre' => 'Profile to Test API',
- 'title' =>'Test Profile',
+ 'title' => 'Test Profile',
));
$this->_ufGroupId = $ufGroup['id'];
$ufMatch = $this->callAPISuccess('uf_match', 'create', array(
'name' => 'test_group',
'notify' => 'admin@example.org',
'post_URL' => 'http://example.org/post',
- 'title' => 'Test Group', );
+ 'title' => 'Test Group', );
$result = $this->callAPISuccess('uf_group', 'create', $params);
$params['created_date'] = date('YmdHis', strtotime($params['created_date']));
foreach ($params as $key => $value) {
* Test class for UFGroup API - civicrm_uf_*
* @todo Split UFGroup and UFJoin tests
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class api_v3_UFJoinTest extends CiviUnitTestCase {
// ids from the uf_group_test.xml fixture
'entity_id' => 1,
'weight' => 1,
'uf_group_id' => $this->_ufGroupId,
- 'is_active' => 1, );
+ 'is_active' => 1, );
$ufJoin = $this->callAPISuccess('uf_join', 'create', $params);
$searchParams = array(
'entity_table' => 'civicrm_contribution_page',
- 'entity_id' => 1, );
+ 'entity_id' => 1, );
$result = $this->callAPISuccess('uf_join', 'get', $searchParams);
foreach ($result['values'] as $key => $value) {
'entity_table' => 'civicrm_contribution_page',
'entity_id' => 1,
'weight' => 1,
- 'is_active' => 1, );
+ 'is_active' => 1, );
$result = $this->callAPIFailure('uf_join', 'create', $params);
$this->assertEquals($result['error_message'], 'Mandatory key(s) missing from params array: uf_group_id', 'In line ' . __LINE__);
}
'entity_id' => 1,
'weight' => 1,
'uf_group_id' => $this->_ufGroupId,
- 'is_active' => 1, 'sequential' => 1,
+ 'is_active' => 1,
+ 'sequential' => 1,
);
$ufJoin = $this->callAPIAndDocument('uf_join', 'create', $params, __FUNCTION__, __FILE__);
$this->assertEquals($ufJoin['values'][0]['module'], $params['module'], 'In line ' . __LINE__);
'entity_id' => 1,
'weight' => 1,
'uf_group_id' => $this->_ufGroupId,
- 'is_active' => 0, 'sequential' => 1,
+ 'is_active' => 0,
+ 'sequential' => 1,
);
$ufJoinUpdated = $this->callAPISuccess('uf_join', 'create', $params);
$this->assertEquals($ufJoinUpdated['values'][0]['module'], $params['module'], 'In line ' . __LINE__);
'entity_id' => 1,
'weight' => 1,
'uf_group_id' => $this->_ufGroupId,
- 'is_active' => 1, );
+ 'is_active' => 1, );
$ufJoin = $this->callAPISuccess('uf_join', 'create', $params);
$searchParams = array(
'entity_table' => 'civicrm_contribution_page',
- 'entity_id' => 1, 'sequential' => 1,
+ 'entity_id' => 1,
+ 'sequential' => 1,
);
$result = $this->callAPIAndDocument('uf_join', 'get', $searchParams, __FUNCTION__, __FILE__);
* Test class for UFGroup API - civicrm_uf_*
* @todo Split UFGroup and UFJoin tests
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class api_v3_UFMatchTest extends CiviUnitTestCase {
// ids from the uf_group_test.xml fixture
public function testDelete() {
$result = $this->callAPISuccess('uf_match', 'create', $this->_params);
- $this->assertEquals(1, $this->callAPISuccess('uf_match', 'getcount', array( 'id' => $result['id'],
+ $this->assertEquals(1, $this->callAPISuccess('uf_match', 'getcount', array(
+ 'id' => $result['id'],
)));
- $this->callAPISuccess('uf_match', 'delete', array( 'id' => $result['id'],
+ $this->callAPISuccess('uf_match', 'delete', array(
+ 'id' => $result['id'],
));
- $this->assertEquals(0, $this->callAPISuccess('uf_match', 'getcount', array('id' => $result['id'],
+ $this->assertEquals(0, $this->callAPISuccess('uf_match', 'getcount', array(
+ 'id' => $result['id'],
)));
}
}
$params = array(
'registration_start_date' => 20080601,
- 'registration_end_date' => '2008-10-15', 'start_date' => '2010-12-20', 'end_date' => '',
+ 'registration_end_date' => '2008-10-15',
+ 'start_date' => '2010-12-20',
+ 'end_date' => '',
);
$fields = civicrm_api3('Event', 'getfields', array('action' => 'create'));
_civicrm_api3_validate_fields('event', 'create', $params, $fields['values']);
/**
* Test APIv3 civicrm_website_* functions
*
- * @package CiviCRM_APIv3
- * @subpackage API_Contact
+ * @package CiviCRM_APIv3
+ * @subpackage API_Contact
*/
class api_v3_WebsiteTest extends CiviUnitTestCase {
*/
public function testGetMetadata() {
$result = $this->callAPIAndDocument($this->_entity, 'get', array(
- 'options' => array('metadata' => array('fields')
+ 'options' => array(
+ 'metadata' => array('fields')
)), __FUNCTION__, __FILE__, 'Demonostrates returning field metadata', 'GetWithMetadata');
$this->assertEquals('Website', $result['metadata']['fields']['url']['title']);
}
'is_domain' => 1,
'is_contact' => 0,
'description' => 'Test Key',
- 'title' => 'Test Key',
+ 'title' => 'Test Key',
'help_text' => '',
'html_type' => 'Text',
'quick_form_type' => 'Element',