Improve factory state name

This commit is contained in:
Marcus Moore 2024-02-12 16:31:32 -08:00
parent c8e12ddb5c
commit adfb8895df
No known key found for this signature in database
2 changed files with 5 additions and 5 deletions

View file

@ -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, [

View file

@ -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]);