summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
ef2f892)
We have a test ensuring period_type is mandatory at the api level. However, it isn't for api
v4 - the error is a different issue (handling of pseudoconstants when mapping v3 to v4). This
fixes that separate issue & declares required to re-fix for v4
*
* Generated from xml/schema/CRM/Core/CustomField.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
*
* Generated from xml/schema/CRM/Core/CustomField.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:1acb9b3538bd3005b99e6af6d9ec062f)
+ * (GenCodeChecksum:4ded3c0d1a8e34502a5957ee74c4480a)
*
* Generated from xml/schema/CRM/Member/MembershipType.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
*
* Generated from xml/schema/CRM/Member/MembershipType.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:713057d2c1a6dcb6cbd6449b8934d28c)
+ * (GenCodeChecksum:7c5220444512f1aa499454e977f27814)
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Membership Type Plan'),
'description' => ts('Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day.'),
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Membership Type Plan'),
'description' => ts('Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day.'),
'maxlength' => 8,
'size' => CRM_Utils_Type::EIGHT,
'where' => 'civicrm_membership_type.period_type',
'maxlength' => 8,
'size' => CRM_Utils_Type::EIGHT,
'where' => 'civicrm_membership_type.period_type',
{* Remove Country & State special select fields *}
UPDATE civicrm_custom_field SET html_type = 'Select'
WHERE html_type IN ('Select Country', 'Select State/Province');
{* Remove Country & State special select fields *}
UPDATE civicrm_custom_field SET html_type = 'Select'
WHERE html_type IN ('Select Country', 'Select State/Province');
+
+{* make period_type required - it already is so the update is precautionary *}
+UPDATE civicrm_membership_type SET period_type = 'rolling' WHERE period_type IS NULL;
+ALTER TABLE civicrm_membership_type MODIFY `period_type` varchar(8) NOT NULL COMMENT 'Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day.'
+
$v3Params['option_group.name'] = $v3Params['option_group_id'];
unset($v3Params['option_group_id']);
}
$v3Params['option_group.name'] = $v3Params['option_group_id'];
unset($v3Params['option_group_id']);
}
+ if (isset($field['pseudoconstant'], $v3Params[$name]) && $field['type'] === \CRM_Utils_Type::T_INT && !is_numeric($v3Params[$name])) {
+ $v3Params[$name] = \CRM_Core_PseudoConstant::getKey(\CRM_Core_DAO_AllCoreTables::getFullName($v3Entity), $name, $v3Params[$name]);
+ }
* @return mixed
* @throws \CRM_Core_Exception
*/
* @return mixed
* @throws \CRM_Core_Exception
*/
- public function paymentProcessorTypeCreate($params = NULL) {
- if (is_null($params)) {
- $params = [
- 'name' => 'API_Test_PP',
- 'title' => 'API Test Payment Processor',
- 'class_name' => 'CRM_Core_Payment_APITest',
- 'billing_mode' => 'form',
- 'is_recur' => 0,
- 'is_reserved' => 1,
- 'is_active' => 1,
- ];
- }
- $result = $this->callAPISuccess('payment_processor_type', 'create', $params);
+ public function paymentProcessorTypeCreate($params = []) {
+ $params = array_merge([
+ 'name' => 'API_Test_PP',
+ 'title' => 'API Test Payment Processor',
+ 'class_name' => 'CRM_Core_Payment_APITest',
+ 'billing_mode' => 'form',
+ 'is_recur' => 0,
+ 'is_reserved' => 1,
+ 'is_active' => 1,
+ ], $params);
+ $result = $this->callAPISuccess('PaymentProcessorType', 'create', $params);
CRM_Core_PseudoConstant::flush('paymentProcessorType');
CRM_Core_PseudoConstant::flush('paymentProcessorType');
*
* @param bool $version
*/
*
* @param bool $version
*/
- public function testMemberTypePeriodiTypeRequired($version) {
+ public function testMemberTypePeriodTypeRequired($version) {
$this->_apiversion = $version;
$this->callAPIFailure('MembershipType', 'create', [
'domain_id' => 'Default Domain Name',
$this->_apiversion = $version;
$this->callAPIFailure('MembershipType', 'create', [
'domain_id' => 'Default Domain Name',
/**
* Create payment processor type.
/**
* Create payment processor type.
* @dataProvider versionThreeAndFour
* @dataProvider versionThreeAndFour
+ *
+ * @param int $version
*/
public function testPaymentProcessorTypeCreate($version) {
$this->_apiversion = $version;
*/
public function testPaymentProcessorTypeCreate($version) {
$this->_apiversion = $version;
'billing_mode' => 'form',
'is_recur' => 0,
];
'billing_mode' => 'form',
'is_recur' => 0,
];
- $result = $this->callAPIAndDocument('payment_processor_type', 'create', $params, __FUNCTION__, __FILE__);
+ $result = $this->callAPIAndDocument('PaymentProcessorType', 'create', $params, __FUNCTION__, __FILE__);
$this->assertNotNull($result['values'][0]['id']);
// mutate $params to match expected return value
$this->assertNotNull($result['values'][0]['id']);
// mutate $params to match expected return value
/**
* Check with empty array.
/**
* Check with empty array.
* @dataProvider versionThreeAndFour
* @dataProvider versionThreeAndFour
+ *
+ * @param int $version
*/
public function testPaymentProcessorTypeDeleteEmpty($version) {
$this->_apiversion = $version;
*/
public function testPaymentProcessorTypeDeleteEmpty($version) {
$this->_apiversion = $version;
- $params = [];
- $result = $this->callAPIFailure('payment_processor_type', 'delete', $params);
+ $this->callAPIFailure('PaymentProcessorType', 'delete', []);
}
/**
* Check if required fields are not passed.
}
/**
* Check if required fields are not passed.
* @dataProvider versionThreeAndFour
* @dataProvider versionThreeAndFour
+ *
+ * @param int $version
*/
public function testPaymentProcessorTypeDeleteWithoutRequired($version) {
$this->_apiversion = $version;
*/
public function testPaymentProcessorTypeDeleteWithoutRequired($version) {
$this->_apiversion = $version;
/**
* Check with incorrect required fields.
/**
* Check with incorrect required fields.
* @dataProvider versionThreeAndFour
* @dataProvider versionThreeAndFour
+ *
+ * @param int $version
*/
public function testPaymentProcessorTypeDeleteWithIncorrectData($version) {
$this->_apiversion = $version;
*/
public function testPaymentProcessorTypeDeleteWithIncorrectData($version) {
$this->_apiversion = $version;
- $result = $this->callAPIFailure('payment_processor_type', 'delete', ['id' => 'abcd']);
+ $this->callAPIFailure('payment_processor_type', 'delete', ['id' => 'abcd']);
}
/**
* Check payment processor type delete.
}
/**
* Check payment processor type delete.
* @dataProvider versionThreeAndFour
* @dataProvider versionThreeAndFour
+ *
+ * @param $version
+ *
+ * @throws \CRM_Core_Exception
*/
public function testPaymentProcessorTypeDelete($version) {
$this->_apiversion = $version;
*/
public function testPaymentProcessorTypeDelete($version) {
$this->_apiversion = $version;
- $payProcType = $this->paymentProcessorTypeCreate();
- $params = [
- 'id' => $payProcType,
- ];
-
- $result = $this->callAPIAndDocument('payment_processor_type', 'delete', $params, __FUNCTION__, __FILE__);
+ $this->callAPIAndDocument('PaymentProcessorType', 'delete', ['id' => $this->paymentProcessorTypeCreate()], __FUNCTION__, __FILE__);
}
///////////////// civicrm_payment_processor_type_update
/**
* Check with empty array.
}
///////////////// civicrm_payment_processor_type_update
/**
* Check with empty array.
* @dataProvider versionThreeAndFour
* @dataProvider versionThreeAndFour
+ *
+ * @param int $version
*/
public function testPaymentProcessorTypeUpdateEmpty($version) {
$this->_apiversion = $version;
$params = [];
*/
public function testPaymentProcessorTypeUpdateEmpty($version) {
$this->_apiversion = $version;
$params = [];
- $result = $this->callAPIFailure('payment_processor_type', 'create', $params);
+ $result = $this->callAPIFailure('PaymentProcessorType', 'create', $params);
$this->assertContains('name, title, class_name, billing_mode', $result['error_message']);
}
$this->assertContains('name, title, class_name, billing_mode', $result['error_message']);
}
public function testPaymentProcessorTypeUpdate($version) {
$this->_apiversion = $version;
// create sample payment processor type.
public function testPaymentProcessorTypeUpdate($version) {
$this->_apiversion = $version;
// create sample payment processor type.
- $this->_ppTypeID = $this->paymentProcessorTypeCreate(NULL);
+ $this->_ppTypeID = $this->paymentProcessorTypeCreate();
$params = [
'id' => $this->_ppTypeID,
$params = [
'id' => $this->_ppTypeID,
<title>Membership Type Plan</title>
<type>varchar</type>
<length>8</length>
<title>Membership Type Plan</title>
<type>varchar</type>
<length>8</length>
+ <required>true</required>
<comment>Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day.</comment>
<html>
<type>Select</type>
<comment>Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day.</comment>
<html>
<type>Select</type>