Commit e6ff1593 authored by eileen's avatar eileen

CRM-13072 completely remove all references to the contributionCreate and...

CRM-13072 completely remove all references to the contributionCreate and contributionDelete functions that have caused a lot of problems for a long time & are currently causing tests to fail
parent b2042573
......@@ -42,11 +42,10 @@ class CRM_Contribute_BAO_ContributionPageTest extends CiviUnitTestCase {
function setUp() {
parent::setUp();
$this->_contributionTypeID = $this->contributionTypeCreate();
$this->_financialTypeID = 1;
}
function tearDown() {
$this->contributionTypeDelete();
}
/**
......@@ -57,7 +56,7 @@ class CRM_Contribute_BAO_ContributionPageTest extends CiviUnitTestCase {
$params = array(
'qfkey' => '9a3ef3c08879ad4c8c109b21c583400e',
'title' => 'Test Contribution Page',
'financial_type_id' => $this->_contributionTypeID,
'financial_type_id' => $this->_financialTypeID,
'intro_text' => '',
'footer_text' => 'Thanks',
'is_for_organization' => 0,
......@@ -88,7 +87,7 @@ class CRM_Contribute_BAO_ContributionPageTest extends CiviUnitTestCase {
$params = array(
'title' => 'Test Contribution Page',
'financial_type_id' => $this->_contributionTypeID,
'financial_type_id' => $this->_financialTypeID,
'is_active' => 1,
);
......@@ -107,7 +106,7 @@ class CRM_Contribute_BAO_ContributionPageTest extends CiviUnitTestCase {
$params = array(
'title' => 'Test Contribution Page',
'financial_type_id' => $this->_contributionTypeID,
'financial_type_id' => $this->_financialTypeID,
'is_active' => 1,
);
......@@ -118,7 +117,7 @@ class CRM_Contribute_BAO_ContributionPageTest extends CiviUnitTestCase {
$setValues = CRM_Contribute_BAO_ContributionPage::setValues($id, $values);
$this->assertEquals($params['title'], $values['title'], 'Verify contribution title.');
$this->assertEquals($this->_contributionTypeID, $values['financial_type_id'], 'Verify financial types id.');
$this->assertEquals($this->_financialTypeID, $values['financial_type_id'], 'Verify financial types id.');
$this->assertEquals(1, $values['is_active'], 'Verify contribution is_active value.');
ContributionPage::delete($contributionpage->id);
}
......@@ -130,7 +129,7 @@ class CRM_Contribute_BAO_ContributionPageTest extends CiviUnitTestCase {
$params = array(
'qfkey' => '9a3ef3c08879ad4c8c109b21c583400e',
'title' => 'Test Contribution Page',
'financial_type_id' => $this->_contributionTypeID,
'financial_type_id' => $this->_financialTypeID,
'intro_text' => '',
'footer_text' => 'Thanks',
'is_for_organization' => 0,
......@@ -149,7 +148,7 @@ class CRM_Contribute_BAO_ContributionPageTest extends CiviUnitTestCase {
$contributionpage = CRM_Contribute_BAO_ContributionPage::create($params);
$copycontributionpage = CRM_Contribute_BAO_ContributionPage::copy($contributionpage->id);
$this->assertEquals($copycontributionpage->financial_type_id, $this->_contributionTypeID, 'Check for Financial type id.');
$this->assertEquals($copycontributionpage->financial_type_id, $this->_financialTypeID, 'Check for Financial type id.');
$this->assertEquals($copycontributionpage->goal_amount, 400, 'Check for goal amount.');
ContributionPage::delete($contributionpage->id);
ContributionPage::delete($copycontributionpage->id);
......@@ -162,7 +161,7 @@ class CRM_Contribute_BAO_ContributionPageTest extends CiviUnitTestCase {
$paymentProcessor = PaypalPro::create();
$params = array(
'title' => 'Test Contribution Page',
'financial_type_id' => $this->_contributionTypeID,
'financial_type_id' => $this->_financialTypeID,
'is_active' => 1,
'payment_processor_id' => $paymentProcessor,
);
......
......@@ -40,11 +40,9 @@ class CRM_Contribute_BAO_ContributionTest extends CiviUnitTestCase {
function setUp() {
parent::setUp();
$this->contributionTypeCreate();
}
function teardown() {
$this->contributionTypeDelete();
}
/**
......@@ -115,7 +113,7 @@ class CRM_Contribute_BAO_ContributionTest extends CiviUnitTestCase {
$params = array(
'contact_id' => $contactId,
'currency' => 'USD',
'financial_type_id' => 1,
'financial_type_id' => 1,
'contribution_status_id' => 1,
'payment_instrument_id' => 1,
'source' => 'STUDENT',
......@@ -176,7 +174,7 @@ class CRM_Contribute_BAO_ContributionTest extends CiviUnitTestCase {
$params = array(
'contact_id' => $contactId,
'currency' => 'USD',
'financial_type_id' => 1,
'financial_type_id' => 1,
'contribution_status_id' => 1,
'payment_instrument_id' => 1,
'source' => 'STUDENT',
......@@ -235,7 +233,7 @@ class CRM_Contribute_BAO_ContributionTest extends CiviUnitTestCase {
$param = array(
'contact_id' => $contactId,
'currency' => 'USD',
'financial_type_id' => 4,
'financial_type_id' => 4,
'contribution_status_id' => 1,
'receive_date' => date('Ymd'),
'total_amount' => 66,
......@@ -298,7 +296,7 @@ class CRM_Contribute_BAO_ContributionTest extends CiviUnitTestCase {
$param = array(
'contact_id' => $contactId,
'currency' => 'USD',
'financial_type_id' => 1,
'financial_type_id' => 1,
'contribution_status_id' => 1,
'payment_instrument_id' => 1,
'source' => 'STUDENT',
......@@ -362,7 +360,7 @@ class CRM_Contribute_BAO_ContributionTest extends CiviUnitTestCase {
$param = array(
'contact_id' => $contactId,
'currency' => 'USD',
'financial_type_id' => 1,
'financial_type_id' => 1,
'contribution_status_id' => 1,
'payment_instrument_id' => 1,
'source' => 'STUDENT',
......@@ -418,7 +416,7 @@ class CRM_Contribute_BAO_ContributionTest extends CiviUnitTestCase {
$param = array(
'contact_id' => $contactId,
'currency' => 'USD',
'financial_type_id' => 1,
'financial_type_id' => 1,
'contribution_status_id' => 1,
'payment_instrument_id' => 1,
'source' => 'STUDENT',
......
......@@ -44,10 +44,10 @@ class CRM_Core_BAO_FinancialTrxnTest extends CiviUnitTestCase {
*/
function testCreate() {
$contactId = $this->individualCreate();
$contributionTypeId = $this->contributionTypeCreate();
$contributionId = $this->contributionCreate($contactId, $contributionTypeId);
$financialTypeId = 1;
$contributionId = $this->contributionCreate($contactId, $financialTypeId);
$params = array(
'contribution_id' => $contributionTypeId,
'contribution_id' => $financialTypeId,
'to_financial_account_id' => 1,
'trxn_date' => 20091021184930,
'trxn_type' => 'Debit',
......
......@@ -54,7 +54,7 @@ class CRM_Core_Payment_AuthorizeNetTest extends CiviUnitTestCase {
);
$this->processor = new CRM_Core_Payment_AuthorizeNet('Contribute', $paymentProcessor);
$this->_contributionTypeId = $this->contributionTypeCreate();
$this->_financialTypeId = 1;
// 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
......@@ -63,7 +63,7 @@ class CRM_Core_Payment_AuthorizeNetTest extends CiviUnitTestCase {
function tearDown() {
$this->paymentProcessor->delete($this->processorParams->id);
$tablesToTruncate = array( 'civicrm_financial_type', 'civicrm_contribution', 'civicrm_contribution_recur', 'civicrm_line_item' );
$tablesToTruncate = array('civicrm_contribution', 'civicrm_contribution_recur', 'civicrm_line_item' );
$this->quickCleanup($tablesToTruncate);
}
......@@ -78,7 +78,6 @@ class CRM_Core_Payment_AuthorizeNetTest extends CiviUnitTestCase {
$nameParams = array('first_name' => $firstName, 'last_name' => $lastName);
$contactId = Contact::createIndividual($nameParams);
$ids = array('contribution' => NULL);
$invoiceID = sha1(rand());
$amount = rand(100, 1000) . '.00';
......@@ -100,7 +99,7 @@ class CRM_Core_Payment_AuthorizeNetTest extends CiviUnitTestCase {
$contributionParams = array(
'contact_id' => $contactId,
'financial_type_id' => $this->_contributionTypeId,
'financial_type_id' => $this->_financialTypeId,
'receive_date' => date('Ymd'),
'total_amount' => $amount,
'invoice_id' => $invoiceID,
......@@ -133,7 +132,7 @@ class CRM_Core_Payment_AuthorizeNetTest extends CiviUnitTestCase {
'frequency_interval' => 1,
'frequency_unit' => 'month',
'installments' => 12,
'financial_type_id' => $this->_contributionTypeId,
'financial_type_id' => $this->_financialTypeId,
'is_email_receipt' => 1,
'from_email_address' => "{$firstName}.{$lastName}@example.com",
'receive_date' => date('Ymd'),
......@@ -179,7 +178,7 @@ class CRM_Core_Payment_AuthorizeNetTest extends CiviUnitTestCase {
'email' => "{$firstName}.{$lastName}@example.com",
'contactID' => $contactId,
'contributionID' => $contribution->id,
'contributionTypeID' => $this->_contributionTypeId,
'contributionTypeID' => $this->_financialTypeId,
'contributionRecurID' => $recur->id,
);
......@@ -235,7 +234,7 @@ class CRM_Core_Payment_AuthorizeNetTest extends CiviUnitTestCase {
$contributionParams = array(
'contact_id' => $contactId,
'financial_type_id' => $this->_contributionTypeId,
'financial_type_id' => $this->_financialTypeId,
'receive_date' => $start_date,
'total_amount' => $amount,
'invoice_id' => $invoiceID,
......@@ -244,7 +243,8 @@ class CRM_Core_Payment_AuthorizeNetTest extends CiviUnitTestCase {
'is_test' => 1,
'contribution_status_id' => 2,
);
$contribution = CRM_Contribute_BAO_Contribution::add($contributionParams, $ids);
$this->callAPISuccess('contribution', 'create', $contributionParams);
$params = array(
'qfKey' => '00ed21c7ca00a1f7d555555596ef7_4454',
......@@ -268,7 +268,7 @@ class CRM_Core_Payment_AuthorizeNetTest extends CiviUnitTestCase {
'frequency_interval' => 1,
'frequency_unit' => 'month',
'installments' => 3,
'financial_type_id' => $this->_contributionTypeId,
'financial_type_id' => $this->_financialTypeId,
'is_email_receipt' => 1,
'from_email_address' => "{$firstName}.{$lastName}@example.com",
'receive_date' => $start_date,
......@@ -315,7 +315,7 @@ class CRM_Core_Payment_AuthorizeNetTest extends CiviUnitTestCase {
'email' => "{$firstName}.{$lastName}@example.com",
'contactID' => $contactId,
'contributionID' => $contribution->id,
'contributionTypeID' => $this->_contributionTypeId,
'contributionTypeID' => $this->_financialTypeId,
'contributionRecurID' => $recur->id,
);
......
......@@ -53,7 +53,7 @@ class CRM_Member_BAO_MembershipLogTest extends CiviUnitTestCase {
);
$this->_relationshipTypeId = $this->relationshipTypeCreate($params);
$this->_orgContactID = $this->organizationCreate();
$this->_contributionTypeId = $this->contributionTypeCreate();
$this->_financialTypeId = 1;
$params = array(
'name' => 'test type',
......@@ -63,7 +63,7 @@ class CRM_Member_BAO_MembershipLogTest extends CiviUnitTestCase {
'member_of_contact_id' => $this->_orgContactID,
'period_type' => 'fixed',
'duration_interval' => 1,
'financial_type_id' => $this->_contributionTypeId,
'financial_type_id' => $this->_financialTypeId,
'relationship_type_id' => $this->_relationshipTypeId,
'visibility' => 'Public',
'is_active' => 1,
......@@ -82,7 +82,6 @@ class CRM_Member_BAO_MembershipLogTest extends CiviUnitTestCase {
$this->relationshipTypeDelete($this->_relationshipTypeId);
$this->membershipTypeDelete(array('id' => $this->_membershipTypeID));
$this->membershipStatusDelete($this->_mebershipStatusID);
$this->contributionTypeDelete(NULL);
$this->contactDelete($this->_orgContactID);
}
......
......@@ -51,7 +51,7 @@ class CRM_Member_BAO_MembershipTypeTest extends CiviUnitTestCase {
$this->_relationshipTypeId = $this->relationshipTypeCreate($params);
$this->_orgContactID = $this->organizationCreate();
$this->_indiviContactID = $this->individualCreate();
$this->_contributionTypeId = $this->contributionTypeCreate();
$this->_financialTypeId = 1;
$this->_membershipStatusID = $this->membershipStatusCreate('test status');
}
......@@ -63,7 +63,6 @@ class CRM_Member_BAO_MembershipTypeTest extends CiviUnitTestCase {
function tearDown() {
$this->relationshipTypeDelete($this->_relationshipTypeId);
$this->membershipStatusDelete($this->_membershipStatusID);
$this->contributionTypeDelete();
$this->contactDelete($this->_orgContactID);
$this->contactDelete($this->_indiviContactID);
}
......@@ -82,7 +81,7 @@ class CRM_Member_BAO_MembershipTypeTest extends CiviUnitTestCase {
'member_of_contact_id' => $this->_orgContactID,
'period_type' => 'fixed',
'duration_interval' => 1,
'financial_type_id' => $this->_contributionTypeId,
'financial_type_id' => $this->_financialTypeId,
'relationship_type_id' => $this->_relationshipTypeId,
'visibility' => 'Public',
);
......@@ -112,7 +111,7 @@ class CRM_Member_BAO_MembershipTypeTest extends CiviUnitTestCase {
'period_type' => 'fixed',
'member_of_contact_id' => $this->_orgContactID,
'duration_interval' => 1,
'financial_type_id' => $this->_contributionTypeId,
'financial_type_id' => $this->_financialTypeId,
'relationship_type_id' => $this->_relationshipTypeId,
'visibility' => 'Public',
);
......@@ -139,7 +138,7 @@ class CRM_Member_BAO_MembershipTypeTest extends CiviUnitTestCase {
'period_type' => 'fixed',
'duration_interval' => 1,
'member_of_contact_id' => $this->_orgContactID,
'financial_type_id' => $this->_contributionTypeId,
'financial_type_id' => $this->_financialTypeId,
'relationship_type_id' => $this->_relationshipTypeId,
'visibility' => 'Public',
'is_active' => 1,
......@@ -171,7 +170,7 @@ class CRM_Member_BAO_MembershipTypeTest extends CiviUnitTestCase {
'period_type' => 'fixed',
'member_of_contact_id' => $this->_orgContactID,
'duration_interval' => 1,
'financial_type_id' => $this->_contributionTypeId,
'financial_type_id' => $this->_financialTypeId,
'relationship_type_id' => $this->_relationshipTypeId,
'visibility' => 'Public',
'is_active' => 1,
......@@ -199,7 +198,7 @@ class CRM_Member_BAO_MembershipTypeTest extends CiviUnitTestCase {
'fixed_period_start_day' => 1213,
'fixed_period_rollover_day' => 1214,
'duration_interval' => 1,
'financial_type_id' => $this->_contributionTypeId,
'financial_type_id' => $this->_financialTypeId,
'relationship_type_id' => $this->_relationshipTypeId,
'visibility' => 'Public',
'is_active' => 1,
......@@ -227,7 +226,7 @@ class CRM_Member_BAO_MembershipTypeTest extends CiviUnitTestCase {
'member_of_contact_id' => $this->_orgContactID,
'period_type' => 'fixed',
'duration_interval' => 1,
'financial_type_id' => $this->_contributionTypeId,
'financial_type_id' => $this->_financialTypeId,
'relationship_type_id' => $this->_relationshipTypeId,
'visibility' => 'Public',
'is_active' => 1,
......@@ -252,7 +251,7 @@ class CRM_Member_BAO_MembershipTypeTest extends CiviUnitTestCase {
'period_type' => 'fixed',
'member_of_contact_id' => $this->_orgContactID,
'duration_interval' => 1,
'financial_type_id' => $this->_contributionTypeId,
'financial_type_id' => $this->_financialTypeId,
'relationship_type_id' => $this->_relationshipTypeId,
'visibility' => 'Public',
'is_active' => 1,
......@@ -279,7 +278,7 @@ class CRM_Member_BAO_MembershipTypeTest extends CiviUnitTestCase {
'member_of_contact_id' => $this->_orgContactID,
'period_type' => 'rolling',
'duration_interval' => 1,
'financial_type_id' => $this->_contributionTypeId,
'financial_type_id' => $this->_financialTypeId,
'relationship_type_id' => $this->_relationshipTypeId,
'visibility' => 'Public',
'is_active' => 1,
......@@ -305,7 +304,7 @@ class CRM_Member_BAO_MembershipTypeTest extends CiviUnitTestCase {
'member_of_contact_id' => $this->_orgContactID,
'period_type' => 'rolling',
'duration_interval' => 1,
'financial_type_id' => $this->_contributionTypeId,
'financial_type_id' => $this->_financialTypeId,
'relationship_type_id' => $this->_relationshipTypeId,
'visibility' => 'Public',
'is_active' => 1,
......@@ -348,7 +347,7 @@ class CRM_Member_BAO_MembershipTypeTest extends CiviUnitTestCase {
'member_of_contact_id' => $this->_orgContactID,
'period_type' => 'rolling',
'duration_interval' => 1,
'financial_type_id' => $this->_contributionTypeId,
'financial_type_id' => $this->_financialTypeId,
'relationship_type_id' => $this->_relationshipTypeId,
'visibility' => 'Public',
'is_active' => 1,
......
......@@ -70,7 +70,7 @@ class CRM_Member_Import_Parser_MembershipTest extends CiviUnitTestCase {
);
$this->_relationshipTypeId = $this->relationshipTypeCreate($params);
$this->_orgContactID = $this->organizationCreate();
$this->_contributionTypeId = $this->contributionTypeCreate();
$this->_financialTypeId = 1;
$this->_membershipTypeName = 'Mickey Mouse Club Member';
$params = array(
'name' => $this->_membershipTypeName,
......@@ -80,7 +80,7 @@ class CRM_Member_Import_Parser_MembershipTest extends CiviUnitTestCase {
'member_of_contact_id' => $this->_orgContactID,
'period_type' => 'fixed',
'duration_interval' => 1,
'financial_type_id' => $this->_contributionTypeId,
'financial_type_id' => $this->_financialTypeId,
'relationship_type_id' => $this->_relationshipTypeId,
'visibility' => 'Public',
'is_active' => 1,
......@@ -106,7 +106,6 @@ class CRM_Member_Import_Parser_MembershipTest extends CiviUnitTestCase {
$this->relationshipTypeDelete($this->_relationshipTypeId);
$this->membershipTypeDelete(array('id' => $this->_membershipTypeID));
$this->membershipStatusDelete($this->_mebershipStatusID);
$this->contributionTypeDelete(NULL);
$this->contactDelete($this->_orgContactID);
}
......
......@@ -26,7 +26,6 @@ class CRM_Utils_DeprecatedUtilsTest extends CiviUnitTestCase {
);
$this->quickCleanup($tablesToTruncate);
$this->contributionTypeDelete();
}
/**
* Test civicrm_contact_check_params with no contact type
......
......@@ -1156,60 +1156,6 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
return $contributionPage;
}
/**
* Function to create Financial Type
*
* @return int $id of financial account created
*/
function contributionTypeCreate() {
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn,
new PHPUnit_Extensions_Database_DataSet_XMLDataSet(
dirname(__FILE__) . '/../api/v' . API_LATEST_VERSION . '/dataset/financial_types.xml'
)
);
$financialType = CRM_Contribute_PseudoConstant::financialType();
CRM_Contribute_PseudoConstant::flush('financialType');
return key($financialType);
}
/**
* Function to delete financial Types
* @param int $contributionTypeId
*/
function contributionTypeDelete($contributionTypeID = NULL) {
if ($contributionTypeID === NULL) {
$this->callAPISuccess('Contribution', 'get',
array(
'financial_type_id' => 10,
'api.contribution.delete' => 1,
)
);
$this->callAPISuccess('Contribution', 'get',
array(
'financial_type_id' => 11,
'api.contribution.delete' => 1,
)
);
// we know those were loaded from /dataset/financial_types.xml
$del = CRM_Financial_BAO_FinancialType::del(10, 1);
$del = CRM_Financial_BAO_FinancialType::del(11, 1);
}
else {
$this->callAPISuccess('Contribution', 'get', array(
'financial_type_id' => $contributionTypeID,
'api.contribution.delete' => 1
));
$del = CRM_Financial_BAO_FinancialType::del($contributionTypeID, 1);
}
if (is_array($del)) {
$this->assertEquals(0, CRM_Utils_Array::value('is_error', $del), $del['error_message']);
}
}
/**
* Function to create Tag
*
......
......@@ -36,7 +36,7 @@ require_once 'CiviTest/CiviUnitTestCase.php';
*/
class api_v3_ImTest extends CiviUnitTestCase {
protected $_apiversion;
protected $_apiversion = 3;
protected $params;
protected $id;
protected $_entity;
......@@ -47,10 +47,8 @@ class api_v3_ImTest extends CiviUnitTestCase {
parent::setUp();
$this->_entity = 'im';
$this->_apiversion = 3;
$this->_contactID = $this->organizationCreate();
$this->params = array(
'version' => 3,
'contact_id' => $this->_contactID,
'name' => 'My Yahoo IM Handle',
'location_type_id' => 1,
......@@ -66,41 +64,32 @@ class api_v3_ImTest extends CiviUnitTestCase {
}
public function testCreateIm() {
$result = civicrm_api($this->_entity, 'create', $this->params);
$this->documentMe($this->params, $result, __FUNCTION__, __FILE__);
$this->assertAPISuccess($result, 'In line ' . __LINE__);
$result = $this->callAPIAndDocument($this->_entity, 'create', $this->params, __FUNCTION__, __FILE__);
$this->assertEquals(1, $result['count'], 'In line ' . __LINE__);
$this->getAndCheck($this->params, $result['id'], $this->_entity);
$this->assertNotNull($result['values'][$result['id']]['id'], 'In line ' . __LINE__);
}
public function testGetIm() {
$result = civicrm_api($this->_entity, 'create', $this->params);
$result = civicrm_api($this->_entity, 'get', $this->params);
$this->documentMe($this->params, $result, __FUNCTION__, __FILE__);
$this->assertAPISuccess($result, 'In line ' . __LINE__);
$result = $this->callAPISuccess($this->_entity, 'create', $this->params);
$result = $this->callAPIAndDocument($this->_entity, 'get', $this->params, __FUNCTION__, __FILE__);
$this->assertEquals(1, $result['count'], 'In line ' . __LINE__);
$this->assertNotNull($result['values'][$result['id']]['id'], 'In line ' . __LINE__);
civicrm_api($this->_entity, 'delete', array('version' => 3, 'id' => $result['id']));
$this->callAPISuccess($this->_entity, 'delete', array('id' => $result['id']));
}
public function testDeleteIm() {
$result = civicrm_api($this->_entity, 'create', $this->params);
$this->assertAPISuccess($result, 'in line ' . __LINE__);
$deleteParams = array('version' => 3, 'id' => $result['id']);
$result = civicrm_api($this->_entity, 'delete', $deleteParams);
$this->documentMe($deleteParams, $result, __FUNCTION__, __FILE__);
$this->assertAPISuccess($result, 'In line ' . __LINE__);
$checkDeleted = civicrm_api($this->_entity, 'get', array('version' => 3));
$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());
$this->assertEquals(0, $checkDeleted['count'], 'In line ' . __LINE__);
}
public function testDeleteImInvalid() {
$result = civicrm_api($this->_entity, 'create', $this->params);
$this->assertAPISuccess($result, 'in line ' . __LINE__);
$deleteParams = array('version' => 3, 'id' => 600);
$result = civicrm_api($this->_entity, 'delete', $deleteParams);
$this->assertEquals(1,$result['is_error'], 'In line ' . __LINE__);
$checkDeleted = civicrm_api($this->_entity, 'get', array('version' => 3));
$result = $this->callAPISuccess($this->_entity, 'create', $this->params);
$deleteParams = array('id' => 600);
$result = $this->callAPIFailure($this->_entity, 'delete', $deleteParams);
$checkDeleted = $this->callAPISuccess($this->_entity, 'get', array());
$this->assertEquals(1, $checkDeleted['count'], 'In line ' . __LINE__);
}
}
......@@ -678,7 +678,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
* Test creation of a participant with an associated contribution
*/
function testCreateParticipantWithPayment() {
$this->_contributionTypeId = $this->contributionTypeCreate();
$this->_financialTypeId = 1;
$description = "single function to create contact w partipation & contribution. Note that in the
case of 'contribution' the 'create' is implied (api.contribution.create)";
$subfile = "CreateParticipantPayment";
......
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.3 |
......@@ -40,7 +39,7 @@ class api_v3_UFFieldTest extends CiviUnitTestCase {
protected $_ufGroupId = 11;
protected $_ufFieldId;
protected $_contactId = 69;
protected $_apiversion;
protected $_apiversion = 3;
protected $_params;
protected $_entity = 'uf_field';
public $_eNoticeCompliant = TRUE;
......@@ -58,7 +57,6 @@ class api_v3_UFFieldTest extends CiviUnitTestCase {
)
);
$this->_apiversion = 3;
$op = new PHPUnit_Extensions_Database_Operation_Insert;
$op->execute(
$this->_dbconn,
......@@ -66,7 +64,7 @@ class api_v3_UFFieldTest extends CiviUnitTestCase {
);
$this->_sethtmlGlobals();
civicrm_api('uf_field', 'getfields', array('version' => 3, 'cache_clear' => 1));
$this->callAPISuccess('uf_field', 'getfields', array('cache_clear' => 1));
$this->_params = array(
'field_name' => 'phone',
......@@ -78,7 +76,6 @@ class api_v3_UFFieldTest extends CiviUnitTestCase {
'is_active' => 1,
'location_type_id' => 1,
'phone_type_id' => 1,
'version' => $this->_apiversion,
'uf_group_id' => $this->_ufGroupId,
);
}
......@@ -100,11 +97,8 @@ class api_v3_UFFieldTest extends CiviUnitTestCase {
*/
public function testCreateUFField() {
$params = $this->_params; // copy
$ufField = civicrm_api('uf_field', 'create', $params);
$this->documentMe($params, $ufField, __FUNCTION__, __FILE__);
unset($params['version']);
$ufField = $this->callAPIAndDocument('uf_field', 'create', $params, __FUNCTION__, __FILE__);
unset($params['uf_group_id']);
$this->assertAPISuccess($ufField, " in line " . __LINE__);
$this->_ufFieldId = $ufField['id'];
foreach ($params as $key => $value) {
$this->assertEquals($ufField['values'][$ufField['id']][$key], $params[$key]);
......@@ -199,15 +193,12 @@ class api_v3_UFFieldTest extends CiviUnitTestCase {
);
$params = array(
'version' => $this->_apiversion,
'uf_group_id' => $this->_ufGroupId,
'option.autoweight' => FALSE,
'values' => $baseFields,
);
$result = civicrm_api('uf_field', 'replace', $params);
$this->assertAPISuccess($result);
$this->documentMe($params, $result, __FUNCTION__, __FILE__);
$result = $this->callAPIAndDocument('uf_field', 'replace', $params, __FUNCTION__, __FILE__);
$inputsByName = CRM_Utils_Array::index(array('field_name'), $params['values']);
$this->assertEquals(count($params['values']), count($result['values']));
foreach ($result['values'] as $outUfField) {
......
......@@ -134,17 +134,13 @@ class api_v3_UFJoinTest extends CiviUnitTestCase {
'entity_id' => 1,
'weight' => 1,
'uf_group_id' => $this->_ufGroupId,
'is_active' => 1,
'version' => $this->_apiversion,
);
$ufJoin = civicrm_api('uf_join', 'create', $params);
'is_active' => 1, );
$ufJoin = $this->callAPISuccess('uf_join', 'create', $params);
$searchParams = array(
'entity_table' => 'civicrm_contribution_page',
'entity_id' => 1,
'version' => $this->_apiversion,
);
$result = civicrm_api('uf_join', 'get', $searchParams);
'entity_id' => 1, );
$result = $this->callAPISuccess('uf_join', 'get', $searchParams);
foreach ($result['values'] as $key => $value) {
$this->assertEquals($value['uf_group_id'], $this->_ufGroupId, 'In line ' . __LINE__);
......@@ -170,9 +166,7 @@ class api_v3_UFJoinTest extends CiviUnitTestCase {
'entity_table' => 'civicrm_contribution_page',
'entity_id' => 1,
'weight' => 1,
'is_active' => 1,
'version' => $this->_apiversion,
);
'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__);
}
......@@ -187,12 +181,9 @@ class api_v3_UFJoinTest extends CiviUnitTestCase {
'entity_id' => 1,
'weight' => 1,
'uf_group_id' => $this->_ufGroupId,
'is_active' => 1,
'version' => $this->_apiversion,
'sequential' => 1,
'is_active' => 1, 'sequential' => 1,
);
$ufJoin = civicrm_api('uf_join', 'create', $params);
$this->documentMe($params, $ufJoin, __FUNCTION__, __FILE__);
$ufJoin = $this->callAPIAndDocument('uf_join', 'create', $params, __FUNCTION__, __FILE__);
$this->assertEquals($ufJoin['values'][0]['module'], $params['module'], 'In line ' . __LINE__);
$this->assertEquals($ufJoin['values'][0]['uf_group_id'], $params['uf_group_id'], 'In line ' . __LINE__);
$this->assertEquals($ufJoin['values'][0]['is_active'], $params['is_active'], 'In line ' . __LINE__);
......@@ -204,11 +195,9 @@ class api_v3_UFJoinTest extends CiviUnitTestCase {
'entity_id' => 1,
'weight' => 1,
'uf_group_id' => $this->_ufGroupId,
'is_active' => 0,
'version' => $this->_apiversion,
'sequential' => 1,
'is_active' => 0, 'sequential' => 1,
);
$ufJoinUpdated = civicrm_api('uf_join', 'create', $params);
$ufJoinUpdated = $this->callAPISuccess('uf_join', 'create', $params);
$this->assertEquals($ufJoinUpdated['values'][0]['module'], $params['module'], 'In line ' . __LINE__);
$this->assertEquals($ufJoinUpdated['values'][0]['uf_group_id'], $params['uf_group_id'], 'In line ' . __LINE__);
$this->assertEquals($ufJoinUpdated['values'][0]['is_active'], $params['is_active'], 'In line ' . __LINE__);
......@@ -248,20 +237,15 @@ class api_v3_UFJoinTest extends CiviUnitTestCase {
'entity_id' => 1,
'weight' => 1,
'uf_group_id' => $this->_ufGroupId,
'is_active' => 1,
'version' => $this->_apiversion,
);
'is_active' => 1, );
$ufJoin = civicrm_api('uf_join', 'create', $params);
$ufJoin = $this->callAPISuccess('uf_join', 'create', $params);
$searchParams = array(
'entity_table' => 'civicrm_contribution_page',
'entity_id' => 1,
'version' => $this->_apiversion,
'sequential' => 1,
'entity_id' => 1, 'sequential' => 1,
);
$result = civicrm_api('uf_join', 'get', $searchParams);
$this->documentMe($searchParams, $result, __FUNCTION__, __FILE__);
$result = $this->callAPIAndDocument('uf_join', 'get', $searchParams, __FUNCTION__, __FILE__);
$this->assertEquals($result['values'][0]['module'], $params['module'], 'In line ' . __LINE__);
$this->assertEquals($result['values'][0]['uf_group_id'], $params['uf_group_id'], 'In line ' . __LINE__);
$this->assertEquals($result['values'][0]['entity_id'], $params['entity_id'], 'In line ' . __LINE__);
......
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.3 |