mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Improve factory state name
This commit is contained in:
parent
c8e12ddb5c
commit
adfb8895df
|
@ -142,7 +142,7 @@ class AccessoryFactory extends Factory
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkedOut(User $user = null)
|
public function checkedOutToUser(User $user = null)
|
||||||
{
|
{
|
||||||
return $this->afterCreating(function (Accessory $accessory) use ($user) {
|
return $this->afterCreating(function (Accessory $accessory) use ($user) {
|
||||||
$accessory->users()->attach($accessory->id, [
|
$accessory->users()->attach($accessory->id, [
|
||||||
|
|
|
@ -19,7 +19,7 @@ class AccessoryCheckinTest extends TestCase
|
||||||
public function testCheckingInAccessoryRequiresCorrectPermission()
|
public function testCheckingInAccessoryRequiresCorrectPermission()
|
||||||
{
|
{
|
||||||
$this->actingAs(User::factory()->create())
|
$this->actingAs(User::factory()->create())
|
||||||
->post(route('accessories.checkin.store', Accessory::factory()->checkedOut()->create()))
|
->post(route('accessories.checkin.store', Accessory::factory()->checkedOutToUser()->create()))
|
||||||
->assertForbidden();
|
->assertForbidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ class AccessoryCheckinTest extends TestCase
|
||||||
Event::fake([CheckoutableCheckedIn::class]);
|
Event::fake([CheckoutableCheckedIn::class]);
|
||||||
|
|
||||||
$user = User::factory()->create();
|
$user = User::factory()->create();
|
||||||
$accessory = Accessory::factory()->checkedOut($user)->create();
|
$accessory = Accessory::factory()->checkedOutToUser($user)->create();
|
||||||
|
|
||||||
$this->assertTrue($accessory->users->contains($user));
|
$this->assertTrue($accessory->users->contains($user));
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ class AccessoryCheckinTest extends TestCase
|
||||||
Notification::fake();
|
Notification::fake();
|
||||||
|
|
||||||
$user = User::factory()->create();
|
$user = User::factory()->create();
|
||||||
$accessory = Accessory::factory()->checkedOut($user)->create();
|
$accessory = Accessory::factory()->checkedOutToUser($user)->create();
|
||||||
|
|
||||||
$accessory->category->update(['checkin_email' => true]);
|
$accessory->category->update(['checkin_email' => true]);
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ class AccessoryCheckinTest extends TestCase
|
||||||
Notification::fake();
|
Notification::fake();
|
||||||
|
|
||||||
$user = User::factory()->create();
|
$user = User::factory()->create();
|
||||||
$accessory = Accessory::factory()->checkedOut($user)->create();
|
$accessory = Accessory::factory()->checkedOutToUser($user)->create();
|
||||||
|
|
||||||
$accessory->category->update(['checkin_email' => false]);
|
$accessory->category->update(['checkin_email' => false]);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue