Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for PHP 8.3 and Laravel 11 #9

Open
wants to merge 11 commits into
base: 2.x-splade
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [8.2, 8.1]
laravel: [10.2]
php: [8.3, 8.2]
laravel: [11.0, 10.2]

name: Unit/Feature Tests - P${{ matrix.php }} - L${{ matrix.laravel }}

Expand All @@ -33,16 +33,16 @@ jobs:
composer update --prefer-dist --no-interaction --no-progress

- name: Execute tests
run: vendor/bin/phpunit --verbose
run: vendor/bin/phpunit

stub-tests:
runs-on: ubuntu-22.04

strategy:
fail-fast: false
matrix:
php: [8.2, 8.1]
laravel: [10.0]
php: [8.3, 8.2]
laravel: [11.0, 10.2]

name: Dusk Tests - P${{ matrix.php }} - L${{ matrix.laravel }}

Expand Down
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@
}
],
"require": {
"php": "^8.1",
"php": "^8.2",
"ext-json": "*",
"illuminate/console": "^9.37|^10.0",
"illuminate/support": "^9.37|^10.0",
"illuminate/console": "^10.48.3|^11.0",
"illuminate/support": "^10.48.3|^11.0",
"jenssegers/agent": "^2.6",
"laravel/fortify": "^1.15",
"protonemedia/laravel-splade": "^1.4.8"
"protonemedia/laravel-splade": "^1.4.18"
},
"require-dev": {
"inertiajs/inertia-laravel": "^0.6.5",
"inertiajs/inertia-laravel": "^0.6.5|^1.0",
"laravel/pint": "^1.4",
"laravel/sanctum": "^3.0",
"livewire/livewire": "^2.12",
"laravel/sanctum": "^3.0|^4.0",
"livewire/livewire": "^2.12|^3.0",
"mockery/mockery": "^1.0",
"orchestra/testbench": "^7.0|^8.0",
"orchestra/testbench": "^8.0|^9.0",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9.3"
"phpunit/phpunit": "^10.4"
},
"autoload": {
"psr-4": {
Expand Down
38 changes: 18 additions & 20 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertDeprecationsToExceptions="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
>
<testsuites>
<testsuite name="Jetstream Test Suite">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
<php>
<server name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
</php>
</phpunit>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="false"
bootstrap="vendor/autoload.php"
colors="true"
processIsolation="false"
stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false">
<testsuites>
<testsuite name="Jetstream Test Suite">
<directory suffix="Test.php">./tests/</directory>
</testsuite>
</testsuites>
<php>
<server name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF" />
</php>
</phpunit>
3 changes: 0 additions & 3 deletions src/Console/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ public function handle()
// Storage...
$this->callSilent('storage:link');

// "Home" Route...
$this->replaceInFile('/home', '/dashboard', app_path('Providers/RouteServiceProvider.php'));

if (file_exists(resource_path('views/welcome.blade.php'))) {
$this->replaceInFile('/home', '/dashboard', resource_path('views/welcome.blade.php'));
$this->replaceInFile('Home', 'Dashboard', resource_path('views/welcome.blade.php'));
Expand Down
37 changes: 18 additions & 19 deletions src/Console/InstallsSpladeStack.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Laravel\Jetstream\Console;

use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\ServiceProvider;
use ProtoneMedia\Splade\Commands\InstallsSpladeExceptionHandler;
use ProtoneMedia\Splade\Commands\InstallsSpladeRouteMiddleware;
use Symfony\Component\Console\Command\Command;
Expand All @@ -21,12 +22,7 @@ trait InstallsSpladeStack
*/
protected function installSpladeStack()
{
// Check Laravel version...
if (version_compare(app()->version(), '10.0', '<')) {
$this->error('While you can still use Splade with Laravel 9, new projects should use Laravel 10.');

return Command::FAILURE;
}
$legacyLaravelSkeleton = version_compare(app()->version(), '11.0', '<');

$this->replaceInFile('// Features::termsAndPrivacyPolicy(),', 'Features::termsAndPrivacyPolicy(),', config_path('jetstream.php'));
$this->replaceInFile('// Features::profilePhotos(),', 'Features::profilePhotos(),', config_path('jetstream.php'));
Expand All @@ -40,16 +36,16 @@ protected function installSpladeStack()
// NPM Packages...
$this->updateNodePackages(function ($packages) {
return [
'@protonemedia/laravel-splade' => '^1.4.8',
'@tailwindcss/forms' => '^0.5.3',
'@tailwindcss/typography' => '^0.5.2',
'@vitejs/plugin-vue' => '^4.0.0',
'autoprefixer' => '^10.4.12',
'laravel-vite-plugin' => '^0.7.5',
'postcss' => '^8.4.18',
'tailwindcss' => '^3.3.0',
'vite' => '^4.0.0',
'vue' => '^3.2.41',
'@protonemedia/laravel-splade' => '^1.4.16',
'@tailwindcss/forms' => '^0.5.7',
'@tailwindcss/typography' => '^0.5.10',
'@vitejs/plugin-vue' => '^5.0',
'autoprefixer' => '^10.4.16',
'laravel-vite-plugin' => '^1.0',
'postcss' => '^8.4.32',
'tailwindcss' => '^3.4',
'vite' => '^5.0',
'vue' => '^3.4',
] + $packages;
});

Expand Down Expand Up @@ -80,7 +76,9 @@ protected function installSpladeStack()
// Service Providers...
copy(__DIR__.'/../../stubs/app/Providers/JetstreamServiceProvider.php', app_path('Providers/JetstreamServiceProvider.php'));

$this->installServiceProviderAfter('FortifyServiceProvider', 'JetstreamServiceProvider');
$legacyLaravelSkeleton
? $this->installServiceProviderAfter('FortifyServiceProvider', 'JetstreamServiceProvider')
: ServiceProvider::addProviderToBootstrapFile('App\Providers\JetstreamServiceProvider');

// Models...
copy(__DIR__.'/../../stubs/app/Models/User.php', app_path('Models/User.php'));
Expand All @@ -107,8 +105,9 @@ protected function installSpladeStack()
->name('*.blade.php')
);

// Routes...
$this->replaceInFile('auth:api', 'auth:sanctum', base_path('routes/api.php'));
$legacyLaravelSkeleton
? $this->replaceInFile('auth:api', 'auth:sanctum', base_path('routes/api.php'))
: $this->callSilent('install:api', ['--without-migration-prompt' => true]);

copy($spladeJetstreamStubsDir.'routes/web.php', base_path('routes/web.php'));

Expand Down
2 changes: 1 addition & 1 deletion stubs/pest-tests/AuthenticationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
]);

$this->assertAuthenticated();
$response->assertRedirect(RouteServiceProvider::HOME);
$response->assertRedirect('dashboard');
});

