mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-19 14:53:45 +02:00
integration test cleanup
This commit is contained in:
@@ -49,6 +49,7 @@ abstract class ClientApiIntegrationTestCase extends IntegrationTestCase
|
|||||||
*
|
*
|
||||||
* @param mixed $model
|
* @param mixed $model
|
||||||
* @param string|null $append
|
* @param string|null $append
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function link($model, $append = null): 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.
|
* is assumed that the user is actually a subuser of the server.
|
||||||
*
|
*
|
||||||
* @param string[] $permissions
|
* @param string[] $permissions
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function generateTestAccount(array $permissions = []): array
|
protected function generateTestAccount(array $permissions = []): array
|
||||||
@@ -90,6 +92,7 @@ abstract class ClientApiIntegrationTestCase extends IntegrationTestCase
|
|||||||
return [$user, $this->createServerModel(['user_id' => $user->id])];
|
return [$user, $this->createServerModel(['user_id' => $user->id])];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @var \Pterodactyl\Models\Server $server */
|
||||||
$server = $this->createServerModel();
|
$server = $this->createServerModel();
|
||||||
|
|
||||||
Subuser::query()->create([
|
Subuser::query()->create([
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ trait CreatesTestModels
|
|||||||
*
|
*
|
||||||
* @param array $attributes
|
* @param array $attributes
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|static|static[]
|
* @return \Pterodactyl\Models\Server
|
||||||
*/
|
*/
|
||||||
public function createServerModel(array $attributes = [])
|
public function createServerModel(array $attributes = [])
|
||||||
{
|
{
|
||||||
@@ -77,9 +77,9 @@ trait CreatesTestModels
|
|||||||
|
|
||||||
Allocation::query()->where('id', $server->allocation_id)->update(['server_id' => $server->id]);
|
Allocation::query()->where('id', $server->allocation_id)->update(['server_id' => $server->id]);
|
||||||
|
|
||||||
return Server::with([
|
return $server->fresh([
|
||||||
'location', 'user', 'node', 'allocation', 'nest', 'egg',
|
'location', 'user', 'node', 'allocation', 'nest', 'egg',
|
||||||
])->findOrFail($server->id);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user