From 56db97ee3b7bece6ec730f27278d6d966f937fbe Mon Sep 17 00:00:00 2001 From: larssandergreen Date: Mon, 24 Oct 2022 17:37:43 -0600 Subject: [PATCH] Add test for delete GroupContact Subscription History --- .../api/v4/Entity/SubscriptionHistoryTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/phpunit/api/v4/Entity/SubscriptionHistoryTest.php b/tests/phpunit/api/v4/Entity/SubscriptionHistoryTest.php index 1c7ae40609..3a95c5ebb8 100644 --- a/tests/phpunit/api/v4/Entity/SubscriptionHistoryTest.php +++ b/tests/phpunit/api/v4/Entity/SubscriptionHistoryTest.php @@ -60,6 +60,20 @@ class SubscriptionHistoryTest extends Api4TestBase { $this->assertCount(1, $historyRemoved); $this->assertGreaterThanOrEqual($timeRemoved, strtotime($historyRemoved->single()['date'])); $this->assertLessThanOrEqual(time(), strtotime($historyRemoved->single()['date'])); + + $timeDeleted = time(); + GroupContact::delete() + ->addWhere('id', '=', $groupContact['id']) + ->execute(); + $historyDeleted = SubscriptionHistory::get() + ->addSelect('*') + ->addWhere('group_id', '=', $group['id']) + ->addWhere('status', '=', 'Deleted') + ->addWhere('contact_id', '=', $contact['id']) + ->execute(); + $this->assertCount(1, $historyDeleted); + $this->assertGreaterThanOrEqual($timeDeleted, strtotime($historyDeleted->single()['date'])); + $this->assertLessThanOrEqual(time(), strtotime($historyDeleted->single()['date'])); } public function testGetPermissions() { -- 2.25.1