Laravel 10 (#4706)

This commit is contained in:
Matthew Penner 2023-02-23 12:30:16 -07:00 committed by GitHub
parent ad4ddc6300
commit 1d38b4f0e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
136 changed files with 1735 additions and 2008 deletions

View file

@ -2,7 +2,6 @@
namespace Pterodactyl\Tests\Integration\Services\Servers;
use Mockery;
use Mockery\MockInterface;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
@ -108,7 +107,7 @@ class BuildModificationServiceTest extends IntegrationTestCase
{
$server = $this->createServerModel();
$this->daemonServerRepository->expects('setServer')->with(Mockery::on(function (Server $s) use ($server) {
$this->daemonServerRepository->expects('setServer')->with(\Mockery::on(function (Server $s) use ($server) {
return $s->id === $server->id;
}))->andReturnSelf();

View file

@ -2,7 +2,6 @@
namespace Pterodactyl\Tests\Integration\Services\Servers;
use Mockery;
use Mockery\MockInterface;
use Pterodactyl\Models\Egg;
use GuzzleHttp\Psr7\Request;
@ -42,7 +41,7 @@ class ServerCreationServiceTest extends IntegrationTestCase
->where('name', 'Bungeecord')
->firstOrFail();
$this->daemonServerRepository = Mockery::mock(DaemonServerRepository::class);
$this->daemonServerRepository = \Mockery::mock(DaemonServerRepository::class);
$this->swap(DaemonServerRepository::class, $this->daemonServerRepository);
}

View file

@ -2,8 +2,6 @@
namespace Pterodactyl\Tests\Integration\Services\Servers;
use Mockery;
use Exception;
use Mockery\MockInterface;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
@ -35,8 +33,8 @@ class ServerDeletionServiceTest extends IntegrationTestCase
// There will be some log calls during this test, don't actually write to the disk.
config()->set('logging.default', 'null');
$this->daemonServerRepository = Mockery::mock(DaemonServerRepository::class);
$this->databaseManagementService = Mockery::mock(DatabaseManagementService::class);
$this->daemonServerRepository = \Mockery::mock(DaemonServerRepository::class);
$this->databaseManagementService = \Mockery::mock(DatabaseManagementService::class);
$this->app->instance(DaemonServerRepository::class, $this->daemonServerRepository);
$this->app->instance(DatabaseManagementService::class, $this->databaseManagementService);
@ -120,11 +118,11 @@ class ServerDeletionServiceTest extends IntegrationTestCase
$server->refresh();
$this->daemonServerRepository->expects('setServer->delete')->withNoArgs()->andReturnUndefined();
$this->databaseManagementService->expects('delete')->with(Mockery::on(function ($value) use ($db) {
$this->databaseManagementService->expects('delete')->with(\Mockery::on(function ($value) use ($db) {
return $value instanceof Database && $value->id === $db->id;
}))->andThrows(new Exception());
}))->andThrows(new \Exception());
$this->expectException(Exception::class);
$this->expectException(\Exception::class);
$this->getService()->handle($server);
$this->assertDatabaseHas('servers', ['id' => $server->id]);
@ -145,9 +143,9 @@ class ServerDeletionServiceTest extends IntegrationTestCase
$server->refresh();
$this->daemonServerRepository->expects('setServer->delete')->withNoArgs()->andReturnUndefined();
$this->databaseManagementService->expects('delete')->with(Mockery::on(function ($value) use ($db) {
$this->databaseManagementService->expects('delete')->with(\Mockery::on(function ($value) use ($db) {
return $value instanceof Database && $value->id === $db->id;
}))->andThrows(new Exception());
}))->andThrows(new \Exception());
$this->getService()->withForce(true)->handle($server);

View file

@ -34,7 +34,7 @@ class StartupModificationServiceTest extends IntegrationTestCase
]);
$this->fail('This assertion should not be called.');
} catch (Exception $exception) {
} catch (\Exception $exception) {
$this->assertInstanceOf(ValidationException::class, $exception);
/** @var \Illuminate\Validation\ValidationException $exception */

View file

@ -2,9 +2,7 @@
namespace Pterodactyl\Tests\Integration\Services\Servers;
use Mockery;
use Mockery\MockInterface;
use InvalidArgumentException;
use Pterodactyl\Models\Server;
use Pterodactyl\Services\Servers\SuspensionService;
use Pterodactyl\Tests\Integration\IntegrationTestCase;
@ -21,7 +19,7 @@ class SuspensionServiceTest extends IntegrationTestCase
{
parent::setUp();
$this->repository = Mockery::mock(DaemonServerRepository::class);
$this->repository = \Mockery::mock(DaemonServerRepository::class);
$this->app->instance(DaemonServerRepository::class, $this->repository);
}
@ -60,7 +58,7 @@ class SuspensionServiceTest extends IntegrationTestCase
{
$server = $this->createServerModel();
$this->expectException(InvalidArgumentException::class);
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Expected one of: "suspend", "unsuspend". Got: "foo"');
$this->getService()->toggle($server, 'foo');