<?php
-
/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
- +--------------------------------------------------------------------+
- */
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.6 |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM. |
+ | |
+ | CiviCRM is free software; you can copy, modify, and distribute it |
+ | under the terms of the GNU Affero General Public License |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+ | |
+ | CiviCRM is distributed in the hope that it will be useful, but |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
+ | See the GNU Affero General Public License for more details. |
+ | |
+ | You should have received a copy of the GNU Affero General Public |
+ | License and the CiviCRM Licensing Exception along |
+ | with this program; if not, contact CiviCRM LLC |
+ | at info[AT]civicrm[DOT]org. If you have questions about the |
+ | 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';
$this->membershipTypeDelete($params);
}
- ///////////////// civicrm_membership_type_create methods
+ /**
+ * Civicrm_membership_type_create methods.
+ */
public function testCreateWithEmptyParams() {
$membershiptype = $this->callAPIFailure('membership_type', 'create', array());
$this->assertEquals($membershiptype['error_message'],
'Mandatory key(s) missing from params array: domain_id, member_of_contact_id, financial_type_id, duration_unit, duration_interval, name'
- );
+ );
}
public function testCreateWithoutMemberOfContactId() {
);
$membershiptype = $this->callAPIFailure('membership_type', 'create', $params,
- 'Mandatory key(s) missing from params array: member_of_contact_id'
- );
+ 'Mandatory key(s) missing from params array: member_of_contact_id'
+ );
}
public function testCreateWithoutContributionTypeId() {
'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'
- );
+ );
}
public function testCreateWithoutDurationUnit() {
'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'],
'Mandatory key(s) missing from params array: duration_unit'
- );
+ );
}
public function testCreateWithoutDurationInterval() {
'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'
- );
+ );
}
public function testCreateWithoutNameandDomainIDandDurationUnit() {
'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'],
'Mandatory key(s) missing from params array: domain_id, duration_unit, name'
- );
+ );
}
public function testCreateWithoutName() {
'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');
$membershiptype = $this->callAPIFailure('membership_type', 'create', $params);
$this->assertEquals($membershiptype['error_message'],
'Mandatory key(s) missing from params array: domain_id, member_of_contact_id, financial_type_id, duration_unit, duration_interval, name'
- );
+ );
}
public function testUpdateWithoutId() {
'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);
'id' => 'doesNotExist',
);
$membershiptype = $this->callAPIFailure('membership_type', 'delete', $params,
- 'Error while deleting membership type. id : ' . $params['id']
- );
+ 'Error while deleting membership type. id : ' . $params['id']
+ );
}
public function testDelete() {