Skip to content
Merged
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
18 changes: 17 additions & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
os: [ubuntu-latest, windows-latest]
php: [8.5, 8.4]
laravel: [13.*, 12.*]
permission: ['^8.3']
stability: [prefer-stable]
include:
- laravel: 13.*
Expand All @@ -28,8 +29,22 @@ jobs:
- laravel: 12.*
testbench: 10.*
carbon: '>=3.8.4 <4.0'
- os: ubuntu-latest
php: 8.4
laravel: 13.*
testbench: 11.*
carbon: '>=3.8.4 <4.0'
permission: '^7.0'
stability: prefer-stable
- os: ubuntu-latest
php: 8.4
laravel: 12.*
testbench: 10.*
carbon: '>=3.8.4 <4.0'
permission: '^7.0'
stability: prefer-stable

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
name: P${{ matrix.php }} - L${{ matrix.laravel }} - Permission ${{ matrix.permission }} - ${{ matrix.stability }} - ${{ matrix.os }}

steps:
- name: Checkout code
Expand All @@ -51,6 +66,7 @@ jobs:
run: |
composer config audit.block-insecure false
composer require --dev "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.carbon }}" --no-interaction --no-update
composer require "spatie/laravel-permission:${{ matrix.permission }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction

- name: List Installed Dependencies
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"illuminate/contracts": "^12.0|^13.0",
"livewire/livewire": "^3.0|^4.0",
"spatie/laravel-package-tools": "^1.14.0",
"spatie/laravel-permission": "^7.0",
"spatie/laravel-permission": "^7.0|^8.3",
"step2dev/lazy-breadcrumb": "dev-main",
"step2dev/lazy-setting": "dev-main",
"step2dev/lazy-ui": "dev-2.x-dev",
Expand Down
28 changes: 28 additions & 0 deletions tests/Feature/SpatiePermissionCompatibilityTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace Step2dev\LazyAdmin\Tests\Feature;

use Composer\InstalledVersions;
use Spatie\Permission\Models\Permission;
use Spatie\Permission\Models\Role;
use Step2dev\LazyAdmin\Authorization\AuthorizationManager;

it('supports Spatie permission 7 and 8 without changing the admin authorization contract', function (): void {
$version = InstalledVersions::getPrettyVersion('spatie/laravel-permission');

expect($version)->not->toBeNull()
->and(version_compare(ltrim((string) $version, 'v'), '7.0.0', '>='))->toBeTrue()
->and(app(AuthorizationManager::class)->roleModel())->toBe(Role::class)
->and(app(AuthorizationManager::class)->permissionModel())->toBe(Permission::class);
});

it('keeps the package constraint compatible with existing v7 installs while allowing v8', function (): void {
$composer = json_decode(
file_get_contents(dirname(__DIR__, 2).'/composer.json'),
true,
512,
JSON_THROW_ON_ERROR,
);

expect($composer['require']['spatie/laravel-permission'] ?? null)->toBe('^7.0|^8.3');
});
Loading