$this->assertNotContains($this->household, $result['values']);
}
- /**
- * Search with invalid type or subtype.
- */
- public function testSearchWithInvalidData() {
- // for invalid type
- $params = [
- 'contact_type' => 'Invalid' . CRM_Core_DAO::VALUE_SEPARATOR . 'Invalid',
- 'version' => 3,
- ];
- $result = civicrm_api('contact', 'get', $params);
- $this->assertEquals(empty($result['values']), TRUE);
-
- // for invalid subtype
- $params = ['contact_sub_type' => 'Invalid', 'version' => 3];
- $result = civicrm_api('contact', 'get', $params);
- $this->assertEquals(empty($result['values']), TRUE);
-
- // for invalid contact type as well as subtype
- $params = [
- 'contact_type' => 'Invalid' . CRM_Core_DAO::VALUE_SEPARATOR . 'Invalid',
- 'version' => 3,
- ];
- $result = civicrm_api('contact', 'get', $params);
- $this->assertEquals(empty($result['values']), TRUE);
-
- // for valid type and invalid subtype
- $params = [
- 'contact_type' => 'Individual' . CRM_Core_DAO::VALUE_SEPARATOR . 'Invalid',
- 'version' => 3,
- ];
- $result = civicrm_api('contact', 'get', $params);
- $this->assertEquals(empty($result['values']), TRUE);
-
- // for invalid type and valid subtype
- $params = [
- 'contact_type' => 'Invalid' . CRM_Core_DAO::VALUE_SEPARATOR . 'indivi_student',
- 'version' => 3,
- ];
- $result = civicrm_api('contact', 'get', $params);
- $this->assertEquals(empty($result['values']), TRUE);
- }
-
- /**
- * Search with wrong type or subtype.
- */
- public function testSearchWithWrongdData() {
-
- // for type:Individual subtype:Sponsor
- $defaults = [];
- $params = [
- 'contact_type' => 'Individual' . CRM_Core_DAO::VALUE_SEPARATOR . $this->sponsor,
- 'version' => 3,
- ];
- $result = civicrm_api('contact', 'get', $params);
- $this->assertEquals(empty($result['values']), TRUE);
-
- // for type:Orgaization subtype:Parent
- $params = [
- 'contact_type' => 'Orgaization' . CRM_Core_DAO::VALUE_SEPARATOR . $this->parent,
- 'version' => 3,
- ];
- $result = civicrm_api('contact', 'get', $params, $defaults);
- $this->assertEquals(empty($result['values']), TRUE);
-
- // for type:Household subtype:Sponsor
- $params = [
- '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);
-
- // for type:Household subtype:Student
- $params = [
- 'contact_type' => 'Household' . CRM_Core_DAO::VALUE_SEPARATOR . $this->student,
- 'version' => 3,
- ];
- $result = civicrm_api('contact', 'get', $params, $defaults);
- $this->assertEquals(empty($result['values']), TRUE);
- }
-
}