From 6247b6031b7e76c979179fd41ec065d426d9aff0 Mon Sep 17 00:00:00 2001 From: eileen Date: Tue, 17 Mar 2020 14:52:48 +1300 Subject: [PATCH] dev/core#667 Add test to demonstrate entity tags are not being deleted --- tests/phpunit/api/v3/ContactTest.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/phpunit/api/v3/ContactTest.php b/tests/phpunit/api/v3/ContactTest.php index 52fa8401e485..90f0e22e82f6 100644 --- a/tests/phpunit/api/v3/ContactTest.php +++ b/tests/phpunit/api/v3/ContactTest.php @@ -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, @@ -2992,6 +2996,7 @@ public function testContactDeletePermissions() { 'check_permissions' => 0, 'skip_undelete' => 1, ]); + $this->callAPISuccessGetCount('EntityTag', ['entity_id' => $contactID], 0); } /**