Skip to content

Commit ac1c223

Browse files
committed
explode recipients for successful testing
1 parent 5482d58 commit ac1c223

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

tests/Feature/Notifications/Email/ExpiringAlertsNotificationTest.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,20 +134,25 @@ public function testLowInventoryWarningThresholdEmailNotification()
134134
$this->markIncompleteIfSqlite();
135135
Mail::fake();
136136

137-
$accessory = Accessory::factory()->create([
137+
$this->settings->enableAlertEmail('[email protected], [email protected]');
138+
$this->settings->setAlertInterval(5);
139+
140+
$alert_email = Setting::first()->alert_email;
141+
142+
Accessory::factory()->create([
138143
'min_amt' => 4,
139144
'qty' => 2
140145
]);
141-
$this->settings->enableAlertEmail('[email protected], [email protected]');
142-
$this->settings->alert_threshhold = 5;
143146

144-
$alert_email = Setting::first()->alert_email;
147+
$inventory = Helper::checkLowInventory();
148+
$this->assertCount(1, $inventory);
145149

146150
$this->artisan('snipeit:inventory-alerts')->assertExitCode(0);
147151

148-
Mail::assertSent(InventoryAlertMail::class, function($mail) use ($alert_email) {
149-
return $mail->hasTo($alert_email) && (collect($mail->items)->count() === 1);
150-
});
151-
152+
foreach(explode(', ', $alert_email) as $recipient) {
153+
Mail::assertSent(InventoryAlertMail::class, function (InventoryAlertMail $mail) use ($recipient) {
154+
return $mail->hasTo($recipient);
155+
});
156+
}
152157
}
153158
}

0 commit comments

Comments
 (0)