test('users cannot authenticate with invalid password', function () {
Expand Down
2 changes: 1 addition & 1 deletion stubs/pest-tests/EmailVerificationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
Event::assertDispatched(Verified::class);

expect($user->fresh()->hasVerifiedEmail())->toBeTrue();
$response->assertRedirect(RouteServiceProvider::HOME.'?verified=1');
$response->assertRedirect('dashboard?verified=1');
})->skip(function () {
return ! Features::enabled(Features::emailVerification());
}, 'Email verification not enabled.');
Expand Down
2 changes: 1 addition & 1 deletion stubs/pest-tests/RegistrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
]);

$this->assertAuthenticated();
$response->assertRedirect(RouteServiceProvider::HOME);
$response->assertRedirect('dashboard');
})->skip(function () {
return ! Features::enabled(Features::registration());
}, 'Registration support is not enabled.');
2 changes: 1 addition & 1 deletion stubs/tests/AuthenticationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function test_users_can_authenticate_using_the_login_screen(): void
]);

$this->assertAuthenticated();
$response->assertRedirect(RouteServiceProvider::HOME);
$response->assertRedirect('dashboard');
}

public function test_users_can_not_authenticate_with_invalid_password(): void
Expand Down
2 changes: 1 addition & 1 deletion stubs/tests/EmailVerificationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,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('dashboard?verified=1');
}

public function test_email_can_not_verified_with_invalid_hash(): void
Expand Down
2 changes: 1 addition & 1 deletion stubs/tests/RegistrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ public function test_new_users_can_register(): void
]);

$this->assertAuthenticated();
$response->assertRedirect(RouteServiceProvider::HOME);
$response->assertRedirect('dashboard');
}
}
2 changes: 1 addition & 1 deletion stubs/tests/splade/dusk/AuthenticationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function test_users_can_authenticate_using_the_login_screen()
->type('email', $user->email)
->type('password', 'password')
->press('Log in')
->waitForLocation(RouteServiceProvider::HOME)
->waitForLocation('dashboard')
->assertAuthenticatedAs($user);
});
}
Expand Down
2 changes: 1 addition & 1 deletion stubs/tests/splade/dusk/CreateTeamTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function test_teams_can_be_created(): void
->waitForText('Team Details')
->type('name', 'Test Team')
->press('Create')
->waitForLocation(RouteServiceProvider::HOME);
->waitForLocation('dashboard');

$this->assertCount(2, $user->fresh()->ownedTeams);
$this->assertEquals('Test Team', $user->fresh()->ownedTeams()->latest('id')->first()->name);
Expand Down
2 changes: 1 addition & 1 deletion stubs/tests/splade/dusk/EmailVerificationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function test_email_can_be_verified(): void
$this->browse(function (Browser $browser) use ($user, $verificationUrl) {
$browser->loginAs($user)
->visit($verificationUrl)
->assertPathIs(RouteServiceProvider::HOME)
->assertPathIs('dashboard')
->assertQueryStringHas('verified', 1);
});

Expand Down
4 changes: 2 additions & 2 deletions stubs/tests/splade/dusk/PasswordConfirmationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public function test_password_can_be_confirmed(): void
->waitForText('Please confirm your password before continuing.')
->type('password', 'password')
->press('Confirm')
->waitForLocation(RouteServiceProvider::HOME)
->assertPathIs(RouteServiceProvider::HOME);
->waitForLocation('dashboard')
->assertPathIs('dashboard');
});
}

Expand Down
2 changes: 1 addition & 1 deletion stubs/tests/splade/dusk/RegistrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function test_new_users_can_register(): void
if (new User instanceof MustVerifyEmail) {
$browser->waitForLocation('/email/verify');
} else {
$browser->waitForLocation(RouteServiceProvider::HOME)
$browser->waitForLocation('dashboard')
->assertAuthenticated();
}
});
Expand Down
Loading