snipe-it/tests/unit/NotificationTest.php
snipe bc355e1f26 Remve unused use Hash statements
Signed-off-by: snipe <snipe@snipe.net>
2021-11-30 20:47:02 -08:00

38 lines
1.2 KiB
PHP

<?php
namespace Tests\Unit;
use App\Exceptions\CheckoutNotAllowed;
use App\Models\Asset;
use App\Models\AssetModel;
use App\Models\Category;
use App\Models\Location;
use App\Models\User;
use App\Notifications\CheckoutAssetNotification;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Support\Facades\Notification;
use Tests\Unit\BaseTest;
class NotificationTest extends BaseTest
{
/**
* @var \UnitTester
*/
protected $tester;
public function testAUserIsEmailedIfTheyCheckoutAnAssetWithEULA()
{
$admin = User::factory()->superuser()->create();
Auth::login($admin);
$cat = $this->createValidCategory('asset-laptop-category', ['require_acceptance' => true]);
$model = $this->createValidAssetModel('mbp-13-model', ['category_id' => $cat->id]);
$asset = $this->createValidAsset(['model_id' => $model->id]);
$user = $this->createValidUser();
Notification::fake();
$asset->checkOut($user, 1);
Notification::assertSentTo($user, CheckoutAssetNotification::class);
}
}