Merge branch '1.0-develop' into develop

This commit is contained in:
Matthew Penner 2023-02-23 12:36:22 -07:00
commit 18f6611a2d
No known key found for this signature in database
60 changed files with 181 additions and 152 deletions

View file

@ -18,7 +18,7 @@ class Kernel extends ConsoleKernel
/**
* Register the commands for the application.
*/
protected function commands()
protected function commands(): void
{
$this->load(__DIR__ . '/Commands');
}
@ -26,8 +26,11 @@ class Kernel extends ConsoleKernel
/**
* Define the application's command schedule.
*/
protected function schedule(Schedule $schedule)
protected function schedule(Schedule $schedule): void
{
// https://laravel.com/docs/10.x/upgrade#redis-cache-tags
$schedule->command('cache:prune-stale-tags')->hourly();
// Execute scheduled commands for servers every minute, as if there was a normal cron running.
$schedule->command(ProcessRunnableCommand::class)->everyMinute()->withoutOverlapping();
$schedule->command(CleanServiceBackupFilesCommand::class)->daily();

View file

@ -73,7 +73,7 @@ final class Handler extends ExceptionHandler
*
* @noinspection PhpUnusedLocalVariableInspection
*/
public function register()
public function register(): void
{
if (config('app.exceptions.report_all', false)) {
$this->dontReport = [];

View file

@ -18,6 +18,7 @@ use Pterodactyl\Transformers\Api\Client\BackupTransformer;
use Pterodactyl\Http\Controllers\Api\Client\ClientApiController;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Pterodactyl\Http\Requests\Api\Client\Servers\Backups\StoreBackupRequest;
use Pterodactyl\Http\Requests\Api\Client\Servers\Backups\RestoreBackupRequest;
class BackupController extends ClientApiController
{
@ -188,12 +189,8 @@ class BackupController extends ClientApiController
*
* @throws \Throwable
*/
public function restore(Request $request, Server $server, Backup $backup): JsonResponse
public function restore(RestoreBackupRequest $request, Server $server, Backup $backup): JsonResponse
{
if (!$request->user()->can(Permission::ACTION_BACKUP_RESTORE, $server)) {
throw new AuthorizationException();
}
// Cannot restore a backup unless a server is fully installed and not currently
// processing a different backup restoration request.
if (!is_null($server->status)) {

View file

@ -86,7 +86,7 @@ class Kernel extends HttpKernel
/**
* The application's route middleware.
*/
protected $routeMiddleware = [
protected $middlewareAliases = [
'auth' => Authenticate::class,
'auth.basic' => AuthenticateWithBasicAuth::class,
'auth.session' => AuthenticateSession::class,

View file

@ -0,0 +1,19 @@
<?php
namespace Pterodactyl\Http\Requests\Api\Client\Servers\Backups;
use Pterodactyl\Models\Permission;
use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest;
class RestoreBackupRequest extends ClientApiRequest
{
public function permission(): string
{
return Permission::ACTION_BACKUP_RESTORE;
}
public function rules(): array
{
return ['truncate' => 'required|boolean'];
}
}

View file

@ -18,6 +18,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
* @property array|null $allowed_ips
* @property string|null $memo
* @property \Illuminate\Support\Carbon|null $last_used_at
* @property \Illuminate\Support\Carbon|null $expires_at
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property int $r_servers
@ -97,6 +98,10 @@ class ApiKey extends Model
protected $casts = [
'allowed_ips' => 'array',
'user_id' => 'int',
'last_used_at' => 'datetime',
'expires_at' => 'datetime',
self::CREATED_AT => 'datetime',
self::UPDATED_AT => 'datetime',
'r_' . AdminAcl::RESOURCE_USERS => 'int',
'r_' . AdminAcl::RESOURCE_ALLOCATIONS => 'int',
'r_' . AdminAcl::RESOURCE_DATABASE_HOSTS => 'int',
@ -117,6 +122,7 @@ class ApiKey extends Model
'allowed_ips',
'memo',
'last_used_at',
'expires_at',
];
/**
@ -137,6 +143,7 @@ class ApiKey extends Model
'allowed_ips' => 'nullable|array',
'allowed_ips.*' => 'string',
'last_used_at' => 'nullable|date',
'expires_at' => 'nullable|date',
'r_' . AdminAcl::RESOURCE_USERS => 'integer|min:0|max:3',
'r_' . AdminAcl::RESOURCE_ALLOCATIONS => 'integer|min:0|max:3',
'r_' . AdminAcl::RESOURCE_DATABASE_HOSTS => 'integer|min:0|max:3',
@ -148,12 +155,6 @@ class ApiKey extends Model
'r_' . AdminAcl::RESOURCE_SERVERS => 'integer|min:0|max:3',
];
protected $dates = [
self::CREATED_AT,
self::UPDATED_AT,
'last_used_at',
];
/**
* Returns the user this token is assigned to.
*/

View file

@ -42,10 +42,7 @@ class Backup extends Model
'is_locked' => 'bool',
'ignored_files' => 'array',
'bytes' => 'int',
];
protected $dates = [
'completed_at',
'completed_at' => 'datetime',
];
protected $attributes = [

View file

@ -71,14 +71,8 @@ class Schedule extends Model
'is_active' => 'boolean',
'is_processing' => 'boolean',
'only_when_online' => 'boolean',
];
/**
* Columns to mutate to a date.
*/
protected $dates = [
'last_run_at',
'next_run_at',
'last_run_at' => 'datetime',
'next_run_at' => 'datetime',
];
protected $attributes = [

View file

@ -140,11 +140,6 @@ class Server extends Model
*/
protected $with = ['allocation'];
/**
* The attributes that should be mutated to dates.
*/
protected $dates = [self::CREATED_AT, self::UPDATED_AT, 'deleted_at', 'installed_at'];
/**
* Fields that are not mass assignable.
*/
@ -194,6 +189,10 @@ class Server extends Model
'database_limit' => 'integer',
'allocation_limit' => 'integer',
'backup_limit' => 'integer',
self::CREATED_AT => 'datetime',
self::UPDATED_AT => 'datetime',
'deleted_at' => 'datetime',
'installed_at' => 'datetime',
];
/**

View file

@ -23,10 +23,8 @@ class TaskLog extends Model
'id' => 'integer',
'task_id' => 'integer',
'run_status' => 'integer',
'run_time' => 'datetime',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
/**
* The attributes that should be mutated to dates.
*/
protected $dates = ['run_time', 'created_at', 'updated_at'];
}

View file

@ -138,10 +138,9 @@ class User extends Model implements
'root_admin' => 'boolean',
'use_totp' => 'boolean',
'gravatar' => 'boolean',
'totp_authenticated_at' => 'datetime',
];
protected $dates = ['totp_authenticated_at'];
/**
* The attributes excluded from the model's JSON form.
*/

View file

@ -15,7 +15,7 @@ class AppServiceProvider extends ServiceProvider
/**
* Bootstrap any application services.
*/
public function boot()
public function boot(): void
{
Schema::defaultStringLength(191);
@ -48,7 +48,7 @@ class AppServiceProvider extends ServiceProvider
/**
* Register application service providers.
*/
public function register()
public function register(): void
{
// Only load the settings service provider if the environment
// is configured to allow it.

View file

@ -17,14 +17,12 @@ class AuthServiceProvider extends ServiceProvider
Server::class => ServerPolicy::class,
];
public function boot()
public function boot(): void
{
Sanctum::usePersonalAccessTokenModel(ApiKey::class);
$this->registerPolicies();
}
public function register()
public function register(): void
{
Sanctum::ignoreMigrations();
}

View file

@ -11,7 +11,7 @@ class BackupsServiceProvider extends ServiceProvider implements DeferrableProvid
/**
* Register the S3 backup disk.
*/
public function register()
public function register(): void
{
$this->app->singleton(BackupManager::class, function ($app) {
return new BackupManager($app);

View file

@ -9,7 +9,7 @@ class BladeServiceProvider extends ServiceProvider
/**
* Perform post-registration booting of services.
*/
public function boot()
public function boot(): void
{
$this->app->make('blade.compiler')
->directive('datetimeHuman', function ($expression) {

View file

@ -10,7 +10,7 @@ class BroadcastServiceProvider extends ServiceProvider
/**
* Bootstrap any application services.
*/
public function boot()
public function boot(): void
{
Broadcast::routes();

View file

@ -11,7 +11,7 @@ class HashidsServiceProvider extends ServiceProvider
/**
* Register the ability to use Hashids.
*/
public function register()
public function register(): void
{
$this->app->singleton(HashidsInterface::class, function () {
return new Hashids(

View file

@ -43,7 +43,7 @@ class RepositoryServiceProvider extends ServiceProvider
/**
* Register all the repository bindings.
*/
public function register()
public function register(): void
{
// Eloquent Repositories
$this->app->bind(AllocationRepositoryInterface::class, AllocationRepository::class);

View file

@ -19,7 +19,7 @@ class RouteServiceProvider extends ServiceProvider
/**
* Define your route model bindings, pattern filters, etc.
*/
public function boot()
public function boot(): void
{
$this->configureRateLimiting();
@ -68,7 +68,7 @@ class RouteServiceProvider extends ServiceProvider
/**
* Configure the rate limiters for the application.
*/
protected function configureRateLimiting()
protected function configureRateLimiting(): void
{
// Authentication rate limiting. For login and checkpoint endpoints we'll apply
// a limit of 10 requests per minute, for the forgot password endpoint apply a

View file

@ -57,7 +57,7 @@ class SettingsServiceProvider extends ServiceProvider
/**
* Boot the service provider.
*/
public function boot(ConfigRepository $config, Encrypter $encrypter, Log $log, SettingsRepositoryInterface $settings)
public function boot(ConfigRepository $config, Encrypter $encrypter, Log $log, SettingsRepositoryInterface $settings): void
{
// Only set the email driver settings from the database if we
// are configured using SMTP as the driver.

View file

@ -10,7 +10,7 @@ class ViewComposerServiceProvider extends ServiceProvider
/**
* Register bindings in the container.
*/
public function boot()
public function boot(): void
{
$this->app->make('view')->composer('*', AssetComposer::class);
}

View file

@ -17,54 +17,54 @@
}
],
"require": {
"php": "^8.0.2 || ^8.1 || ^8.2",
"php": "^8.1 || ^8.2",
"ext-json": "*",
"ext-mbstring": "*",
"ext-pdo": "*",
"ext-pdo_mysql": "*",
"ext-posix": "*",
"ext-zip": "*",
"aws/aws-sdk-php": "~3.253",
"doctrine/dbal": "~3.5",
"guzzlehttp/guzzle": "~7.5",
"hashids/hashids": "~4.1",
"laracasts/utilities": "~3.2",
"laravel/framework": "~9.43",
"laravel/helpers": "~1.5",
"laravel/sanctum": "~3.0",
"laravel/tinker": "~2.7",
"laravel/ui": "~4.1",
"lcobucci/jwt": "~4.2",
"league/flysystem-aws-s3-v3": "~3.10",
"league/flysystem-memory": "~3.10",
"aws/aws-sdk-php": "~3.260.1",
"doctrine/dbal": "~3.6.0",
"guzzlehttp/guzzle": "~7.5.0",
"hashids/hashids": "~5.0.0",
"laracasts/utilities": "~3.2.2",
"laravel/framework": "~10.1.3",
"laravel/helpers": "~1.6.0",
"laravel/sanctum": "~3.2.1",
"laravel/tinker": "~2.8.1",
"laravel/ui": "~4.2.1",
"lcobucci/jwt": "~4.3.0",
"league/flysystem-aws-s3-v3": "~3.12.2",
"league/flysystem-memory": "~3.10.3",
"matriphe/iso-639": "~1.2",
"phpseclib/phpseclib": "~3.0",
"pragmarx/google2fa": "~8.0",
"predis/predis": "~2.0",
"psr/cache": "~3.0",
"s1lentium/iptools": "~1.1",
"spatie/laravel-fractal": "~6.0",
"spatie/laravel-query-builder": "~5.1",
"staudenmeir/belongs-to-through": "~2.12",
"symfony/http-client": "~6.0",
"symfony/mailgun-mailer": "~6.0",
"symfony/postmark-mailer": "~6.0",
"symfony/yaml": "~6.0",
"webmozart/assert": "~1.11"
"phpseclib/phpseclib": "~3.0.18",
"pragmarx/google2fa": "~8.0.0",
"predis/predis": "~2.1.1",
"prologue/alerts": "~1.1.0",
"psr/cache": "~3.0.0",
"s1lentium/iptools": "~1.2.0",
"spatie/laravel-fractal": "~6.0.3",
"spatie/laravel-query-builder": "~5.1.2",
"staudenmeir/belongs-to-through": "~2.13",
"symfony/http-client": "~6.2.6",
"symfony/mailgun-mailer": "~6.2.5",
"symfony/postmark-mailer": "~6.2.5",
"symfony/yaml": "~6.2.5",
"webmozart/assert": "~1.11.0"
},
"require-dev": {
"barryvdh/laravel-ide-helper": "~2.12.3",
"fakerphp/faker": "~1.20",
"friendsofphp/php-cs-fixer": "~3.11",
"itsgoingd/clockwork": "~5.1",
"laravel/sail": "~1.16",
"mockery/mockery": "~1.5",
"nunomaduro/collision": "~6.3",
"nunomaduro/larastan": "^2.0",
"phpstan/phpstan": "~1.9",
"php-mock/php-mock-phpunit": "~2.6",
"phpunit/phpunit": "~9.5",
"spatie/laravel-ignition": "~1.5"
"barryvdh/laravel-ide-helper": "~2.13.0",
"fakerphp/faker": "~1.21.0",
"friendsofphp/php-cs-fixer": "~3.14.4",
"itsgoingd/clockwork": "~5.1.12",
"laravel/sail": "~1.21.0",
"mockery/mockery": "~1.5.1",
"nunomaduro/collision": "~7.0.5",
"nunomaduro/larastan": "~2.4.1",
"phpstan/phpstan": "~1.10.1",
"phpunit/phpunit": "~10.0.11",
"spatie/laravel-ignition": "~2.0.0"
},
"autoload": {
"files": [
@ -84,24 +84,25 @@
"scripts": {
"cs:fix": "php-cs-fixer fix",
"cs:check": "php-cs-fixer fix --dry-run --diff --verbose",
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi || true"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover || true"
"@php artisan key:generate --ansi"
]
},
"prefer-stable": true,
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"platform": {
"php": "8.0.2"
"php": "8.1.0"
}
}
},
"minimum-stability": "stable",
"prefer-stable": true
}

View file

@ -27,7 +27,7 @@ return [
| sending an e-mail. You will specify which one you are using for your
| mailers below. You are free to add additional mailers as required.
|
| Supported: "smtp", "sendmail", "mailgun", "ses",
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
| "postmark", "log", "array", "failover"
|
*/

View file

@ -34,7 +34,7 @@ class EggVariableFactory extends Factory
/**
* Indicate that the egg variable is viewable.
*/
public function viewable(): Factory
public function viewable(): static
{
return $this->state(function (array $attributes) {
return [
@ -46,7 +46,7 @@ class EggVariableFactory extends Factory
/**
* Indicate that the egg variable is editable.
*/
public function editable(): Factory
public function editable(): static
{
return $this->state(function (array $attributes) {
return [

View file

@ -41,7 +41,7 @@ class UserFactory extends Factory
/**
* Indicate that the user is an admin.
*/
public function admin(): Factory
public function admin(): static
{
return $this->state(['root_admin' => true]);
}

View file

@ -0,0 +1,27 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
return new class () extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('api_keys', function (Blueprint $table) {
$table->timestamp('expires_at')->nullable()->after('last_used_at');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('api_keys', function (Blueprint $table) {
$table->dropColumn('expires_at');
});
}
};

View file

@ -4,9 +4,8 @@
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="bootstrap/tests.php"
colors="true"
printerClass="NunoMaduro\Collision\Adapters\Phpunit\Printer"
>
<coverage processUncoveredFiles="true">
<coverage>
<include>
<directory suffix=".php">./app</directory>
</include>

View file

@ -47,7 +47,7 @@ export const rawDataToFileObject = (data: FractalResponseData): FileObject => ({
isEditable: function () {
if (this.isArchiveType() || !this.isFile) return false;
const matches = ['application/jar', 'application/octet-stream', 'inode/directory', /^image\//];
const matches = ['application/jar', 'application/octet-stream', 'inode/directory', /^image\/(?!svg\+xml)/];
return matches.every(m => !this.mimetype.match(m));
},

View file

@ -255,7 +255,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase
* Endpoints that should return a 403 error when the key does not have write
* permissions for user management.
*/
public function userWriteEndpointsDataProvider(): array
public static function userWriteEndpointsDataProvider(): array
{
return [
['postJson', '/api/application/users'],

View file

@ -241,7 +241,7 @@ class ApiKeyControllerTest extends ClientApiIntegrationTestCase
* Provides some different IP address combinations that can be used when
* testing that we accept the expected IP values.
*/
public function validIPAddressDataProvider(): array
public static function validIPAddressDataProvider(): array
{
return [
[[]],

View file

@ -331,7 +331,7 @@ class ClientControllerTest extends ClientApiIntegrationTestCase
$response->assertJsonPath('data.0.attributes.relationships.allocations.data.0.attributes.notes', null);
}
public function filterTypeDataProvider(): array
public static function filterTypeDataProvider(): array
{
return [['admin'], ['admin-all']];
}

View file

@ -46,7 +46,7 @@ class AllocationAuthorizationTest extends ClientApiIntegrationTestCase
$this->actingAs($user)->json($method, $this->link($server3, '/network/allocations/' . $allocation3->id . $endpoint))->assertNotFound();
}
public function methodDataProvider(): array
public static function methodDataProvider(): array
{
return [
['POST', ''],

View file

@ -86,7 +86,7 @@ class CreateNewAllocationTest extends ClientApiIntegrationTestCase
->assertJsonPath('errors.0.detail', 'Cannot assign additional allocations to this server: limit has been reached.');
}
public function permissionDataProvider(): array
public static function permissionDataProvider(): array
{
return [[[Permission::ACTION_ALLOCATION_CREATE]], [[]]];
}

View file

@ -98,10 +98,7 @@ class DeleteAllocationTest extends ClientApiIntegrationTestCase
$this->actingAs($user)->deleteJson($this->link($server, "/network/allocations/{$server2->allocation_id}"))->assertNotFound();
}
/**
* @return array
*/
public function permissionDataProvider()
public static function permissionDataProvider(): array
{
return [[[Permission::ACTION_ALLOCATION_DELETE]], [[]]];
}

View file

@ -54,7 +54,7 @@ class BackupAuthorizationTest extends ClientApiIntegrationTestCase
$this->actingAs($user)->json($method, $this->link($server3, '/backups/' . $backup3->uuid . $endpoint))->assertNotFound();
}
public function methodDataProvider(): array
public static function methodDataProvider(): array
{
return [
['GET', ''],

View file

@ -58,7 +58,7 @@ class DatabaseAuthorizationTest extends ClientApiIntegrationTestCase
$this->actingAs($user)->json($method, $this->link($server3, '/databases/' . $hashids->encode($database3->id) . $endpoint))->assertNotFound();
}
public function methodDataProvider(): array
public static function methodDataProvider(): array
{
return [
['POST', '/rotate-password'],

View file

@ -133,7 +133,7 @@ class NetworkAllocationControllerTest extends ClientApiIntegrationTestCase
->assertForbidden();
}
public function updatePermissionsDataProvider(): array
public static function updatePermissionsDataProvider(): array
{
return [[[]], [[Permission::ACTION_ALLOCATION_UPDATE]]];
}

View file

@ -72,7 +72,7 @@ class PowerControllerTest extends ClientApiIntegrationTestCase
/**
* Returns invalid permission combinations for a given power action.
*/
public function invalidPermissionDataProvider(): array
public static function invalidPermissionDataProvider(): array
{
return [
['start', [Permission::ACTION_CONTROL_STOP, Permission::ACTION_CONTROL_RESTART]],
@ -83,7 +83,7 @@ class PowerControllerTest extends ClientApiIntegrationTestCase
];
}
public function validPowerActionDataProvider(): array
public static function validPowerActionDataProvider(): array
{
return [
['start', Permission::ACTION_CONTROL_START],

View file

@ -89,7 +89,7 @@ class CreateServerScheduleTest extends ClientApiIntegrationTestCase
->assertForbidden();
}
public function permissionsDataProvider(): array
public static function permissionsDataProvider(): array
{
return [[[]], [[Permission::ACTION_SCHEDULE_CREATE]]];
}

View file

@ -77,7 +77,7 @@ class DeleteServerScheduleTest extends ClientApiIntegrationTestCase
$this->assertDatabaseHas('schedules', ['id' => $schedule->id]);
}
public function permissionsDataProvider(): array
public static function permissionsDataProvider(): array
{
return [[[]], [[Permission::ACTION_SCHEDULE_DELETE]]];
}

View file

@ -64,7 +64,7 @@ class ExecuteScheduleTest extends ClientApiIntegrationTestCase
$this->actingAs($user)->postJson($this->link($schedule, '/execute'))->assertForbidden();
}
public function permissionsDataProvider(): array
public static function permissionsDataProvider(): array
{
return [[[]], [[Permission::ACTION_SCHEDULE_UPDATE]]];
}

View file

@ -89,7 +89,7 @@ class GetServerSchedulesTest extends ClientApiIntegrationTestCase
->assertForbidden();
}
public function permissionsDataProvider(): array
public static function permissionsDataProvider(): array
{
return [
[[], false],

View file

@ -54,7 +54,7 @@ class ScheduleAuthorizationTest extends ClientApiIntegrationTestCase
$this->actingAs($user)->json($method, $this->link($server3, '/schedules/' . $schedule3->id . $endpoint))->assertNotFound();
}
public function methodDataProvider(): array
public static function methodDataProvider(): array
{
return [
['GET', ''],

View file

@ -109,7 +109,7 @@ class UpdateServerScheduleTest extends ClientApiIntegrationTestCase
$this->assertFalse($schedule->is_processing);
}
public function permissionsDataProvider(): array
public static function permissionsDataProvider(): array
{
return [[[]], [[Permission::ACTION_SCHEDULE_UPDATE]]];
}

View file

@ -170,7 +170,7 @@ class CreateServerScheduleTaskTest extends ClientApiIntegrationTestCase
->assertForbidden();
}
public function permissionsDataProvider(): array
public static function permissionsDataProvider(): array
{
return [[[]], [[Permission::ACTION_SCHEDULE_UPDATE]]];
}

View file

@ -112,12 +112,12 @@ class SettingsControllerTest extends ClientApiIntegrationTestCase
$this->assertTrue($server->isInstalled());
}
public function renamePermissionsDataProvider(): array
public static function renamePermissionsDataProvider(): array
{
return [[[]], [[Permission::ACTION_SETTINGS_RENAME]]];
}
public function reinstallPermissionsDataProvider(): array
public static function reinstallPermissionsDataProvider(): array
{
return [[[]], [[Permission::ACTION_SETTINGS_REINSTALL]]];
}

View file

@ -58,7 +58,7 @@ class GetStartupAndVariablesTest extends ClientApiIntegrationTestCase
$this->actingAs($user2)->getJson($this->link($server) . '/startup')->assertNotFound();
}
public function permissionsDataProvider(): array
public static function permissionsDataProvider(): array
{
return [[[]], [[Permission::ACTION_STARTUP_READ]]];
}

View file

@ -149,7 +149,7 @@ class UpdateStartupVariableTest extends ClientApiIntegrationTestCase
$this->actingAs($user2)->putJson($this->link($server) . '/startup/variable')->assertNotFound();
}
public function permissionsDataProvider(): array
public static function permissionsDataProvider(): array
{
return [[[]], [[Permission::ACTION_STARTUP_UPDATE]]];
}

View file

@ -155,7 +155,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase
$response->assertJsonPath('errors.0.detail', 'A user with that email address is already assigned as a subuser for this server.');
}
public function permissionsDataProvider(): array
public static function permissionsDataProvider(): array
{
return [[[]], [[Permission::ACTION_USER_CREATE]]];
}

View file

@ -49,7 +49,7 @@ class SubuserAuthorizationTest extends ClientApiIntegrationTestCase
$this->actingAs($user)->json($method, $this->link($server3, '/users/' . $internal->uuid))->assertNotFound();
}
public function methodDataProvider(): array
public static function methodDataProvider(): array
{
return [['GET'], ['POST'], ['DELETE']];
}

View file

@ -213,7 +213,7 @@ class SftpAuthenticationControllerTest extends IntegrationTestCase
$this->post('/api/remote/sftp/auth', $data)->assertForbidden();
}
public function authorizationTypeDataProvider(): array
public static function authorizationTypeDataProvider(): array
{
return [
'password auth' => ['password'],
@ -221,7 +221,7 @@ class SftpAuthenticationControllerTest extends IntegrationTestCase
];
}
public function serverStateDataProvider(): array
public static function serverStateDataProvider(): array
{
return [
'installing' => [Server::STATUS_INSTALLING],

View file

@ -37,7 +37,7 @@ class RunTaskJobTest extends IntegrationTestCase
$job = new RunTaskJob($task);
Bus::dispatchNow($job);
Bus::dispatchSync($job);
$task->refresh();
$schedule->refresh();
@ -61,7 +61,7 @@ class RunTaskJobTest extends IntegrationTestCase
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Invalid task action provided: foobar');
Bus::dispatchNow($job);
Bus::dispatchSync($job);
}
/**
@ -95,7 +95,7 @@ class RunTaskJobTest extends IntegrationTestCase
}))->andReturnSelf();
$mock->expects('send')->with('start')->andReturn(new Response());
Bus::dispatchNow(new RunTaskJob($task, $isManualRun));
Bus::dispatchSync(new RunTaskJob($task, $isManualRun));
$task->refresh();
$schedule->refresh();
@ -133,7 +133,7 @@ class RunTaskJobTest extends IntegrationTestCase
$this->expectException(DaemonConnectionException::class);
}
Bus::dispatchNow(new RunTaskJob($task));
Bus::dispatchSync(new RunTaskJob($task));
if ($continueOnFailure) {
$task->refresh();
@ -165,7 +165,7 @@ class RunTaskJobTest extends IntegrationTestCase
'payload' => 'start',
]);
Bus::dispatchNow(new RunTaskJob($task));
Bus::dispatchSync(new RunTaskJob($task));
$task->refresh();
$schedule->refresh();
@ -175,7 +175,7 @@ class RunTaskJobTest extends IntegrationTestCase
$this->assertTrue(Carbon::now()->isSameAs(\DateTimeInterface::ATOM, $schedule->last_run_at));
}
public function isManualRunDataProvider(): array
public static function isManualRunDataProvider(): array
{
return [[true], [false]];
}

View file

@ -194,7 +194,7 @@ class DatabaseManagementServiceTest extends IntegrationTestCase
$this->assertDatabaseMissing('databases', ['server_id' => $server->id]);
}
public function invalidDataDataProvider(): array
public static function invalidDataDataProvider(): array
{
return [
[[]],

View file

@ -141,7 +141,7 @@ class DeployServerDatabaseServiceTest extends IntegrationTestCase
$this->assertInstanceOf(Database::class, $response);
}
public function invalidDataProvider(): array
public static function invalidDataProvider(): array
{
return [
[['remote' => '%']],

View file

@ -148,7 +148,7 @@ class ProcessScheduleServiceTest extends IntegrationTestCase
$this->assertDatabaseHas('tasks', ['id' => $task->id, 'is_queued' => false]);
}
public function dispatchNowDataProvider(): array
public static function dispatchNowDataProvider(): array
{
return [[true], [false]];
}

View file

@ -17,7 +17,7 @@ class EnvironmentWriterTraitTest extends TestCase
$this->assertSame($expected, $output);
}
public function variableDataProvider(): array
public static function variableDataProvider(): array
{
return [
['foo', 'foo'],

View file

@ -19,7 +19,7 @@ class IsDigitTest extends TestCase
/**
* Provide data to test against the helper function.
*/
public function helperDataProvider(): array
public static function helperDataProvider(): array
{
return [
[true, false],

View file

@ -138,7 +138,7 @@ class DaemonAuthenticateTest extends MiddlewareTestCase
*
* @return array|\string[][]
*/
public function badTokenDataProvider(): array
public static function badTokenDataProvider(): array
{
return [
['foo'],

View file

@ -38,7 +38,7 @@ class UsernameTest extends TestCase
/**
* Provide valid usernames.
*/
public function validUsernameDataProvider(): array
public static function validUsernameDataProvider(): array
{
return [
['username'],
@ -54,7 +54,7 @@ class UsernameTest extends TestCase
/**
* Provide invalid usernames.
*/
public function invalidUsernameDataProvider(): array
public static function invalidUsernameDataProvider(): array
{
return [
['_username'],

View file

@ -31,7 +31,7 @@ class AdminAclTest extends TestCase
/**
* Provide valid and invalid permissions combos for testing.
*/
public function permissionsDataProvider(): array
public static function permissionsDataProvider(): array
{
return [
[AdminAcl::READ, AdminAcl::READ, true],