Skip to content

A free open source IT asset/license management system

Add a couple sanity tests

Marcus Mooreea3d97074340
diff --git a/tests/Feature/Assets/Ui/AuditAssetTest.php b/tests/Feature/Assets/Ui/AuditAssetTest.php
index 390867ae21..ab4aad757f 100644
--- a/tests/Feature/Assets/Ui/AuditAssetTest.php
+++ b/tests/Feature/Assets/Ui/AuditAssetTest.php
@@ -4,6 +4,7 @@ namespace Tests\Feature\Assets\Ui;
use App\Models\Asset;
use App\Models\User;
+use Carbon\Carbon;
use PHPUnit\Framework\Attributes\Group;
use Tests\TestCase;
@@ -31,6 +32,26 @@ class AuditAssetTest extends TestCase
->assertForbidden();
}
+ public function test_audit_page_is_given_todays_date_when_audit_interval_is_null()
+ {
+ $this->settings->setAuditInterval(null);
+
+ $this->actingAs(User::factory()->auditAssets()->create())
+ ->get(route('asset.audit.create', Asset::factory()->create()))
+ ->assertViewIs('hardware.audit')
+ ->assertViewHas('next_audit_date', Carbon::now()->toDateString());
+ }
+
+ public function test_audit_page_is_given_correct_date_when_audit_interval_is_set()
+ {
+ $this->settings->setAuditInterval(5);
+
+ $this->actingAs(User::factory()->auditAssets()->create())
+ ->get(route('asset.audit.create', Asset::factory()->create()))
+ ->assertViewIs('hardware.audit')
+ ->assertViewHas('next_audit_date', Carbon::now()->addMonths(5)->toDateString());
+ }
+
public function test_asset_can_be_audited()
{
$this->markTestIncomplete();