Skip to content

Commit

Permalink
Add Laravel 11 support (#16)
Browse files Browse the repository at this point in the history
* Add Laravel 11 support
  • Loading branch information
Robert Allport committed Mar 10, 2024
1 parent f778ecd commit 7d9ee03
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 36 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.2,8.3]
laravel: [10.*]
php: [8.2, 8.3]
laravel: ["^11.0", "^10.0"]
dependency-version: [prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
- laravel: "^11.0"
testbench: 9.*
- laravel: "^10.0"
testbench: 8.*

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}

steps:
- name: Checkout code
Expand Down
14 changes: 8 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"keywords": [
"laravel",
"laravel eloquent",
"laravel delete",
"laravel destroy model",
"eloquent",
"soft deletes"
],
Expand All @@ -19,14 +21,14 @@
],
"require": {
"php": "^8.2",
"illuminate/config": "^10.0",
"illuminate/container": "^10.0",
"illuminate/contracts": "^10.0",
"illuminate/database": "^10.0"
"illuminate/config": "^10.0|^11.0",
"illuminate/container": "^10.0|^11.0",
"illuminate/contracts": "^10.0|^11.0",
"illuminate/database": "^10.0|^11.0"
},
"require-dev": {
"orchestra/testbench": "^8.8",
"phpunit/phpunit": "^10.0"
"orchestra/testbench": "^8.0|^9.0",
"phpunit/phpunit": "^9.4|^10.1"
},
"autoload": {
"psr-4": {
Expand Down
33 changes: 16 additions & 17 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd"
>
<testsuites>
<testsuite name="Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>app</directory>
</include>
</source>
<php>
<env name="APP_NAME" value="Laravel Deletable"/>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
</php>
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
</source>
<testsuites>
<testsuite name="Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<php>
<env name="APP_NAME" value="Laravel Deletable"/>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
</php>
</phpunit>

7 changes: 2 additions & 5 deletions tests/NoneDeletableUserMessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@

use F9Web\LaravelDeletable\Exceptions\NoneDeletableModel;
use F9Web\LaravelDeletable\Tests\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;

use function get_class;

class NoneDeletableUserMessageTest extends TestCase
{
use RefreshDatabase;

/**
* @test
* @throws \Exception
Expand Down Expand Up @@ -53,7 +50,7 @@ public function isDeletable(): bool
{
// the user with the email 'rob@f9web.co.uk' is a
// core record and therefore not deletable
if ($this->email === 'rob@f9web.co.uk') {
if ($this->email === 'rob1@f9web.co.uk') {
return $this->isCoreEntity();
}

Expand All @@ -63,7 +60,7 @@ public function isDeletable(): bool

$class = get_class($model);

$user = $model::query()->create($record = ['email' => 'rob@f9web.co.uk']);
$user = $model::query()->create($record = ['email' => 'rob1@f9web.co.uk']);

$this->expectExceptionMessage(
"[{$class} #{$user->getKey()}] is a core record and therefore not deletable. This indicates " .
Expand Down
3 changes: 0 additions & 3 deletions tests/NoneDeletableUserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@
use F9Web\LaravelDeletable\Exceptions\NoneDeletableModel;
use F9Web\LaravelDeletable\Tests\Models\NoneDeletableUser;
use F9Web\LaravelDeletable\Tests\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;

use function get_class;

class NoneDeletableUserTest extends TestCase
{
use RefreshDatabase;

/**
* @test
* @throws \Exception
Expand Down

0 comments on commit 7d9ee03

Please sign in to comment.