Skip to content

Commit d5c2ca5

Browse files
Support Laravel 11 (lorisleiva#273)
Co-authored-by: Loris Leiva <[email protected]>
1 parent 5d2e2a6 commit d5c2ca5

File tree

6 files changed

+49
-52
lines changed

6 files changed

+49
-52
lines changed

.github/workflows/php-cs-fixer.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88

99
steps:
1010
- name: Checkout code
11-
uses: actions/checkout@v2
11+
uses: actions/checkout@v3
1212
with:
1313
ref: ${{ github.head_ref }}
1414

@@ -18,6 +18,6 @@ jobs:
1818
args: --config=.php_cs.dist.php --allow-risky=yes
1919

2020
- name: Commit changes
21-
uses: stefanzweifel/git-auto-commit-action@v4
21+
uses: stefanzweifel/git-auto-commit-action@v5
2222
with:
2323
commit_message: Fix styling

.github/workflows/run-tests.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,25 @@ jobs:
99
fail-fast: true
1010
matrix:
1111
os: [ubuntu-latest]
12-
php: ["8.0", "8.1", "8.2"]
13-
laravel: ["^9.0", "^10.0"]
12+
php: ["8.1", "8.2", "8.3"]
13+
laravel: ["^10.0", "^11.0"]
1414
dependency-version: [prefer-lowest, prefer-stable]
1515
include:
16-
- laravel: "^9.0"
17-
testbench: "^7.0"
1816
- laravel: "^10.0"
1917
testbench: "^8.0"
18+
- laravel: "^11.0"
19+
testbench: "^9.0"
2020
exclude:
21-
- php: "8.2"
22-
laravel: "^9.0"
23-
- php: "8.0"
21+
- php: "8.3"
2422
laravel: "^10.0"
23+
- php: "8.1"
24+
laravel: "^11.0"
2525

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

2828
steps:
2929
- name: Checkout code
30-
uses: actions/checkout@v2
30+
uses: actions/checkout@v3
3131

3232
- name: Setup PHP
3333
uses: shivammathur/setup-php@v2

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.idea
22
.php_cs
33
.php_cs.cache
4-
.phpunit.result.cache
4+
.phpunit*
55
build
66
composer.lock
77
coverage

composer.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
}
2222
],
2323
"require": {
24-
"php": "^8.0",
25-
"illuminate/contracts": "9.0 - 9.34 || ^9.36 || ^10.0",
26-
"lorisleiva/lody": "^0.4"
24+
"php": "^8.1",
25+
"illuminate/contracts": "^10.0|^11.0",
26+
"lorisleiva/lody": "^0.5"
2727
},
2828
"require-dev": {
29-
"orchestra/testbench": "^8.5",
30-
"pestphp/pest": "^1.23",
31-
"phpunit/phpunit": "^9.6"
29+
"orchestra/testbench": "^9.0",
30+
"pestphp/pest": "^1.23|^2.34",
31+
"phpunit/phpunit": "^9.6|^10.0"
3232
},
3333
"autoload": {
3434
"psr-4": {

phpunit.xml.dist

+26-34
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,28 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit backupGlobals="false"
3-
backupStaticAttributes="false"
4-
bootstrap="vendor/autoload.php"
5-
colors="true"
6-
convertErrorsToExceptions="true"
7-
convertNoticesToExceptions="true"
8-
convertWarningsToExceptions="true"
9-
processIsolation="false"
10-
stopOnFailure="false"
11-
verbose="true"
12-
>
13-
<testsuites>
14-
<testsuite name="Test Suite">
15-
<directory>tests</directory>
16-
</testsuite>
17-
</testsuites>
18-
<coverage>
19-
<include>
20-
<directory suffix=".php">./src</directory>
21-
</include>
22-
<report>
23-
<html outputDirectory="build/coverage"/>
24-
<text outputFile="build/coverage.txt"/>
25-
<clover outputFile="build/logs/clover.xml"/>
26-
</report>
27-
</coverage>
28-
<logging>
29-
<junit outputFile="build/report.junit.xml"/>
30-
</logging>
31-
<php>
32-
<env name="APP_ENV" value="testing"/>
33-
<env name="DB_CONNECTION" value="sqlite"/>
34-
<env name="DB_DATABASE" value=":memory:"/>
35-
</php>
2+
<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.5/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
3+
<testsuites>
4+
<testsuite name="Test Suite">
5+
<directory>tests</directory>
6+
</testsuite>
7+
</testsuites>
8+
<coverage>
9+
<report>
10+
<html outputDirectory="build/coverage"/>
11+
<text outputFile="build/coverage.txt"/>
12+
<clover outputFile="build/logs/clover.xml"/>
13+
</report>
14+
</coverage>
15+
<logging>
16+
<junit outputFile="build/report.junit.xml"/>
17+
</logging>
18+
<php>
19+
<env name="APP_ENV" value="testing"/>
20+
<env name="DB_CONNECTION" value="sqlite"/>
21+
<env name="DB_DATABASE" value=":memory:"/>
22+
</php>
23+
<source>
24+
<include>
25+
<directory suffix=".php">./src</directory>
26+
</include>
27+
</source>
3628
</phpunit>

tests/AsJobWithBatchTest.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Illuminate\Bus\Batch;
66
use Illuminate\Support\Facades\Bus;
77
use Illuminate\Support\Facades\Schema;
8+
use Illuminate\Support\Str;
89
use Lorisleiva\Actions\Concerns\AsJob;
910

1011
class AsJobWithBatchTest
@@ -44,7 +45,11 @@ public function asJob(?Batch $batch, int $left, int $right)
4445
// And have a `job_batches` table.
4546
$this->artisan('migrate')->run();
4647
if (! Schema::hasTable('job_batches')) {
47-
$this->artisan('queue:batches-table')->run();
48+
if (Str::startsWith($this->app->version(), "11.")) {
49+
$this->artisan('make:queue-batches-table')->run();
50+
} else {
51+
$this->artisan('queue:batches-table')->run();
52+
}
4853
$this->artisan('migrate')->run();
4954
}
5055
});

0 commit comments

Comments
 (0)