Skip to content

Add support for Laravel 11 and 12 #3

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

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8428b1e
fix: added additional supported versions for illuminate db and support
Meeshalk Apr 20, 2025
fd44aa1
fix: updated req-dev packages to support new req packages
Meeshalk Apr 20, 2025
495386f
fix: migrated phpunit configuration
Meeshalk Apr 20, 2025
b7c51c0
Merge pull request #1 from Meeshalk/Chore/Update-dependencies-for-lar…
Meeshalk Apr 20, 2025
6e8c18b
fix: updated php version matrix to include new versions
Meeshalk Apr 22, 2025
3a20f6d
fix: updated github actions steps versions
Meeshalk Apr 22, 2025
3251e87
fix: verbose flag is not longer supported by phpunit
Meeshalk Apr 22, 2025
68e7171
fix: PHP 7.2 is no longer supported by laravel/legacy-factories
Meeshalk Apr 22, 2025
0b9102d
feat: adding supported PHP versions in composer.json
Meeshalk Apr 22, 2025
6d3be46
fix: removing 8.4 as 8.3 is well supported by Laravel 12
Meeshalk Apr 22, 2025
ed3b89f
fix: updated require and dev dependencies to fix --prefer-lowest issues
Meeshalk Apr 22, 2025
1eed78a
fix: PHP 7.3 is no longer needed
Meeshalk Apr 22, 2025
878c89e
fix: PHP7 cannot be supported along with PHP8 with --prefer-lowest flag
Meeshalk Apr 22, 2025
5b3fe1f
fix: try to test with PHP7.4
Meeshalk Apr 22, 2025
8b58a2b
fix: redo PHP7 removal
Meeshalk Apr 22, 2025
d7cc97f
Merge pull request #2 from Meeshalk/Chore/update-version-support-and-…
Meeshalk Apr 22, 2025
30cdc7c
fix: try with minimun supported version
Meeshalk Apr 25, 2025
d5f6774
fix: add phpunit matrix and exclude not supported versions
Meeshalk Apr 25, 2025
cc4b4e1
fix: add PHP7.3 & 7.4 exlusions
Meeshalk Apr 25, 2025
edc2fb0
fix: PHP 8.0 is not supported by PHPUnit
Meeshalk Apr 25, 2025
fb419e3
fix: PHPUnit 8 & 9 does sot support PHP 8.1, 8.2 & 8.3
Meeshalk Apr 25, 2025
d67fc1b
fix: try more on php 8.1
Meeshalk Apr 25, 2025
2e3833d
fix: PHP 8.1 only seems to work with PHPUnit 10
Meeshalk Apr 25, 2025
a23806e
Merge pull request #3 from Meeshalk/Fix/use-exclude-for-unsuported-ve…
Meeshalk Apr 30, 2025
2172a95
fix: PHP 8.3 tests removed
Meeshalk May 5, 2025
ec39ba2
Merge pull request #4 from Meeshalk/Fix/remove-unnecessary-php-version
Meeshalk May 5, 2025
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
38 changes: 31 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,41 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [7.4, 7.3, 7.2]
php: [8.2, 8.1, 7.4, 7.3]
phpunit: ['8.4', '9.6', '10.0', '11.0']
stability: [prefer-lowest, prefer-stable]

name: PHP ${{ matrix.php }} - ${{ matrix.stability }}
exclude:
- php: 7.3
phpunit: '9.6'
- php: 7.3
phpunit: '10.0'
- php: 7.3
phpunit: '11.0'
- php: 7.4
phpunit: '9.6'
- php: 7.4
phpunit: '10.0'
- php: 7.4
phpunit: '11.0'
- php: 8.1
phpunit: '8.4'
- php: 8.1
phpunit: '9.6'
- php: 8.1
phpunit: '11.0'
- php: 8.2
phpunit: '8.4'
- php: 8.2
phpunit: '9.6'

name: PHP ${{ matrix.php }} - PHPUnit ${{ matrix.phpunit }} - ${{ matrix.stability }}

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Cache dependencies
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ~/.composer/cache/files
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
Expand All @@ -33,7 +57,7 @@ jobs:
coverage: none

- name: Install dependencies
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress --with="phpunit/phpunit:^${{ matrix.phpunit }}"

- name: Execute tests
run: vendor/bin/phpunit --verbose
run: vendor/bin/phpunit
2 changes: 1 addition & 1 deletion .phpunit.result.cache
Original file line number Diff line number Diff line change
@@ -1 +1 @@
C:37:"PHPUnit\Runner\DefaultTestResultCache":406:{a:2:{s:7:"defects";a:0:{}s:5:"times";a:4:{s:49:"Ownable\Tests\OwnsModelsTraitTest::testOwnsMethod";d:0.115;s:54:"Ownable\Tests\OwnsModelsTraitTest::testdoesntOwnMethod";d:0.01;s:102:"Ownable\Tests\OwnsModelsTraitTest::testItShouldUseTheInterfaceImplementationIfClassImplementsInterface";d:0.012;s:93:"Ownable\Tests\OwnsModelsTraitTest::testItShouldOverrideTheContractAndUserTheRegularValidation";d:0.009;}}}
{"version":1,"defects":[],"times":{"Ownable\\Tests\\OwnsModelsTraitTest::testOwnsMethod":0.025,"Ownable\\Tests\\OwnsModelsTraitTest::testdoesntOwnMethod":0.002,"Ownable\\Tests\\OwnsModelsTraitTest::testItShouldUseTheInterfaceImplementationIfClassImplementsInterface":0.003,"Ownable\\Tests\\OwnsModelsTraitTest::testItShouldOverrideTheContractAndUserTheRegularValidation":0.003}}
11 changes: 6 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"name": "santigarcor/laravel-ownable",
"description": "Simple trait to manage the ownershipt of models/objects",
"description": "Simple trait to check ownership of models/objects",
"keywords": ["laravel", "ownership", "ownable", "owns"],
"require": {
"illuminate/database": "^6.0|^7.0|^8.0|^9.0|^10.0",
"illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0",
"php": "^7.3|^7.4|^8.1|>=8.2",
"illuminate/database": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0",
"illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0",
"laravel/legacy-factories": "^1.3"
},
"require-dev": {
"orchestra/testbench": "^4.0|^5.0|^6.0",
"phpunit/phpunit": "^7.5.15|^8.4|^9.0"
"orchestra/testbench": "^4.0|^5.0|^6.8|^7.0|^8.0|^9.0|^10.0",
"phpunit/phpunit": "^8.4|^9.6|^10.0|^11.0"
},
"autoload": {
"psr-4": {
Expand Down
21 changes: 8 additions & 13 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
verbose="true"
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
cacheDirectory=".phpunit.result.cache"
>
<testsuites>
<testsuite name="Laravel Ownable Test Suite">
<directory suffix="Test.php">./tests/</directory>
<directory>./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
</phpunit>