From 0118c4df809f9a381e6bfe0c5e58477e2996c786 Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Fri, 15 Jan 2021 18:28:47 -0700 Subject: [PATCH] can these integration tests just pass, kthx --- tests/Traits/Integration/CreatesTestModels.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/tests/Traits/Integration/CreatesTestModels.php b/tests/Traits/Integration/CreatesTestModels.php index 0d3390f6..347de099 100644 --- a/tests/Traits/Integration/CreatesTestModels.php +++ b/tests/Traits/Integration/CreatesTestModels.php @@ -26,30 +26,27 @@ trait CreatesTestModels */ public function createServerModel(array $attributes = []): Server { - /** @var \Illuminate\Database\Eloquent\Factory $factory */ - $factory = $this->app->make(EloquentFactory::class); - if (isset($attributes['user_id'])) { $attributes['owner_id'] = $attributes['user_id']; } if (! isset($attributes['owner_id'])) { - $user = $factory->of(User::class)->create(); + $user = User::factory()->create(); $attributes['owner_id'] = $user->id; } if (! isset($attributes['node_id'])) { if (! isset($attributes['location_id'])) { - $location = $factory->of(Location::class)->create(); + $location = Location::factory()->create(); $attributes['location_id'] = $location->id; } - $node = $factory->of(Node::class)->create(['location_id' => $attributes['location_id']]); + $node = Node::factory()->create(['location_id' => $attributes['location_id']]); $attributes['node_id'] = $node->id; } if (! isset($attributes['allocation_id'])) { - $allocation = $factory->of(Allocation::class)->create(['node_id' => $attributes['node_id']]); + $allocation = Allocation::factory()->create(['node_id' => $attributes['node_id']]); $attributes['allocation_id'] = $allocation->id; } @@ -69,7 +66,7 @@ trait CreatesTestModels unset($attributes['user_id'], $attributes['location_id']); - $server = $factory->of(Server::class)->create($attributes); + $server = Server::factory()->create($attributes); Allocation::query()->where('id', $server->allocation_id)->update(['server_id' => $server->id]);