Upgrade to Laravel 10 & phpunit 10

This commit is contained in:
Bubka 2023-08-01 11:26:58 +02:00
parent 0e7df2e664
commit fe5d807170
19 changed files with 2709 additions and 1296 deletions

7
.gitignore vendored
View File

@ -1,3 +1,4 @@
/.phpunit.cache
/node_modules /node_modules
/public/build /public/build
/public/hot /public/hot
@ -9,11 +10,15 @@
/tests/EndToEnd/**/output.xml /tests/EndToEnd/**/output.xml
/tests/EndToEnd/**/*.png /tests/EndToEnd/**/*.png
/vendor /vendor
/.vscode
.env .env
.env.backup
.env.production
.phpunit.result.cache .phpunit.result.cache
Homestead.json Homestead.json
Homestead.yaml Homestead.yaml
auth.json auth.json
npm-debug.log npm-debug.log
yarn-error.log yarn-error.log
/.fleet
/.idea
/.vscode

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,7 @@ class Kernel extends ConsoleKernel
*/ */
protected function schedule(Schedule $schedule) protected function schedule(Schedule $schedule)
{ {
// $schedule->command('cache:prune-stale-tags')->hourly();
} }
/** /**

View File

@ -16,9 +16,7 @@ class Kernel extends HttpKernel
protected $middleware = [ protected $middleware = [
// \App\Http\Middleware\TrustHosts::class, // \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class, \App\Http\Middleware\TrustProxies::class,
// \Fruitcake\Cors\HandleCors::class,
\Illuminate\Http\Middleware\HandleCors::class, \Illuminate\Http\Middleware\HandleCors::class,
// \App\Http\Middleware\CheckForMaintenanceMode::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class, \App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class, \App\Http\Middleware\TrimStrings::class,
@ -68,11 +66,11 @@ class Kernel extends HttpKernel
/** /**
* The application's route middleware. * The application's route middleware.
* *
* These middleware may be assigned to groups or used individually. * Aliases may be used instead of class names to conveniently assign middleware to routes and groups.
* *
* @var array<string, class-string|string> * @var array<string, class-string|string>
*/ */
protected $routeMiddleware = [ protected $middlewareAliases = [
'auth' => \App\Http\Middleware\Authenticate::class, 'auth' => \App\Http\Middleware\Authenticate::class,
'admin' => \App\Http\Middleware\AdminOnly::class, 'admin' => \App\Http\Middleware\AdminOnly::class,
'guest' => \App\Http\Middleware\RejectIfAuthenticated::class, 'guest' => \App\Http\Middleware\RejectIfAuthenticated::class,

View File

@ -5,16 +5,16 @@ namespace App\Http\Middleware;
use Closure; use Closure;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Symfony\Component\HttpFoundation\Response;
class RejectIfAuthenticated class RejectIfAuthenticated
{ {
/** /**
* Handle an incoming request. * Handle an incoming request.
* *
* @param string|null ...$guards * @param \Closure(\Illuminate\Http\Request) : (\Symfony\Component\HttpFoundation\Response) $next
* @return mixed
*/ */
public function handle(Request $request, Closure $next, ...$guards) public function handle(Request $request, Closure $next, string ...$guards) : Response
{ {
$guards = empty($guards) ? [null] : $guards; $guards = empty($guards) ? [null] : $guards;

View File

@ -70,8 +70,6 @@ class AuthServiceProvider extends ServiceProvider
*/ */
public function boot() public function boot()
{ {
$this->registerPolicies();
// Register a custom provider for reverse-proxy authentication // Register a custom provider for reverse-proxy authentication
Auth::provider('remote-user', function ($app, array $config) { Auth::provider('remote-user', function ($app, array $config) {
// Return an instance of Illuminate\Contracts\Auth\UserProvider... // Return an instance of Illuminate\Contracts\Auth\UserProvider...

View File

@ -48,4 +48,12 @@ class EventServiceProvider extends ServiceProvider
{ {
// //
} }
/**
* Determine if events and listeners should be automatically discovered.
*/
public function shouldDiscoverEvents() : bool
{
return false;
}
} }

View File

@ -17,7 +17,7 @@ class MigrationServiceProvider extends ServiceProvider
* *
* @return void * @return void
*/ */
public function register() public function register() : void
{ {
$this->app->bind(MigratorFactoryInterface::class, MigratorFactory::class); $this->app->bind(MigratorFactoryInterface::class, MigratorFactory::class);

View File

@ -30,10 +30,8 @@ class RouteServiceProvider extends ServiceProvider
/** /**
* Define your route model bindings, pattern filters, etc. * Define your route model bindings, pattern filters, etc.
*
* @return void
*/ */
public function boot() public function boot() : void
{ {
Route::pattern('settingName', '[a-zA-Z]+'); Route::pattern('settingName', '[a-zA-Z]+');
$this->configureRateLimiting(); $this->configureRateLimiting();

View File

@ -28,10 +28,10 @@
"jackiedo/dotenv-editor": "^2.1", "jackiedo/dotenv-editor": "^2.1",
"khanamiryan/qrcode-detector-decoder": "^2.0.2", "khanamiryan/qrcode-detector-decoder": "^2.0.2",
"laragear/webauthn": "^1.2.0", "laragear/webauthn": "^1.2.0",
"laravel/framework": "^9.0", "laravel/framework": "^10.10",
"laravel/passport": "^11.2", "laravel/passport": "^11.2",
"laravel/tinker": "^2.7", "laravel/tinker": "^2.8",
"laravel/ui": "^3.0", "laravel/ui": "^4.2",
"paragonie/constant_time_encoding": "^2.6", "paragonie/constant_time_encoding": "^2.6",
"spatie/eloquent-sortable": "^4.0.1", "spatie/eloquent-sortable": "^4.0.1",
"spomky-labs/otphp": "^11.0" "spomky-labs/otphp": "^11.0"
@ -41,11 +41,11 @@
"fakerphp/faker": "^1.21", "fakerphp/faker": "^1.21",
"laravel/pint": "^1.6", "laravel/pint": "^1.6",
"mockery/mockery": "^1.5", "mockery/mockery": "^1.5",
"nunomaduro/collision": "^6.1", "nunomaduro/collision": "^7.0",
"nunomaduro/larastan": "^2.5", "nunomaduro/larastan": "^2.5",
"phpstan/phpstan": "^1.10", "phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9.6", "phpunit/phpunit": "^10.1",
"spatie/laravel-ignition": "^1.6" "spatie/laravel-ignition": "^2.0"
}, },
"config": { "config": {
"optimize-autoloader": true, "optimize-autoloader": true,
@ -69,13 +69,16 @@
"Tests\\": "tests/" "Tests\\": "tests/"
} }
}, },
"minimum-stability": "dev", "minimum-stability": "stable",
"prefer-stable": true, "prefer-stable": true,
"scripts": { "scripts": {
"post-autoload-dump": [ "post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi" "@php artisan package:discover --ansi"
], ],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [ "post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
], ],

1220
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
<?php <?php
use Illuminate\Support\Facades\Facade; use Illuminate\Support\Facades\Facade;
use Illuminate\Support\ServiceProvider;
return [ return [
@ -154,34 +155,7 @@ return [
| |
*/ */
'providers' => [ 'providers' => ServiceProvider::defaultProviders()->merge([
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
/* /*
* Package Service Providers... * Package Service Providers...
*/ */
@ -196,7 +170,7 @@ return [
App\Providers\RouteServiceProvider::class, App\Providers\RouteServiceProvider::class,
App\Providers\TwoFAuthServiceProvider::class, App\Providers\TwoFAuthServiceProvider::class,
App\Providers\MigrationServiceProvider::class, App\Providers\MigrationServiceProvider::class,
], ])->toArray(),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

View File

@ -110,10 +110,14 @@ return [
| than one user table or model in the application and you want to have | than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types. | separate password reset settings based on the specific user types.
| |
| The expire time is the number of minutes that each reset token will be | The expiry time is the number of minutes that each reset token will be
| considered valid. This security feature keeps tokens short-lived so | considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed. | they have less time to be guessed. You may change this as needed.
| |
| The throttle setting is the number of seconds a user must wait before
| generating more password reset tokens. This prevents the user from
| quickly generating a very large amount of password reset tokens.
|
*/ */
'passwords' => [ 'passwords' => [

View File

@ -36,6 +36,7 @@ return [
'secret' => env('PUSHER_APP_SECRET'), 'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'), 'app_id' => env('PUSHER_APP_ID'),
'options' => [ 'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', 'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com',
'port' => env('PUSHER_PORT', 443), 'port' => env('PUSHER_PORT', 443),
'scheme' => env('PUSHER_SCHEME', 'https'), 'scheme' => env('PUSHER_SCHEME', 'https'),

View File

@ -52,6 +52,7 @@ return [
'file' => [ 'file' => [
'driver' => 'file', 'driver' => 'file',
'path' => storage_path('framework/cache/data'), 'path' => storage_path('framework/cache/data'),
'lock_path' => storage_path('framework/cache/data'),
], ],
'memcached' => [ 'memcached' => [

View File

@ -3,6 +3,7 @@
use Monolog\Handler\NullHandler; use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler; use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler; use Monolog\Handler\SyslogUdpHandler;
use Monolog\Processor\PsrLogMessageProcessor;
return [ return [
@ -61,6 +62,7 @@ return [
'driver' => 'single', 'driver' => 'single',
'path' => storage_path('logs/laravel.log'), 'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'), 'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
], ],
'daily' => [ 'daily' => [
@ -68,6 +70,7 @@ return [
'path' => storage_path('logs/laravel.log'), 'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'), 'level' => env('LOG_LEVEL', 'debug'),
'days' => 7, 'days' => 7,
'replace_placeholders' => true,
], ],
'slack' => [ 'slack' => [
@ -76,6 +79,7 @@ return [
'username' => 'Laravel Log', 'username' => 'Laravel Log',
'emoji' => ':boom:', 'emoji' => ':boom:',
'level' => env('LOG_LEVEL', 'critical'), 'level' => env('LOG_LEVEL', 'critical'),
'replace_placeholders' => true,
], ],
'papertrail' => [ 'papertrail' => [
@ -87,6 +91,7 @@ return [
'port' => env('PAPERTRAIL_PORT'), 'port' => env('PAPERTRAIL_PORT'),
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'), 'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
], ],
'processors' => [PsrLogMessageProcessor::class],
], ],
'stderr' => [ 'stderr' => [
@ -97,16 +102,20 @@ return [
'with' => [ 'with' => [
'stream' => 'php://stderr', 'stream' => 'php://stderr',
], ],
'processors' => [PsrLogMessageProcessor::class],
], ],
'syslog' => [ 'syslog' => [
'driver' => 'syslog', 'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'), 'level' => env('LOG_LEVEL', 'debug'),
'facility' => LOG_USER,
'replace_placeholders' => true,
], ],
'errorlog' => [ 'errorlog' => [
'driver' => 'errorlog', 'driver' => 'errorlog',
'level' => env('LOG_LEVEL', 'debug'), 'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
], ],
'null' => [ 'null' => [

View File

@ -28,7 +28,7 @@ return [
| sending an e-mail. You will specify which one you are using for your | 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. | 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" | "postmark", "log", "array", "failover"
| |
*/ */
@ -36,6 +36,7 @@ return [
'mailers' => [ 'mailers' => [
'smtp' => [ 'smtp' => [
'transport' => 'smtp', 'transport' => 'smtp',
'url' => env('MAIL_URL'),
'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587), 'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'), 'encryption' => env('MAIL_ENCRYPTION', 'tls'),
@ -51,10 +52,16 @@ return [
'mailgun' => [ 'mailgun' => [
'transport' => 'mailgun', 'transport' => 'mailgun',
// 'client' => [
// 'timeout' => 5,
// ],
], ],
'postmark' => [ 'postmark' => [
'transport' => 'postmark', 'transport' => 'postmark',
// 'client' => [
// 'timeout' => 5,
// ],
], ],
'sendmail' => [ 'sendmail' => [

View File

@ -73,6 +73,22 @@ return [
], ],
/*
|--------------------------------------------------------------------------
| Job Batching
|--------------------------------------------------------------------------
|
| The following options configure the database and table that store job
| batching information. These options can be updated to any database
| connection and table which has been defined by your application.
|
*/
'batching' => [
'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'job_batches',
],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Failed Queue Jobs | Failed Queue Jobs