Skip to content

Commit

Permalink
Merge pull request #16755 from eileenmcnaughton/et
Browse files Browse the repository at this point in the history
[NFC] Test cleanup, remove duplicate test
  • Loading branch information
colemanw authored Mar 16, 2020
2 parents 3f93233 + 3b3a32a commit 9e1d75a
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions tests/phpunit/api/v3/EntityTagTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class api_v3_EntityTagTest extends CiviUnitTestCase {

/**
* Set up for test.
*
* @throws \CRM_Core_Exception
*/
public function setUp() {
parent::setUp();
Expand All @@ -50,7 +52,7 @@ public function setUp() {
$this->_individualID = $this->individualCreate();
$this->_tag = $this->tagCreate(['name' => 'EntityTagTest']);
$this->_tagID = $this->_tag['id'];
$this->_householdID = $this->houseHoldCreate();
$this->_householdID = $this->householdCreate();
$this->_organizationID = $this->organizationCreate();
$this->_params = [
'entity_id' => $this->_individualID,
Expand All @@ -74,18 +76,23 @@ public function testFailureTests() {

/**
* Test basic create.
*
* @param int $version
*
* @dataProvider versionThreeAndFour
* @throws \CRM_Core_Exception
*/
public function testContactEntityTagCreate($version) {
$this->_apiversion = $version;
$result = $this->callAPISuccess('entity_tag', 'create', $this->_params);
$this->callAPISuccess('entity_tag', 'create', $this->_params);
}

/**
* Test multiple add functionality.
*
* This needs review for api v4 as it makes for a very non standard api.
*
* @throws \CRM_Core_Exception
*/
public function testAddDouble() {

Expand Down Expand Up @@ -114,12 +121,15 @@ public function testGetNoEntityID() {

/**
* Basic get functionality test.
*
* @param int $version
*
* @dataProvider versionThreeAndFour
* @throws \CRM_Core_Exception
*/
public function testIndividualEntityTagGet($version) {
$this->_apiversion = $version;
$individualEntity = $this->callAPISuccess('entity_tag', 'create', $this->_params);
$this->callAPISuccess('entity_tag', 'create', $this->_params);

$paramsEntity = [
'contact_id' => $this->_individualID,
Expand All @@ -131,6 +141,8 @@ public function testIndividualEntityTagGet($version) {

/**
* Test memory usage does not escalate crazily.
*
* @throws \CRM_Core_Exception
*/
public function testMemoryLeak() {
$start = memory_get_usage();
Expand All @@ -157,8 +169,11 @@ public function testHouseholdEntityCreate() {

/**
* Test tag can be added to an organization.
*
* @param int $version
*
* @dataProvider versionThreeAndFour
* @throws \CRM_Core_Exception
*/
public function testOrganizationEntityGet($version) {
$this->_apiversion = $version;
Expand All @@ -177,6 +192,8 @@ public function testOrganizationEntityGet($version) {

/**
* Civicrm_entity_tag_Delete methods.
*
* @throws \CRM_Core_Exception
*/
public function testEntityTagDeleteNoTagId() {
$entityTagParams = [
Expand Down Expand Up @@ -253,24 +270,6 @@ public function testEntityTagDeleteHHORG() {
$this->assertEquals($result['not_removed'], 1);
}

public function testEntityTagCommonDeleteINDHH() {
$entityTagParams = [
'contact_id_i' => $this->_individualID,
'contact_id_h' => $this->_householdID,
'tag_id' => $this->_tagID,
];
$this->entityTagAdd($entityTagParams);

$params = [
'contact_id_i' => $this->_individualID,
'contact_id_h' => $this->_householdID,
'tag_id' => $this->_tagID,
];

$result = $this->callAPISuccess('entity_tag', 'delete', $params);
$this->assertEquals($result['removed'], 2);
}

public function testEntityTagCommonDeleteHH() {
$entityTagParams = [
'contact_id_i' => $this->_individualID,
Expand Down

0 comments on commit 9e1d75a

Please sign in to comment.