$this->membershipTypeDelete($params);
}
+ /**
+ * Test create with missing mandatory field.
+ */
public function testCreateWithoutMemberOfContactId() {
$params = array(
'name' => '60+ Membership',
$this->callAPIFailure('membership_type', 'create', $params, 'Mandatory key(s) missing from params array: member_of_contact_id');
}
- public function testCreateWithoutNameandDomainIDandDurationUnit() {
- $params = array(
- 'description' => 'people above 50 are given health instructions',
- 'member_of_contact_id' => $this->_contactID,
- 'financial_type_id' => 1,
- 'minimum_fee' => '200',
- 'duration_interval' => '10',
- 'period_type' => 'rolling',
- '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() {
- $params = array(
- 'description' => 'people above 50 are given health instructions',
- 'member_of_contact_id' => $this->_contactID,
- 'financial_type_id' => 1,
- 'domain_id' => '1',
- 'minimum_fee' => '200',
- 'duration_unit' => 'month',
- 'duration_interval' => '10',
- 'period_type' => 'rolling',
- 'visibility' => 'public',
- );
-
- $membershiptype = $this->callAPIFailure('membership_type', 'create', $params);
- $this->assertEquals($membershiptype['error_message'], 'Mandatory key(s) missing from params array: name');
- }
-
+ /**
+ * Test successful create.
+ */
public function testCreate() {
$params = array(
'name' => '40+ Membership',
$this->assertEquals($membershipType['error_message'], 'Mandatory key(s) missing from params array: domain_id');
}
+ /**
+ * Test update.
+ */
public function testUpdate() {
$id = $this->membershipTypeCreate(array('member_of_contact_id' => $this->_contactID, 'financial_type_id' => 2));
- $newMembOrgParams = array(
+ $newMemberOrgParams = array(
'organization_name' => 'New membership organisation',
'contact_type' => 'Organization',
'visibility' => 1,
);
- // create a new contact to update this membership type to
- $newMembOrgID = $this->organizationCreate($newMembOrgParams);
-
$params = array(
'id' => $id,
'name' => 'Updated General',
- 'member_of_contact_id' => $newMembOrgID,
+ 'member_of_contact_id' => $this->organizationCreate($newMemberOrgParams),
'duration_unit' => 'month',
'duration_interval' => '10',
'period_type' => 'fixed',
$this->getAndCheck($params, $id, $this->_entity);
}
+ /**
+ * Test successful delete.
+ */
public function testDelete() {
- $orgID = $this->organizationCreate();
- $membershipTypeID = $this->membershipTypeCreate(array('member_of_contact_id' => $orgID));
+ $membershipTypeID = $this->membershipTypeCreate(array('member_of_contact_id' => $this->organizationCreate()));
$params = array(
'id' => $membershipTypeID,
);
$this->callAPIAndDocument('membership_type', 'delete', $params, __FUNCTION__, __FILE__);
}
+ /**
+ * Delete test that could do with a decent comment block.
+ *
+ * I can't skim this & understand it so if anyone does explain it here.
+ */
public function testDeleteRelationshipTypesUsedByMembershipType() {
$rel1 = $this->relationshipTypeCreate(array(
'name_a_b' => 'abcde',