Upgrade to Laravel 9 (#4413)

Co-authored-by: DaneEveritt <dane@daneeveritt.com>
This commit is contained in:
Matthew Penner 2022-10-14 10:59:20 -06:00 committed by GitHub
parent 95e15d2c8a
commit cbcf62086f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
573 changed files with 4387 additions and 9411 deletions

View file

@ -3,6 +3,7 @@
namespace Pterodactyl\Tests\Integration\Services\Servers;
use Mockery;
use Mockery\MockInterface;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
use Pterodactyl\Models\Server;
@ -16,8 +17,7 @@ use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException;
class BuildModificationServiceTest extends IntegrationTestCase
{
/** @var \Mockery\MockInterface */
private $daemonServerRepository;
private MockInterface $daemonServerRepository;
/**
* Setup tests.
@ -183,7 +183,7 @@ class BuildModificationServiceTest extends IntegrationTestCase
/**
* Test that allocations in both the add and remove arrays are only added, and not removed.
* This scenario wouldn't really happen in the UI, but it is possible to perform via the API
* This scenario wouldn't really happen in the UI, but it is possible to perform via the API,
* so we want to make sure that the logic being used doesn't break if the allocation exists
* in both arrays.
*
@ -229,7 +229,7 @@ class BuildModificationServiceTest extends IntegrationTestCase
/**
* Test that any changes we made to the server or allocations are rolled back if there is an
* exception while performing any action. This is different than the connection exception
* exception while performing any action. This is different from the connection exception
* test which should properly ignore connection issues. We want any other type of exception
* to properly be thrown back to the caller.
*/
@ -248,10 +248,7 @@ class BuildModificationServiceTest extends IntegrationTestCase
$this->assertDatabaseHas('allocations', ['id' => $allocation->id, 'server_id' => null]);
}
/**
* @return \Pterodactyl\Services\Servers\BuildModificationService
*/
private function getService()
private function getService(): BuildModificationService
{
return $this->app->make(BuildModificationService::class);
}

View file

@ -3,6 +3,7 @@
namespace Pterodactyl\Tests\Integration\Services\Servers;
use Mockery;
use Mockery\MockInterface;
use Pterodactyl\Models\Egg;
use GuzzleHttp\Psr7\Request;
use Pterodactyl\Models\Node;
@ -24,8 +25,7 @@ class ServerCreationServiceTest extends IntegrationTestCase
{
use WithFaker;
/** @var \Mockery\MockInterface */
protected $daemonServerRepository;
protected MockInterface $daemonServerRepository;
protected Egg $bungeecord;
@ -208,10 +208,7 @@ class ServerCreationServiceTest extends IntegrationTestCase
$this->assertDatabaseMissing('servers', ['owner_id' => $user->id]);
}
/**
* @return \Pterodactyl\Services\Servers\ServerCreationService
*/
private function getService()
private function getService(): ServerCreationService
{
return $this->app->make(ServerCreationService::class);
}

View file

@ -4,9 +4,9 @@ namespace Pterodactyl\Tests\Integration\Services\Servers;
use Mockery;
use Exception;
use Mockery\MockInterface;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
use Pterodactyl\Models\Server;
use Pterodactyl\Models\Database;
use Pterodactyl\Models\DatabaseHost;
use GuzzleHttp\Exception\BadResponseException;
@ -18,13 +18,11 @@ use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException;
class ServerDeletionServiceTest extends IntegrationTestCase
{
/** @var \Mockery\MockInterface */
private $daemonServerRepository;
private MockInterface $daemonServerRepository;
/** @var \Mockery\MockInterface */
private $databaseManagementService;
private MockInterface $databaseManagementService;
private static $defaultLogger;
private static ?string $defaultLogger;
/**
* Stub out services that we don't want to test in here.
@ -102,7 +100,7 @@ class ServerDeletionServiceTest extends IntegrationTestCase
new DaemonConnectionException(new BadResponseException('Bad request', new Request('GET', '/test'), new Response(500)))
);
$this->getService()->withForce(true)->handle($server);
$this->getService()->withForce()->handle($server);
$this->assertDatabaseMissing('servers', ['id' => $server->id]);
}
@ -157,10 +155,7 @@ class ServerDeletionServiceTest extends IntegrationTestCase
$this->assertDatabaseMissing('databases', ['id' => $db->id]);
}
/**
* @return \Pterodactyl\Services\Servers\ServerDeletionService
*/
private function getService()
private function getService(): ServerDeletionService
{
return $this->app->make(ServerDeletionService::class);
}

View file

@ -33,7 +33,7 @@ class StartupModificationServiceTest extends IntegrationTestCase
],
]);
$this->assertTrue(false, 'This assertion should not be called.');
$this->fail('This assertion should not be called.');
} catch (Exception $exception) {
$this->assertInstanceOf(ValidationException::class, $exception);
@ -161,10 +161,7 @@ class StartupModificationServiceTest extends IntegrationTestCase
->handle($server, ['egg_id' => 123456789]);
}
/**
* @return \Pterodactyl\Services\Servers\StartupModificationService
*/
private function getService()
private function getService(): StartupModificationService
{
return $this->app->make(StartupModificationService::class);
}

