From 4ac49fbfb3ec0bf2a282325c0986806be113ae01 Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Fri, 15 Jan 2021 19:07:03 -0700 Subject: [PATCH] integration test cleanup --- .../Integration/Api/Client/ClientApiIntegrationTestCase.php | 3 +++ tests/Traits/Integration/CreatesTestModels.php | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/Integration/Api/Client/ClientApiIntegrationTestCase.php b/tests/Integration/Api/Client/ClientApiIntegrationTestCase.php index 7fe3cbd3..56e777f6 100644 --- a/tests/Integration/Api/Client/ClientApiIntegrationTestCase.php +++ b/tests/Integration/Api/Client/ClientApiIntegrationTestCase.php @@ -49,6 +49,7 @@ abstract class ClientApiIntegrationTestCase extends IntegrationTestCase * * @param mixed $model * @param string|null $append + * * @return string */ protected function link($model, $append = null): string @@ -79,6 +80,7 @@ abstract class ClientApiIntegrationTestCase extends IntegrationTestCase * is assumed that the user is actually a subuser of the server. * * @param string[] $permissions + * * @return array */ protected function generateTestAccount(array $permissions = []): array @@ -90,6 +92,7 @@ abstract class ClientApiIntegrationTestCase extends IntegrationTestCase return [$user, $this->createServerModel(['user_id' => $user->id])]; } + /** @var \Pterodactyl\Models\Server $server */ $server = $this->createServerModel(); Subuser::query()->create([ diff --git a/tests/Traits/Integration/CreatesTestModels.php b/tests/Traits/Integration/CreatesTestModels.php index 7be97715..55ebec9f 100644 --- a/tests/Traits/Integration/CreatesTestModels.php +++ b/tests/Traits/Integration/CreatesTestModels.php @@ -22,7 +22,7 @@ trait CreatesTestModels * * @param array $attributes * - * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|static|static[] + * @return \Pterodactyl\Models\Server */ public function createServerModel(array $attributes = []) { @@ -77,9 +77,9 @@ trait CreatesTestModels Allocation::query()->where('id', $server->allocation_id)->update(['server_id' => $server->id]); - return Server::with([ + return $server->fresh([ 'location', 'user', 'node', 'allocation', 'nest', 'egg', - ])->findOrFail($server->id); + ]); } /**