2024-07-24 10:06:21 -07:00
|
|
|
<?php
|
|
|
|
|
2024-08-06 13:21:36 -07:00
|
|
|
namespace Tests\Feature\Assets\Ui;
|
2024-07-24 10:06:21 -07:00
|
|
|
|
|
|
|
use App\Models\Asset;
|
|
|
|
use App\Models\User;
|
|
|
|
use Tests\TestCase;
|
|
|
|
|
|
|
|
class CloneAssetTest extends TestCase
|
|
|
|
{
|
|
|
|
public function testPermissionRequiredToCreateAssetModel()
|
|
|
|
{
|
|
|
|
$asset = Asset::factory()->create();
|
|
|
|
$this->actingAs(User::factory()->create())
|
|
|
|
->get(route('clone/hardware', $asset))
|
|
|
|
->assertForbidden();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testPageCanBeAccessed(): void
|
|
|
|
{
|
|
|
|
$asset = Asset::factory()->create();
|
|
|
|
$response = $this->actingAs(User::factory()->createAssets()->create())
|
|
|
|
->get(route('clone/hardware', $asset));
|
|
|
|
$response->assertStatus(200);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testAssetCanBeCloned()
|
|
|
|
{
|
|
|
|
$asset_to_clone = Asset::factory()->create(['name'=>'Asset to clone']);
|
|
|
|
$this->actingAs(User::factory()->createAssets()->create())
|
|
|
|
->get(route('clone/hardware', $asset_to_clone))
|
|
|
|
->assertOk()
|
|
|
|
->assertSee([
|
|
|
|
'Asset to clone'
|
2024-07-24 10:09:32 -07:00
|
|
|
], false);
|
2024-07-24 10:06:21 -07:00
|
|
|
}
|
|
|
|
}
|