From b4109f36632573b3b596cab20ca80ea12670d440 Mon Sep 17 00:00:00 2001 From: Martijn van Nieuwenhoven Date: Mon, 1 Jul 2024 21:19:17 +0200 Subject: [PATCH] fix test --- tests/Servers/Disk/RepositoryTest.php | 10 ++++++---- tests/TestCase.php | 2 +- ...0240628175734592648-test-email-email => test-email} | 0 3 files changed, 7 insertions(+), 5 deletions(-) rename tests/fixtures/{20240628175734592648-test-email-email => test-email} (100%) diff --git a/tests/Servers/Disk/RepositoryTest.php b/tests/Servers/Disk/RepositoryTest.php index 5474b34..e912338 100644 --- a/tests/Servers/Disk/RepositoryTest.php +++ b/tests/Servers/Disk/RepositoryTest.php @@ -14,8 +14,9 @@ class RepositoryTest extends TestCase public function testItStoresAnEmailToTheDatabase(): void { $email = app(Repository::class)->create($this->emailContent); + $hash = md5($this->emailContent); - $this->assertEquals($this->now->format('YmdHisu') . '-3a18860163e7a2fc1dfe71162db4a24d-email', $email->id()); + $this->assertEquals($this->now->format('YmdHisu') . '-' . $hash . '-email', $email->id()); $this->assertEquals($this->emailContent, $email->raw()); $this->assertEquals('"Mrs. Lavinia Pacocha" ', $email->from()); $this->assertEquals('Marshall Ryan , Aracely Lebsack ', $email->to()); @@ -48,8 +49,8 @@ public function testItGetsAListOfPaginatedEmails(): void public function testItFindsAndEmail(): void { app(Repository::class)->create($this->emailContent); - - $fileName = $this->now->format('YmdHisu') . '-3a18860163e7a2fc1dfe71162db4a24d-email'; + $hash = md5($this->emailContent); + $fileName = $this->now->format('YmdHisu') . '-' . $hash . '-email'; $this->assertTrue(app(Repository::class)->exists($fileName)); $this->assertEquals($fileName, app(Repository::class)->find($fileName)->id()); @@ -58,8 +59,9 @@ public function testItFindsAndEmail(): void public function testItDeletesAndEmail(): void { app(Repository::class)->create($this->emailContent); + $hash = md5($this->emailContent); - $fileName = $this->now->format('YmdHisu') . '-3a18860163e7a2fc1dfe71162db4a24d-email'; + $fileName = $this->now->format('YmdHisu') . '-' . $hash . '-email'; app(Repository::class)->delete($fileName); diff --git a/tests/TestCase.php b/tests/TestCase.php index 4f62e92..295d51a 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -25,7 +25,7 @@ protected function setUp(): void Carbon::setTestNow($this->now = now()); - $this->emailContent = file_get_contents(__DIR__ . '/fixtures/20240628175734592648-test-email-email'); + $this->emailContent = file_get_contents(__DIR__ . '/fixtures/test-email'); } protected function getPackageProviders($app) diff --git a/tests/fixtures/20240628175734592648-test-email-email b/tests/fixtures/test-email similarity index 100% rename from tests/fixtures/20240628175734592648-test-email-email rename to tests/fixtures/test-email