From 2c7c60f9859bb553027b7529d5ec7d9ac2fb1374 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 23 Aug 2023 17:36:39 +1000 Subject: [PATCH] Additional tests for System Logs --- tests/Feature/InvoiceEmailTest.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/Feature/InvoiceEmailTest.php b/tests/Feature/InvoiceEmailTest.php index 2eb3e2da172f..0105f25105aa 100644 --- a/tests/Feature/InvoiceEmailTest.php +++ b/tests/Feature/InvoiceEmailTest.php @@ -87,6 +87,12 @@ class InvoiceEmailTest extends TestCase $this->assertEquals('invoice', $arr[0]['entity_type']); + $count = SystemLog::where('client_id', $this->client->id) + ->where('category_id', SystemLog::CATEGORY_MAIL) + ->orderBy('id', 'DESC') + ->count(); + + $this->assertEquals(1, $count); } public function testEntityEmailHistory() @@ -134,6 +140,13 @@ class InvoiceEmailTest extends TestCase $this->assertEquals('invoice', $arr[0]['entity_type']); $this->assertEquals($this->invoice->hashed_id, $arr[0]['entity_id']); + $count = SystemLog::where('company_id', $this->company->id) + ->where('category_id', SystemLog::CATEGORY_MAIL) + ->whereJsonContains('log->history->entity_id', $this->invoice->hashed_id) + ->count(); + + $this->assertEquals(1, $count); + }