mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 06:04:08 -08:00
Added test
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
293abbd1d0
commit
425bfa4318
37
tests/Feature/Assets/Ui/CloneAssetTest.php
Normal file
37
tests/Feature/Assets/Ui/CloneAssetTest.php
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Feature\Assets\Ui;
|
||||||
|
|
||||||
|
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'
|
||||||
|
], false);;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue