Update to Laravel 8
Co-authored-by: Matthew Penner <me@matthewp.io>
This commit is contained in:
parent
028921b42a
commit
a043071e3c
211 changed files with 4394 additions and 2933 deletions
|
@ -24,7 +24,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase
|
|||
{
|
||||
[$user, $server] = $this->generateTestAccount($permissions);
|
||||
|
||||
$response = $this->actingAs($user)->postJson($this->link($server) . "/users", [
|
||||
$response = $this->actingAs($user)->postJson($this->link($server) . '/users', [
|
||||
'email' => $email = $this->faker->email,
|
||||
'permissions' => [
|
||||
Permission::ACTION_USER_CREATE,
|
||||
|
@ -61,7 +61,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase
|
|||
Permission::ACTION_CONTROL_CONSOLE,
|
||||
]);
|
||||
|
||||
$response = $this->actingAs($user)->postJson($this->link($server) . "/users", [
|
||||
$response = $this->actingAs($user)->postJson($this->link($server) . '/users', [
|
||||
'email' => $email = $this->faker->email,
|
||||
'permissions' => [
|
||||
Permission::ACTION_USER_CREATE,
|
||||
|
@ -83,7 +83,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase
|
|||
|
||||
$email = str_repeat(Str::random(20), 9) . '1@gmail.com'; // 191 is the hard limit for the column in MySQL.
|
||||
|
||||
$response = $this->actingAs($user)->postJson($this->link($server) . "/users", [
|
||||
$response = $this->actingAs($user)->postJson($this->link($server) . '/users', [
|
||||
'email' => $email,
|
||||
'permissions' => [
|
||||
Permission::ACTION_USER_CREATE,
|
||||
|
@ -92,7 +92,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase
|
|||
|
||||
$response->assertOk();
|
||||
|
||||
$response = $this->actingAs($user)->postJson($this->link($server) . "/users", [
|
||||
$response = $this->actingAs($user)->postJson($this->link($server) . '/users', [
|
||||
'email' => $email . '.au',
|
||||
'permissions' => [
|
||||
Permission::ACTION_USER_CREATE,
|
||||
|
@ -113,9 +113,9 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase
|
|||
[$user, $server] = $this->generateTestAccount();
|
||||
|
||||
/** @var \Pterodactyl\Models\User $existing */
|
||||
$existing = factory(User::class)->create(['email' => $this->faker->email]);
|
||||
$existing = User::factory()->create(['email' => $this->faker->email]);
|
||||
|
||||
$response = $this->actingAs($user)->postJson($this->link($server) . "/users", [
|
||||
$response = $this->actingAs($user)->postJson($this->link($server) . '/users', [
|
||||
'email' => $existing->email,
|
||||
'permissions' => [
|
||||
Permission::ACTION_USER_CREATE,
|
||||
|
@ -135,7 +135,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase
|
|||
{
|
||||
[$user, $server] = $this->generateTestAccount();
|
||||
|
||||
$response = $this->actingAs($user)->postJson($this->link($server) . "/users", [
|
||||
$response = $this->actingAs($user)->postJson($this->link($server) . '/users', [
|
||||
'email' => $email = $this->faker->email,
|
||||
'permissions' => [
|
||||
Permission::ACTION_USER_CREATE,
|
||||
|
@ -144,7 +144,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase
|
|||
|
||||
$response->assertOk();
|
||||
|
||||
$response = $this->actingAs($user)->postJson($this->link($server) . "/users", [
|
||||
$response = $this->actingAs($user)->postJson($this->link($server) . '/users', [
|
||||
'email' => $email,
|
||||
'permissions' => [
|
||||
Permission::ACTION_USER_CREATE,
|
||||
|
|
|
@ -30,13 +30,13 @@ class DeleteSubuserTest extends ClientApiIntegrationTestCase
|
|||
[$user, $server] = $this->generateTestAccount();
|
||||
|
||||
/** @var \Pterodactyl\Models\User $differentUser */
|
||||
$differentUser = factory(User::class)->create();
|
||||
$differentUser = User::factory()->create();
|
||||
|
||||
// Generate a UUID that lines up with a user in the database if it were to be cast to an int.
|
||||
$uuid = $differentUser->id . str_repeat('a', strlen((string)$differentUser->id)) . substr(Uuid::uuid4()->toString(), 8);
|
||||
$uuid = $differentUser->id . str_repeat('a', strlen((string) $differentUser->id)) . substr(Uuid::uuid4()->toString(), 8);
|
||||
|
||||
/** @var \Pterodactyl\Models\User $subuser */
|
||||
$subuser = factory(User::class)->create(['uuid' => $uuid]);
|
||||
$subuser = User::factory()->create(['uuid' => $uuid]);
|
||||
|
||||
Subuser::query()->forceCreate([
|
||||
'user_id' => $subuser->id,
|
||||
|
@ -52,7 +52,7 @@ class DeleteSubuserTest extends ClientApiIntegrationTestCase
|
|||
// anything in the database.
|
||||
$uuid = '18180000' . substr(Uuid::uuid4()->toString(), 8);
|
||||
/** @var \Pterodactyl\Models\User $subuser */
|
||||
$subuser = factory(User::class)->create(['uuid' => $uuid]);
|
||||
$subuser = User::factory()->create(['uuid' => $uuid]);
|
||||
|
||||
Subuser::query()->forceCreate([
|
||||
'user_id' => $subuser->id,
|
||||
|
|
|
@ -20,7 +20,7 @@ class SubuserAuthorizationTest extends ClientApiIntegrationTestCase
|
|||
{
|
||||
// Generic subuser, the specific resource we're trying to access.
|
||||
/** @var \Pterodactyl\Models\User $internal */
|
||||
$internal = factory(User::class)->create();
|
||||
$internal = User::factory()->create();
|
||||
|
||||
// The API $user is the owner of $server1.
|
||||
[$user, $server1] = $this->generateTestAccount();
|
||||
|
@ -31,11 +31,11 @@ class SubuserAuthorizationTest extends ClientApiIntegrationTestCase
|
|||
|
||||
// Set the API $user as a subuser of server 2, but with no permissions
|
||||
// to do anything with the subusers for that server.
|
||||
factory(Subuser::class)->create(['server_id' => $server2->id, 'user_id' => $user->id]);
|
||||
Subuser::factory()->create(['server_id' => $server2->id, 'user_id' => $user->id]);
|
||||
|
||||
factory(Subuser::class)->create(['server_id' => $server1->id, 'user_id' => $internal->id]);
|
||||
factory(Subuser::class)->create(['server_id' => $server2->id, 'user_id' => $internal->id]);
|
||||
factory(Subuser::class)->create(['server_id' => $server3->id, 'user_id' => $internal->id]);
|
||||
Subuser::factory()->create(['server_id' => $server1->id, 'user_id' => $internal->id]);
|
||||
Subuser::factory()->create(['server_id' => $server2->id, 'user_id' => $internal->id]);
|
||||
Subuser::factory()->create(['server_id' => $server3->id, 'user_id' => $internal->id]);
|
||||
|
||||
$this->instance(DaemonServerRepository::class, $mock = Mockery::mock(DaemonServerRepository::class));
|
||||
if ($method === 'DELETE') {
|
||||
|
@ -43,12 +43,12 @@ class SubuserAuthorizationTest extends ClientApiIntegrationTestCase
|
|||
}
|
||||
|
||||
// This route is acceptable since they're accessing a subuser on their own server.
|
||||
$this->actingAs($user)->json($method, $this->link($server1, "/users/" . $internal->uuid))->assertStatus($method === 'POST' ? 422 : ($method === 'DELETE' ? 204 : 200));
|
||||
$this->actingAs($user)->json($method, $this->link($server1, '/users/' . $internal->uuid))->assertStatus($method === 'POST' ? 422 : ($method === 'DELETE' ? 204 : 200));
|
||||
|
||||
// This route can be revealed since the subuser belongs to the correct server, but
|
||||
// errors out with a 403 since $user does not have the right permissions for this.
|
||||
$this->actingAs($user)->json($method, $this->link($server2, "/users/" . $internal->uuid))->assertForbidden();
|
||||
$this->actingAs($user)->json($method, $this->link($server3, "/users/" . $internal->uuid))->assertNotFound();
|
||||
$this->actingAs($user)->json($method, $this->link($server2, '/users/' . $internal->uuid))->assertForbidden();
|
||||
$this->actingAs($user)->json($method, $this->link($server3, '/users/' . $internal->uuid))->assertNotFound();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -56,6 +56,6 @@ class SubuserAuthorizationTest extends ClientApiIntegrationTestCase
|
|||
*/
|
||||
public function methodDataProvider(): array
|
||||
{
|
||||
return [["GET"], ["POST"], ["DELETE"]];
|
||||
return [['GET'], ['POST'], ['DELETE']];
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue