Skip to content

Commit 4c4d796

Browse files
authored
Merge pull request #15 from FrittenKeeZ/laravel-11-support
Laravel 11 support
2 parents be029a4 + dbfb846 commit 4c4d796

File tree

7 files changed

+88
-102
lines changed

7 files changed

+88
-102
lines changed

.github/workflows/tests.yml

Lines changed: 37 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,57 @@
11
name: Tests
22

3-
on: [push, pull_request]
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- master
8+
paths:
9+
- "**.json"
10+
- "**.php"
11+
- "**.yml"
12+
pull_request:
13+
branches:
14+
- master
15+
paths:
16+
- "**.json"
17+
- "**.php"
18+
- "**.yml"
419

520
jobs:
621
tests:
7-
runs-on: ${{ matrix.os }}
822
strategy:
923
fail-fast: true
1024
matrix:
11-
os: [ubuntu-latest]
12-
php: [8.1, 8.0, 7.4]
13-
laravel: [10.*, 9.*, 8.*, 7.*, 6.*, 5.8.*, 5.7.*, 5.6.*]
14-
dependency-version: [prefer-lowest, prefer-stable]
25+
php: [8.3, 8.2, 8.1]
26+
testbench: [9.0, 8.0, 7.0] # Laravel 11.x, 10.x, 9.x
27+
version: [prefer-stable, prefer-lowest]
1528
include:
16-
- laravel: 10.*
17-
testbench: ^8.0
18-
- laravel: 9.*
19-
testbench: ^7.0
20-
- laravel: 8.*
21-
testbench: ^6.23
22-
- laravel: 7.*
23-
testbench: ^5.20
24-
- laravel: 6.*
25-
testbench: ^4.18
26-
- laravel: 5.8.*
27-
testbench: 3.8.*
28-
- laravel: 5.7.*
29-
testbench: 3.7.*
30-
- laravel: 5.6.*
31-
testbench: 3.6.*
29+
- testbench: 7.0
30+
phpunit: "-c phpunit-9.xml"
3231
exclude:
33-
- laravel: 10.*
34-
php: 8.0
35-
- laravel: 10.*
36-
php: 7.4
37-
- laravel: 9.*
38-
php: 7.4
39-
- laravel: 7.*
40-
php: 8.1
41-
- laravel: 6.*
42-
php: 8.1
43-
- laravel: 5.8.*
44-
php: 8.1
45-
- laravel: 5.8.*
46-
php: 8.0
47-
- laravel: 5.8.*
48-
php: 7.4
49-
dependency-version: prefer-lowest
50-
- laravel: 5.7.*
51-
php: 8.1
52-
- laravel: 5.7.*
53-
php: 8.0
54-
- laravel: 5.7.*
55-
php: 7.4
56-
dependency-version: prefer-lowest
57-
- laravel: 5.6.*
58-
php: 8.1
59-
- laravel: 5.6.*
60-
php: 8.0
61-
- laravel: 5.6.*
62-
php: 7.4
63-
dependency-version: prefer-lowest
32+
- php: 8.1
33+
testbench: 9.0
6434

65-
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
35+
name: P${{ matrix.php }} - T${{ matrix.testbench }} - ${{ matrix.version }}
6636

67-
steps:
68-
- name: Checkout code
69-
uses: actions/checkout@v2
37+
runs-on: ubuntu-latest
7038

71-
- name: Install SQLite 3
72-
run: |
73-
sudo apt-get update
74-
sudo apt-get install sqlite3
39+
container:
40+
image: kirschbaumdevelopment/laravel-test-runner:${{ matrix.php }}
41+
options: "--user=root"
7542

76-
- name: Setup PHP
77-
uses: shivammathur/setup-php@v2
43+
steps:
44+
- name: Checkout code
45+
uses: actions/checkout@v4
7846
with:
79-
php-version: ${{ matrix.php }}
80-
extensions: curl, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, iconv
81-
coverage: none
47+
# Make sure the actual branch is checked out when running on pull requests.
48+
ref: ${{ github.head_ref }}
49+
token: ${{ secrets.GITHUB_TOKEN }}
8250

8351
- name: Install dependencies
8452
run: |
85-
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
86-
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
87-
88-
- name: Setup Problem Matches
89-
run: |
90-
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
91-
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
53+
composer require "orchestra/testbench:^${{ matrix.testbench }}" --no-interaction --no-update
54+
composer update --${{ matrix.version }} --prefer-dist --no-interaction
9255
9356
- name: Execute tests
94-
run: vendor/bin/phpunit
57+
run: vendor/bin/phpunit ${{ matrix.phpunit }}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/vendor
2-
/tests/_reports
32
/.idea
43
/composer.lock
4+
/.phpunit.cache
55
/.phpunit.result.cache
66
/.php-cs-fixer.cache

README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,6 @@ Running tests can be done either through composer, or directly calling the PHPUn
298298
```bash
299299
composer test
300300
```
301-
To run tests with code coverage, please make sure that `phpdbg` exists and is executable.
302-
```bash
303-
composer test-coverage
304-
open tests/_reports/index.html
305-
```
306301

307302
## License
308303
The MIT License (MIT). Please see [License File](LICENSE) for more information.

composer.json

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "frittenkeez/laravel-vouchers",
3-
"description": "Voucher system for Laravel 5.6+",
3+
"description": "Voucher system for Laravel 9+",
44
"license": "MIT",
55
"keywords": [
66
"coupon",
@@ -16,16 +16,18 @@
1616
}
1717
],
1818
"require": {
19-
"php": "^7.1.3|^8.0",
20-
"illuminate/config": "~5.6.0|~5.7.0|~5.8.0|^6.0|^7.0|^8.0|^9.0|^10.0",
21-
"illuminate/console": "~5.6.0|~5.7.0|~5.8.0|^6.0|^7.0|^8.0|^9.0|^10.0",
22-
"illuminate/database": "~5.6.0|~5.7.0|~5.8.0|^6.0|^7.0|^8.0|^9.0|^10.0",
23-
"illuminate/support": "~5.6.0|~5.7.0|~5.8.0|^6.0|^7.0|^8.0|^9.0|^10.0"
19+
"php": "^8.1",
20+
"illuminate/config": "^9.0|^10.0|^11.0",
21+
"illuminate/console": "^9.0|^10.0|^11.0",
22+
"illuminate/database": "^9.0|^10.0|^11.0",
23+
"illuminate/support": "^9.0|^10.0|^11.0"
2424
},
2525
"require-dev": {
26-
"orchestra/testbench": "~3.6.0|~3.7.0|~3.8.0|^4.0|^5.0|^6.0|^7.0|^8.0",
27-
"phpunit/phpunit": "~7.0|^8.0|^9.0",
28-
"friendsofphp/php-cs-fixer": "^3.4"
26+
"friendsofphp/php-cs-fixer": "^3.4",
27+
"illuminate/support": "^9.45|^10.0|^11.0",
28+
"nesbot/carbon": "^2.63",
29+
"orchestra/testbench": "^7.0|^8.0|^9.0",
30+
"phpunit/phpunit": "^9.6|^10.5"
2931
},
3032
"config": {
3133
"allow-plugins": {
@@ -48,7 +50,6 @@
4850
},
4951
"scripts": {
5052
"test": "phpunit",
51-
"test-coverage": "phpdbg -qrr vendor/bin/phpunit --coverage-html tests/_reports",
5253
"fixer-check": "php-cs-fixer fix --verbose --dry-run",
5354
"fixer-fix": "php-cs-fixer fix"
5455
},

phpunit-9.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
4+
backupGlobals="false"
5+
backupStaticAttributes="false"
6+
bootstrap="vendor/autoload.php"
7+
colors="true"
8+
convertErrorsToExceptions="true"
9+
convertNoticesToExceptions="true"
10+
convertWarningsToExceptions="true"
11+
processIsolation="false"
12+
stopOnFailure="false"
13+
>
14+
<coverage processUncoveredFiles="true">
15+
<include>
16+
<directory suffix=".php">src</directory>
17+
</include>
18+
</coverage>
19+
<testsuites>
20+
<testsuite name="Package">
21+
<directory suffix="Test.php">./tests</directory>
22+
</testsuite>
23+
</testsuites>
24+
<php>
25+
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
26+
<env name="DB_CONNECTION" value="testing"/>
27+
</php>
28+
</phpunit>

phpunit.xml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
44
backupGlobals="false"
5-
backupStaticAttributes="false"
65
bootstrap="vendor/autoload.php"
76
colors="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
117
processIsolation="false"
12-
stopOnFailure="false">
8+
stopOnFailure="false"
9+
cacheDirectory=".phpunit.cache"
10+
backupStaticProperties="false"
11+
>
1312
<testsuites>
1413
<testsuite name="Package">
1514
<directory suffix="Test.php">./tests</directory>
1615
</testsuite>
1716
</testsuites>
18-
<filter>
19-
<whitelist processUncoveredFilesFromWhitelist="true">
20-
<directory suffix=".php">src</directory>
21-
</whitelist>
22-
</filter>
2317
<php>
2418
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
2519
<env name="DB_CONNECTION" value="testing"/>
2620
</php>
21+
<source>
22+
<include>
23+
<directory suffix=".php">src</directory>
24+
</include>
25+
</source>
2726
</phpunit>

tests/VouchersTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ public function testInvalidMagicCall(): void
253253
*
254254
* @return array
255255
*/
256-
public function wrapProvider(): array
256+
public static function wrapProvider(): array
257257
{
258258
return [
259259
'string only' => ['code', null, null, '-', 'code'],

0 commit comments

Comments
 (0)