Skip to content

Commit

Permalink
dev/core#667 Add test to demonstrate entity tags are not being deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Mar 20, 2020
1 parent 6769b88 commit 6247b60
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/phpunit/api/v3/ContactTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2978,9 +2978,13 @@ public function testContactCreationPermissions($version) {
/**
* Test that delete with skip undelete respects permissions.
* TODO: Api4
*
* @throws \CRM_Core_Exception
*/
public function testContactDeletePermissions() {
$contactID = $this->individualCreate();
$tag = $this->callAPISuccess('Tag', 'create', ['name' => 'to be deleted']);
$this->callAPISuccess('EntityTag', 'create', ['entity_id' => $contactID, 'tag_id' => $tag['id']]);
CRM_Core_Config::singleton()->userPermissionClass->permissions = ['access CiviCRM'];
$this->callAPIFailure('Contact', 'delete', [
'id' => $contactID,
Expand All @@ -2992,6 +2996,7 @@ public function testContactDeletePermissions() {
'check_permissions' => 0,
'skip_undelete' => 1,
]);
$this->callAPISuccessGetCount('EntityTag', ['entity_id' => $contactID], 0);
}

/**
Expand Down

0 comments on commit 6247b60

Please sign in to comment.