3
0
mirror of https://github.com/snipe/snipe-it.git synced 2026-02-14 01:45:36 +00:00
Files
snipe-it/tests/Feature/Notifications/Email/CheckoutResponseEmailTest.php
2025-06-05 15:15:22 -07:00

45 lines
1.4 KiB
PHP

<?php
namespace Tests\Feature\Notifications\Email;
use App\Mail\CheckoutAcceptanceResponseMail;
use App\Models\CheckoutAcceptance;
use App\Models\User;
use Illuminate\Support\Facades\Mail;
use Tests\TestCase;
class CheckoutResponseEmailTest extends TestCase
{
public static function scenarios()
{
yield 'Accepting checkout acceptance configured to send alert' => [];
yield 'Declining checkout acceptance configured to send alert' => [];
yield 'Accepting checkout acceptance not configured to send alert' => [];
yield 'Declining checkout acceptance not configured to send alert' => [];
}
public function test_checkout_response_alert()
{
Mail::fake();
$user = User::factory()->create();
$checkoutAcceptance = CheckoutAcceptance::factory()
->pending()
->create([
'alert_on_response_id' => $user->id,
]);
$this->actingAs($checkoutAcceptance->assignedTo)
->post(route('account.store-acceptance', $checkoutAcceptance), [
'asset_acceptance' => 'accepted',
'note' => null,
]);
Mail::assertSent(CheckoutAcceptanceResponseMail::class, function ($mail) use ($user) {
// @todo: better assertions? accepted vs declined?
return $mail->hasTo($user->email);
});
}
}