View file

@ -3,6 +3,7 @@
namespace Pterodactyl\Tests\Integration\Services\Servers;
use Mockery;
use Mockery\MockInterface;
use InvalidArgumentException;
use Pterodactyl\Models\Server;
use Pterodactyl\Services\Servers\SuspensionService;
@ -11,8 +12,7 @@ use Pterodactyl\Repositories\Wings\DaemonServerRepository;
class SuspensionServiceTest extends IntegrationTestCase
{
/** @var \Mockery\MockInterface */
private $repository;
private MockInterface $repository;
/**
* Setup test instance.
@ -31,7 +31,7 @@ class SuspensionServiceTest extends IntegrationTestCase
$this->repository->expects('setServer->sync')->twice()->andReturnSelf();
$this->getService()->toggle($server, SuspensionService::ACTION_SUSPEND);
$this->getService()->toggle($server);
$this->assertTrue($server->refresh()->isSuspended());
@ -50,7 +50,7 @@ class SuspensionServiceTest extends IntegrationTestCase
$this->assertFalse($server->isSuspended());
$server->update(['status' => Server::STATUS_SUSPENDED]);
$this->getService()->toggle($server, SuspensionService::ACTION_SUSPEND);
$this->getService()->toggle($server);
$server->refresh();
$this->assertTrue($server->isSuspended());
@ -66,10 +66,7 @@ class SuspensionServiceTest extends IntegrationTestCase
$this->getService()->toggle($server, 'foo');
}
/**
* @return \Pterodactyl\Services\Servers\SuspensionService
*/
private function getService()
private function getService(): SuspensionService
{
return $this->app->make(SuspensionService::class);
}

View file

@ -25,7 +25,7 @@ class VariableValidatorServiceTest extends IntegrationTestCase
}
/**
* Test that enviornment variables for a server are validated as expected.
* Test that environment variables for a server are validated as expected.
*/
public function testEnvironmentVariablesCanBeValidated()
{
@ -36,7 +36,7 @@ class VariableValidatorServiceTest extends IntegrationTestCase
'BUNGEE_VERSION' => '1.2.3',
]);
$this->assertTrue(false, 'This statement should not be reached.');
$this->fail('This statement should not be reached.');
} catch (ValidationException $exception) {
$errors = $exception->errors();
@ -96,7 +96,7 @@ class VariableValidatorServiceTest extends IntegrationTestCase
'SERVER_JARFILE' => 'server.jar',
]);
$this->assertTrue(false, 'This statement should not be reached.');
$this->fail('This statement should not be reached.');
} catch (ValidationException $exception) {
$this->assertCount(1, $exception->errors());
$this->assertArrayHasKey('environment.BUNGEE_VERSION', $exception->errors());
@ -135,10 +135,7 @@ class VariableValidatorServiceTest extends IntegrationTestCase
$this->assertSame('', $response->get(0)->value);
}
/**
* @return \Pterodactyl\Services\Servers\VariableValidatorService
*/
private function getService()
private function getService(): VariableValidatorService
{
return $this->app->make(VariableValidatorService::class);
}