diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 423caede8..ca18aa198 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,8 +16,8 @@ jobs: strategy: fail-fast: true matrix: - php: [8.1, 8.2, 8.3] - laravel: [10] + php: [8.2, 8.3] + laravel: [11] name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} @@ -49,7 +49,7 @@ jobs: fail-fast: true matrix: stack: [inertia, livewire] - laravel: [10] + laravel: [11] name: Test Stubs - Laravel ${{ matrix.laravel }} - ${{ matrix.stack }} @@ -64,11 +64,19 @@ jobs: coverage: none - name: Setup Laravel + if: matrix.laravel != 11 run: | composer create-project laravel/laravel:^${{ matrix.laravel }} . composer require laravel/jetstream:@dev --no-interaction --no-update composer config repositories.jetstream '{"type": "path", "url": "jetstream"}' --file composer.json + - name: Setup Laravel + if: matrix.laravel == 11 + run: | + composer create-project laravel/laravel:dev-master . + composer require laravel/jetstream:@dev --no-interaction --no-update + composer config repositories.jetstream '{"type": "path", "url": "jetstream"}' --file composer.json + - name: Checkout code uses: actions/checkout@v3 with: diff --git a/composer.json b/composer.json index 97e76646f..af56fb1d9 100644 --- a/composer.json +++ b/composer.json @@ -14,21 +14,21 @@ } ], "require": { - "php": "^8.1.0", + "php": "^8.2.0", "ext-json": "*", - "illuminate/console": "^10.17", - "illuminate/support": "^10.17", - "laravel/fortify": "^1.19", + "illuminate/console": "^11.0", + "illuminate/support": "^11.0", + "laravel/fortify": "dev-develop", "mobiledetect/mobiledetectlib": "^4.8" }, "require-dev": { - "inertiajs/inertia-laravel": "^0.6.5", - "laravel/sanctum": "^3.0", - "livewire/livewire": "^3.0", + "inertiajs/inertia-laravel": "^1.0", + "laravel/sanctum": "^4.0", + "livewire/livewire": "dev-feat/l11", "mockery/mockery": "^1.0", - "orchestra/testbench": "^8.11", + "orchestra/testbench": "^9.0", "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^10.1" + "phpunit/phpunit": "^10.4" }, "autoload": { "psr-4": { diff --git a/database/factories/TeamFactory.php b/database/factories/TeamFactory.php index 2b2fc96cd..1305204e7 100644 --- a/database/factories/TeamFactory.php +++ b/database/factories/TeamFactory.php @@ -2,7 +2,6 @@ namespace Database\Factories; -use App\Models\Team; use App\Models\User; use Illuminate\Database\Eloquent\Factories\Factory; diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 46cb47d5e..2449b0a1f 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -5,6 +5,7 @@ use App\Models\Team; use App\Models\User; use Illuminate\Database\Eloquent\Factories\Factory; +use Illuminate\Support\Facades\Hash; use Illuminate\Support\Str; use Laravel\Jetstream\Features; @@ -13,6 +14,11 @@ */ class UserFactory extends Factory { + /** + * The current password being used by the factory. + */ + protected static ?string $password; + /** * Define the model's default state. * @@ -21,10 +27,10 @@ class UserFactory extends Factory public function definition(): array { return [ - 'name' => $this->faker->name(), - 'email' => $this->faker->unique()->safeEmail(), + 'name' => fake()->name(), + 'email' => fake()->unique()->safeEmail(), 'email_verified_at' => now(), - 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password + 'password' => static::$password ??= Hash::make('password'), 'two_factor_secret' => null, 'two_factor_recovery_codes' => null, 'remember_token' => Str::random(10), @@ -38,11 +44,9 @@ public function definition(): array */ public function unverified(): static { - return $this->state(function (array $attributes) { - return [ - 'email_verified_at' => null, - ]; - }); + return $this->state(fn (array $attributes) => [ + 'email_verified_at' => null, + ]); } /** diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/0001_01_01_000000_create_users_table.php similarity index 54% rename from database/migrations/2014_10_12_000000_create_users_table.php rename to database/migrations/0001_01_01_000000_create_users_table.php index f56e5c64f..31d780723 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/0001_01_01_000000_create_users_table.php @@ -22,6 +22,21 @@ public function up(): void $table->string('profile_photo_path', 2048)->nullable(); $table->timestamps(); }); + + Schema::create('password_reset_tokens', function (Blueprint $table) { + $table->string('email')->primary(); + $table->string('token'); + $table->timestamp('created_at')->nullable(); + }); + + Schema::create('sessions', function (Blueprint $table) { + $table->string('id')->primary(); + $table->foreignId('user_id')->nullable()->index(); + $table->string('ip_address', 45)->nullable(); + $table->text('user_agent')->nullable(); + $table->longText('payload'); + $table->integer('last_activity')->index(); + }); } /** @@ -30,5 +45,7 @@ public function up(): void public function down(): void { Schema::dropIfExists('users'); + Schema::dropIfExists('password_reset_tokens'); + Schema::dropIfExists('sessions'); } }; diff --git a/src/Console/InstallCommand.php b/src/Console/InstallCommand.php index 6f2b96fa6..f720127ee 100644 --- a/src/Console/InstallCommand.php +++ b/src/Console/InstallCommand.php @@ -6,6 +6,8 @@ use Illuminate\Console\Command; use Illuminate\Contracts\Console\PromptsForMissingInput; use Illuminate\Filesystem\Filesystem; +use Illuminate\Support\Arr; +use Illuminate\Support\ServiceProvider; use Illuminate\Support\Str; use RuntimeException; use Symfony\Component\Console\Input\InputInterface; @@ -64,8 +66,7 @@ public function handle() // Storage... $this->callSilent('storage:link'); - // "Home" Route... - $this->replaceInFile('/home', '/dashboard', app_path('Providers/RouteServiceProvider.php')); + $this->replaceInFile('/home', '/dashboard', config_path('fortify.php')); if (file_exists(resource_path('views/welcome.blade.php'))) { $this->replaceInFile('/home', '/dashboard', resource_path('views/welcome.blade.php')); @@ -73,7 +74,7 @@ public function handle() } // Fortify Provider... - $this->installServiceProviderAfter('RouteServiceProvider', 'FortifyServiceProvider'); + ServiceProvider::addProviderToBootstrapFile('App\Providers\FortifyServiceProvider'); // Configure Session... $this->configureSession(); @@ -134,15 +135,8 @@ public function handle() */ protected function configureSession() { - try { - $this->call('session:table'); - } catch (Exception $e) { - // - } - - $this->replaceInFile("'SESSION_DRIVER', 'file'", "'SESSION_DRIVER', 'database'", config_path('session.php')); - $this->replaceInFile('SESSION_DRIVER=file', 'SESSION_DRIVER=database', base_path('.env')); - $this->replaceInFile('SESSION_DRIVER=file', 'SESSION_DRIVER=database', base_path('.env.example')); + $this->replaceInFile('SESSION_DRIVER=cookie', 'SESSION_DRIVER=database', base_path('.env')); + $this->replaceInFile('SESSION_DRIVER=cookie', 'SESSION_DRIVER=database', base_path('.env.example')); } /** @@ -153,29 +147,23 @@ protected function configureSession() protected function installLivewireStack() { // Install Livewire... - if (! $this->requireComposerPackages('livewire/livewire:^3.0')) { + if (! $this->requireComposerPackages('livewire/livewire:dev-feat/l11')) { return false; } - // Sanctum... - (new Process([$this->phpBinary(), 'artisan', 'vendor:publish', '--provider=Laravel\Sanctum\SanctumServiceProvider', '--force'], base_path())) - ->setTimeout(null) - ->run(function ($type, $output) { - $this->output->write($output); - }); + $this->call('install:api'); // Update Configuration... $this->replaceInFile('inertia', 'livewire', config_path('jetstream.php')); - // $this->replaceInFile("'guard' => 'web'", "'guard' => 'sanctum'", config_path('auth.php')); // NPM Packages... $this->updateNodePackages(function ($packages) { return [ - '@tailwindcss/forms' => '^0.5.2', - '@tailwindcss/typography' => '^0.5.0', - 'autoprefixer' => '^10.4.7', - 'postcss' => '^8.4.14', - 'tailwindcss' => '^3.1.0', + '@tailwindcss/forms' => '^0.5.7', + '@tailwindcss/typography' => '^0.5.10', + 'autoprefixer' => '^10.4.16', + 'postcss' => '^8.4.32', + 'tailwindcss' => '^3.4.0', ] + $packages; }); @@ -204,7 +192,7 @@ protected function installLivewireStack() // Service Providers... copy(__DIR__.'/../../stubs/app/Providers/JetstreamServiceProvider.php', app_path('Providers/JetstreamServiceProvider.php')); - $this->installServiceProviderAfter('FortifyServiceProvider', 'JetstreamServiceProvider'); + ServiceProvider::addProviderToBootstrapFile('App\Providers\JetstreamServiceProvider'); // Models... copy(__DIR__.'/../../stubs/app/Models/User.php', app_path('Models/User.php')); @@ -238,9 +226,6 @@ protected function installLivewireStack() (new Filesystem)->copyDirectory(__DIR__.'/../../stubs/livewire/resources/views/profile', resource_path('views/profile')); (new Filesystem)->copyDirectory(__DIR__.'/../../stubs/livewire/resources/views/auth', resource_path('views/auth')); - // Routes... - $this->replaceInFile('auth:api', 'auth:sanctum', base_path('routes/api.php')); - if (! Str::contains(file_get_contents(base_path('routes/web.php')), "'/dashboard'")) { (new Filesystem)->append(base_path('routes/web.php'), $this->livewireRouteDefinition()); } @@ -344,31 +329,26 @@ protected function livewireRouteDefinition() protected function installInertiaStack() { // Install Inertia... - if (! $this->requireComposerPackages('inertiajs/inertia-laravel:^0.6.8', 'tightenco/ziggy:^1.0')) { + if (! $this->requireComposerPackages('inertiajs/inertia-laravel:^1.0', 'tightenco/ziggy:^1.0')) { return false; } + $this->call('install:api'); + // Install NPM packages... $this->updateNodePackages(function ($packages) { return [ - '@inertiajs/vue3' => '^1.0.0', - '@tailwindcss/forms' => '^0.5.2', - '@tailwindcss/typography' => '^0.5.2', - '@vitejs/plugin-vue' => '^4.0.0', - 'autoprefixer' => '^10.4.7', - 'postcss' => '^8.4.14', - 'tailwindcss' => '^3.1.0', - 'vue' => '^3.2.31', + '@inertiajs/vue3' => '^1.0.14', + '@tailwindcss/forms' => '^0.5.7', + '@tailwindcss/typography' => '^0.5.10', + '@vitejs/plugin-vue' => '^5.0.0', + 'autoprefixer' => '^10.4.16', + 'postcss' => '^8.4.32', + 'tailwindcss' => '^3.4.0', + 'vue' => '^3.3.13', ] + $packages; }); - // Sanctum... - (new Process([$this->phpBinary(), 'artisan', 'vendor:publish', '--provider=Laravel\Sanctum\SanctumServiceProvider', '--force'], base_path())) - ->setTimeout(null) - ->run(function ($type, $output) { - $this->output->write($output); - }); - // Tailwind Configuration... copy(__DIR__.'/../../stubs/inertia/tailwind.config.js', base_path('tailwind.config.js')); copy(__DIR__.'/../../stubs/inertia/postcss.config.js', base_path('postcss.config.js')); @@ -398,18 +378,20 @@ protected function installInertiaStack() // Service Providers... copy(__DIR__.'/../../stubs/app/Providers/JetstreamServiceProvider.php', app_path('Providers/JetstreamServiceProvider.php')); - - $this->installServiceProviderAfter('FortifyServiceProvider', 'JetstreamServiceProvider'); + ServiceProvider::addProviderToBootstrapFile('App\Providers\JetstreamServiceProvider'); // Middleware... + (new Filesystem)->ensureDirectoryExists(app_path('Http/Middleware')); (new Process([$this->phpBinary(), 'artisan', 'inertia:middleware', 'HandleInertiaRequests', '--force'], base_path())) ->setTimeout(null) ->run(function ($type, $output) { $this->output->write($output); }); - $this->installMiddlewareAfter('SubstituteBindings::class', '\App\Http\Middleware\HandleInertiaRequests::class'); - $this->installMiddlewareAfter('\App\Http\Middleware\HandleInertiaRequests::class', '\Illuminate\Http\Middleware\AddLinkHeadersForPreloadedAssets::class'); + $this->installMiddleware([ + '\App\Http\Middleware\HandleInertiaRequests::class', + '\Illuminate\Http\Middleware\AddLinkHeadersForPreloadedAssets::class', + ]); // Models... copy(__DIR__.'/../../stubs/app/Models/User.php', app_path('Models/User.php')); @@ -441,9 +423,6 @@ protected function installInertiaStack() (new Filesystem)->copyDirectory(__DIR__.'/../../stubs/inertia/resources/js/Pages/Auth', resource_path('js/Pages/Auth')); (new Filesystem)->copyDirectory(__DIR__.'/../../stubs/inertia/resources/js/Pages/Profile', resource_path('js/Pages/Profile')); - // Routes... - $this->replaceInFile('auth:api', 'auth:sanctum', base_path('routes/api.php')); - copy(__DIR__.'/../../stubs/inertia/routes/web.php', base_path('routes/web.php')); // Assets... @@ -578,13 +557,14 @@ protected function installInertiaSsrStack() { $this->updateNodePackages(function ($packages) { return [ - '@vue/server-renderer' => '^3.2.31', + '@vue/server-renderer' => '^3.3.13', ] + $packages; }); copy(__DIR__.'/../../stubs/inertia/resources/js/ssr.js', resource_path('js/ssr.js')); $this->replaceInFile("input: 'resources/js/app.js',", "input: 'resources/js/app.js',".PHP_EOL." ssr: 'resources/js/ssr.js',", base_path('vite.config.js')); + (new Filesystem)->ensureDirectoryExists(app_path('Http/Middleware')); copy(__DIR__.'/../../stubs/inertia/app/Http/Middleware/HandleInertiaRequests.php', app_path('Http/Middleware/HandleInertiaRequests.php')); $this->replaceInFile('vite build', 'vite build && vite build --ssr', base_path('package.json')); @@ -592,51 +572,34 @@ protected function installInertiaSsrStack() } /** - * Install the service provider in the application configuration file. + * Install the given middleware names into the application. * - * @param string $after - * @param string $name - * @return void - */ - protected function installServiceProviderAfter($after, $name) - { - if (! Str::contains($appConfig = file_get_contents(config_path('app.php')), 'App\\Providers\\'.$name.'::class')) { - file_put_contents(config_path('app.php'), str_replace( - 'App\\Providers\\'.$after.'::class,', - 'App\\Providers\\'.$after.'::class,'.PHP_EOL.' App\\Providers\\'.$name.'::class,', - $appConfig - )); - } - } - - /** - * Install the middleware to a group in the application Http Kernel. - * - * @param string $after - * @param string $name + * @param array|string $name * @param string $group + * @param string $modifier * @return void */ - protected function installMiddlewareAfter($after, $name, $group = 'web') + protected function installMiddleware($names, $group = 'web', $modifier = 'append') { - $httpKernel = file_get_contents(app_path('Http/Kernel.php')); - - $middlewareGroups = Str::before(Str::after($httpKernel, '$middlewareGroups = ['), '];'); - $middlewareGroup = Str::before(Str::after($middlewareGroups, "'$group' => ["), '],'); - - if (! Str::contains($middlewareGroup, $name)) { - $modifiedMiddlewareGroup = str_replace( - $after.',', - $after.','.PHP_EOL.' '.$name.',', - $middlewareGroup, - ); - - file_put_contents(app_path('Http/Kernel.php'), str_replace( - $middlewareGroups, - str_replace($middlewareGroup, $modifiedMiddlewareGroup, $middlewareGroups), - $httpKernel - )); - } + $bootstrapApp = file_get_contents(base_path('bootstrap/app.php')); + + $names = collect(Arr::wrap($names)) + ->filter(fn ($name) => ! Str::contains($bootstrapApp, $name)) + ->whenNotEmpty(function ($names) use ($bootstrapApp, $group, $modifier) { + $names = $names->map(fn ($name) => "$name")->implode(','.PHP_EOL.' '); + + $bootstrapApp = str_replace( + '->withMiddleware(function (Middleware $middleware) {', + '->withMiddleware(function (Middleware $middleware) {' + .PHP_EOL." \$middleware->$group($modifier: [" + .PHP_EOL." $names," + .PHP_EOL.' ]);' + .PHP_EOL, + $bootstrapApp, + ); + + file_put_contents(base_path('bootstrap/app.php'), $bootstrapApp); + }); } /** diff --git a/src/JetstreamServiceProvider.php b/src/JetstreamServiceProvider.php index c86d7ccc3..d81c26beb 100644 --- a/src/JetstreamServiceProvider.php +++ b/src/JetstreamServiceProvider.php @@ -110,10 +110,10 @@ protected function configurePublishing() ], 'jetstream-config'); $this->publishes([ - __DIR__.'/../database/migrations/2014_10_12_000000_create_users_table.php' => database_path('migrations/2014_10_12_000000_create_users_table.php'), + __DIR__.'/../database/migrations/0001_01_01_000000_create_users_table.php' => database_path('migrations/0001_01_01_000000_create_users_table.php'), ], 'jetstream-migrations'); - $this->publishes([ + $this->publishesMigrations([ __DIR__.'/../database/migrations/2020_05_21_100000_create_teams_table.php' => database_path('migrations/2020_05_21_100000_create_teams_table.php'), __DIR__.'/../database/migrations/2020_05_21_200000_create_team_user_table.php' => database_path('migrations/2020_05_21_200000_create_team_user_table.php'), __DIR__.'/../database/migrations/2020_05_21_300000_create_team_invitations_table.php' => database_path('migrations/2020_05_21_300000_create_team_invitations_table.php'), diff --git a/stubs/app/Models/Team.php b/stubs/app/Models/Team.php index 92acf7d1f..7362cea31 100644 --- a/stubs/app/Models/Team.php +++ b/stubs/app/Models/Team.php @@ -12,15 +12,6 @@ class Team extends JetstreamTeam { use HasFactory; - /** - * The attributes that should be cast. - * - * @var array - */ - protected $casts = [ - 'personal_team' => 'boolean', - ]; - /** * The attributes that are mass assignable. * @@ -41,4 +32,16 @@ class Team extends JetstreamTeam 'updated' => TeamUpdated::class, 'deleted' => TeamDeleted::class, ]; + + /** + * Get the attributes that should be cast. + * + * @return array + */ + protected function casts(): array + { + return [ + 'personal_team' => 'boolean', + ]; + } } diff --git a/stubs/app/Models/User.php b/stubs/app/Models/User.php index 7f186c3de..2e45c0808 100644 --- a/stubs/app/Models/User.php +++ b/stubs/app/Models/User.php @@ -41,15 +41,6 @@ class User extends Authenticatable 'two_factor_secret', ]; - /** - * The attributes that should be cast. - * - * @var array - */ - protected $casts = [ - 'email_verified_at' => 'datetime', - ]; - /** * The accessors to append to the model's array form. * @@ -58,4 +49,17 @@ class User extends Authenticatable protected $appends = [ 'profile_photo_url', ]; + + /** + * Get the attributes that should be cast. + * + * @return array + */ + protected function casts(): array + { + return [ + 'email_verified_at' => 'datetime', + 'password' => 'hashed', + ]; + } } diff --git a/stubs/app/Models/UserWithTeams.php b/stubs/app/Models/UserWithTeams.php index b2ab2f159..14709f55b 100644 --- a/stubs/app/Models/UserWithTeams.php +++ b/stubs/app/Models/UserWithTeams.php @@ -2,7 +2,7 @@ namespace App\Models; -use Illuminate\Contracts\Auth\MustVerifyEmail; +// use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; @@ -26,7 +26,9 @@ class User extends Authenticatable * @var array */ protected $fillable = [ - 'name', 'email', 'password', + 'name', + 'email', + 'password', ]; /** @@ -41,15 +43,6 @@ class User extends Authenticatable 'two_factor_secret', ]; - /** - * The attributes that should be cast. - * - * @var array - */ - protected $casts = [ - 'email_verified_at' => 'datetime', - ]; - /** * The accessors to append to the model's array form. * @@ -58,4 +51,17 @@ class User extends Authenticatable protected $appends = [ 'profile_photo_url', ]; + + /** + * Get the attributes that should be cast. + * + * @return array + */ + protected function casts(): array + { + return [ + 'email_verified_at' => 'datetime', + 'password' => 'hashed', + ]; + } } diff --git a/stubs/inertia/routes/web.php b/stubs/inertia/routes/web.php index ba13b47d1..3ff21ba3e 100644 --- a/stubs/inertia/routes/web.php +++ b/stubs/inertia/routes/web.php @@ -10,8 +10,8 @@ |-------------------------------------------------------------------------- | | Here is where you can register web routes for your application. These -| routes are loaded by the RouteServiceProvider within a group which -| contains the "web" middleware group. Now create something great! +| routes are loaded within the "web" middleware group which includes +| sessions, cookie encryption, and more. Go build something great! | */ diff --git a/stubs/pest-tests/AuthenticationTest.php b/stubs/pest-tests/AuthenticationTest.php index f50064297..9244fff24 100644 --- a/stubs/pest-tests/AuthenticationTest.php +++ b/stubs/pest-tests/AuthenticationTest.php @@ -1,7 +1,6 @@ get('/login'); @@ -18,7 +17,7 @@ ]); $this->assertAuthenticated(); - $response->assertRedirect(RouteServiceProvider::HOME); + $response->assertRedirect(route('dashboard', absolute: false)); }); test('users cannot authenticate with invalid password', function () { diff --git a/stubs/pest-tests/EmailVerificationTest.php b/stubs/pest-tests/EmailVerificationTest.php index 30b68aff0..79351c796 100644 --- a/stubs/pest-tests/EmailVerificationTest.php +++ b/stubs/pest-tests/EmailVerificationTest.php @@ -1,7 +1,6 @@ fresh()->hasVerifiedEmail())->toBeTrue(); - $response->assertRedirect(RouteServiceProvider::HOME.'?verified=1'); + $response->assertRedirect(route('dashboard', absolute: false).'?verified=1'); })->skip(function () { return ! Features::enabled(Features::emailVerification()); }, 'Email verification not enabled.'); diff --git a/stubs/pest-tests/RegistrationTest.php b/stubs/pest-tests/RegistrationTest.php index 856a3053d..c1b9ea969 100644 --- a/stubs/pest-tests/RegistrationTest.php +++ b/stubs/pest-tests/RegistrationTest.php @@ -1,6 +1,5 @@ assertAuthenticated(); - $response->assertRedirect(RouteServiceProvider::HOME); + $response->assertRedirect(route('dashboard', absolute: false)); })->skip(function () { return ! Features::enabled(Features::registration()); }, 'Registration support is not enabled.'); diff --git a/stubs/tests/AuthenticationTest.php b/stubs/tests/AuthenticationTest.php index 7623fe9c2..7bfcae28a 100644 --- a/stubs/tests/AuthenticationTest.php +++ b/stubs/tests/AuthenticationTest.php @@ -3,7 +3,6 @@ namespace Tests\Feature; use App\Models\User; -use App\Providers\RouteServiceProvider; use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\TestCase; @@ -28,7 +27,7 @@ public function test_users_can_authenticate_using_the_login_screen(): void ]); $this->assertAuthenticated(); - $response->assertRedirect(RouteServiceProvider::HOME); + $response->assertRedirect(route('dashboard', absolute: false)); } public function test_users_can_not_authenticate_with_invalid_password(): void diff --git a/stubs/tests/EmailVerificationTest.php b/stubs/tests/EmailVerificationTest.php index ad0257d12..7ee993ded 100644 --- a/stubs/tests/EmailVerificationTest.php +++ b/stubs/tests/EmailVerificationTest.php @@ -3,7 +3,6 @@ namespace Tests\Feature; use App\Models\User; -use App\Providers\RouteServiceProvider; use Illuminate\Auth\Events\Verified; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Support\Facades\Event; @@ -53,7 +52,7 @@ public function test_email_can_be_verified(): void Event::assertDispatched(Verified::class); $this->assertTrue($user->fresh()->hasVerifiedEmail()); - $response->assertRedirect(RouteServiceProvider::HOME.'?verified=1'); + $response->assertRedirect(route('dashboard', absolute: false).'?verified=1'); } public function test_email_can_not_verified_with_invalid_hash(): void diff --git a/stubs/tests/RegistrationTest.php b/stubs/tests/RegistrationTest.php index 90b0245e7..0e3cfb80b 100644 --- a/stubs/tests/RegistrationTest.php +++ b/stubs/tests/RegistrationTest.php @@ -2,7 +2,6 @@ namespace Tests\Feature; -use App\Providers\RouteServiceProvider; use Illuminate\Foundation\Testing\RefreshDatabase; use Laravel\Fortify\Features; use Laravel\Jetstream\Jetstream; @@ -55,6 +54,6 @@ public function test_new_users_can_register(): void ]); $this->assertAuthenticated(); - $response->assertRedirect(RouteServiceProvider::HOME); + $response->assertRedirect(route('dashboard', absolute: false)); } }