From d1197d015c22758bbc49f9f6046f76db9e95a844 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Wed, 29 Jan 2025 16:24:43 -0800 Subject: [PATCH] Add another case scenario --- .../Email/AssetAcceptanceReminderTest.php | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/tests/Feature/Notifications/Email/AssetAcceptanceReminderTest.php b/tests/Feature/Notifications/Email/AssetAcceptanceReminderTest.php index f163225d1b..d7c89e041e 100644 --- a/tests/Feature/Notifications/Email/AssetAcceptanceReminderTest.php +++ b/tests/Feature/Notifications/Email/AssetAcceptanceReminderTest.php @@ -48,12 +48,31 @@ class AssetAcceptanceReminderTest extends TestCase Mail::assertNotSent(CheckoutAssetMail::class); } - public function testUserWithoutEmailAddressHandledGracefully() + public static function CheckoutAcceptancesToUsersWithoutEmailAddresses() { - $checkoutAcceptance = CheckoutAcceptance::factory() - ->pending() - ->forAssignedTo(['email' => null]) - ->create(); + yield 'User with null email address' => [ + function () { + return CheckoutAcceptance::factory() + ->pending() + ->forAssignedTo(['email' => null]) + ->create(); + } + ]; + + yield 'User with empty string email address' => [ + function () { + return CheckoutAcceptance::factory() + ->pending() + ->forAssignedTo(['email' => '']) + ->create(); + } + ]; + } + + #[DataProvider('CheckoutAcceptancesToUsersWithoutEmailAddresses')] + public function testUserWithoutEmailAddressHandledGracefully($callback) + { + $checkoutAcceptance = $callback(); $this->actingAs(User::factory()->canViewReports()->create()) ->post($this->routeFor($checkoutAcceptance))