mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Scaffold tests around accessory check in
This commit is contained in:
parent
65e20282b6
commit
095a7d9b34
|
@ -8,6 +8,7 @@ use App\Models\Location;
|
|||
use App\Models\Manufacturer;
|
||||
use App\Models\Supplier;
|
||||
use App\Models\User;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class AccessoryFactory extends Factory
|
||||
|
@ -140,4 +141,16 @@ class AccessoryFactory extends Factory
|
|||
$accessory->category->update(['require_acceptance' => 1]);
|
||||
});
|
||||
}
|
||||
|
||||
public function checkedOut()
|
||||
{
|
||||
return $this->afterCreating(function (Accessory $accessory) {
|
||||
$accessory->users()->attach($accessory->id, [
|
||||
'accessory_id' => $accessory->id,
|
||||
'created_at' => Carbon::now(),
|
||||
'user_id' => 1,
|
||||
'assigned_to' => User::factory()->create()->id,
|
||||
]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
35
tests/Feature/Checkins/AccessoryCheckinTest.php
Normal file
35
tests/Feature/Checkins/AccessoryCheckinTest.php
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Feature\Checkins;
|
||||
|
||||
use App\Models\Accessory;
|
||||
use App\Models\User;
|
||||
use Tests\Support\InteractsWithSettings;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AccessoryCheckinTest extends TestCase
|
||||
{
|
||||
use InteractsWithSettings;
|
||||
|
||||
public function testCheckingInAccessoryRequiresCorrectPermission()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->post(route('accessories.checkin.store', Accessory::factory()->checkedOut()->create()))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testAccessoryCanBeCheckedIn()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
}
|
||||
|
||||
public function testEmailSentToUserIfSettingEnabled()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
}
|
||||
|
||||
public function testEmailNotSentToUserIfSettingDisabled()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue