Skip to content
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

Laravel 11 support #15

Merged
merged 5 commits into from
Jun 12, 2024
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
111 changes: 37 additions & 74 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,94 +1,57 @@
name: Tests

on: [push, pull_request]
on:
workflow_dispatch:
push:
branches:
- master
paths:
- "**.json"
- "**.php"
- "**.yml"
pull_request:
branches:
- master
paths:
- "**.json"
- "**.php"
- "**.yml"

jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.1, 8.0, 7.4]
laravel: [10.*, 9.*, 8.*, 7.*, 6.*, 5.8.*, 5.7.*, 5.6.*]
dependency-version: [prefer-lowest, prefer-stable]
php: [8.3, 8.2, 8.1]
testbench: [9.0, 8.0, 7.0] # Laravel 11.x, 10.x, 9.x
version: [prefer-stable, prefer-lowest]
include:
- laravel: 10.*
testbench: ^8.0
- laravel: 9.*
testbench: ^7.0
- laravel: 8.*
testbench: ^6.23
- laravel: 7.*
testbench: ^5.20
- laravel: 6.*
testbench: ^4.18
- laravel: 5.8.*
testbench: 3.8.*
- laravel: 5.7.*
testbench: 3.7.*
- laravel: 5.6.*
testbench: 3.6.*
- testbench: 7.0
phpunit: "-c phpunit-9.xml"
exclude:
- laravel: 10.*
php: 8.0
- laravel: 10.*
php: 7.4
- laravel: 9.*
php: 7.4
- laravel: 7.*
php: 8.1
- laravel: 6.*
php: 8.1
- laravel: 5.8.*
php: 8.1
- laravel: 5.8.*
php: 8.0
- laravel: 5.8.*
php: 7.4
dependency-version: prefer-lowest
- laravel: 5.7.*
php: 8.1
- laravel: 5.7.*
php: 8.0
- laravel: 5.7.*
php: 7.4
dependency-version: prefer-lowest
- laravel: 5.6.*
php: 8.1
- laravel: 5.6.*
php: 8.0
- laravel: 5.6.*
php: 7.4
dependency-version: prefer-lowest
- php: 8.1
testbench: 9.0

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

steps:
- name: Checkout code
uses: actions/checkout@v2
runs-on: ubuntu-latest

- name: Install SQLite 3
run: |
sudo apt-get update
sudo apt-get install sqlite3
container:
image: kirschbaumdevelopment/laravel-test-runner:${{ matrix.php }}
options: "--user=root"

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

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction

- name: Setup Problem Matches
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
composer require "orchestra/testbench:^${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.version }} --prefer-dist --no-interaction

- name: Execute tests
run: vendor/bin/phpunit
run: vendor/bin/phpunit ${{ matrix.phpunit }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/vendor
/tests/_reports
/.idea
/composer.lock
/.phpunit.cache
/.phpunit.result.cache
/.php-cs-fixer.cache
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,6 @@ Running tests can be done either through composer, or directly calling the PHPUn
```bash
composer test
```
To run tests with code coverage, please make sure that `phpdbg` exists and is executable.
```bash
composer test-coverage
open tests/_reports/index.html
```

## License
The MIT License (MIT). Please see [License File](LICENSE) for more information.
21 changes: 11 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "frittenkeez/laravel-vouchers",
"description": "Voucher system for Laravel 5.6+",
"description": "Voucher system for Laravel 9+",
"license": "MIT",
"keywords": [
"coupon",
Expand All @@ -16,16 +16,18 @@
}
],
"require": {
"php": "^7.1.3|^8.0",
"illuminate/config": "~5.6.0|~5.7.0|~5.8.0|^6.0|^7.0|^8.0|^9.0|^10.0",
"illuminate/console": "~5.6.0|~5.7.0|~5.8.0|^6.0|^7.0|^8.0|^9.0|^10.0",
"illuminate/database": "~5.6.0|~5.7.0|~5.8.0|^6.0|^7.0|^8.0|^9.0|^10.0",
"illuminate/support": "~5.6.0|~5.7.0|~5.8.0|^6.0|^7.0|^8.0|^9.0|^10.0"
"php": "^8.1",
"illuminate/config": "^9.0|^10.0|^11.0",
"illuminate/console": "^9.0|^10.0|^11.0",
"illuminate/database": "^9.0|^10.0|^11.0",
"illuminate/support": "^9.0|^10.0|^11.0"
},
"require-dev": {
"orchestra/testbench": "~3.6.0|~3.7.0|~3.8.0|^4.0|^5.0|^6.0|^7.0|^8.0",
"phpunit/phpunit": "~7.0|^8.0|^9.0",
"friendsofphp/php-cs-fixer": "^3.4"
"friendsofphp/php-cs-fixer": "^3.4",
"illuminate/support": "^9.45|^10.0|^11.0",
"nesbot/carbon": "^2.63",
"orchestra/testbench": "^7.0|^8.0|^9.0",
"phpunit/phpunit": "^9.6|^10.5"
},
"config": {
"allow-plugins": {
Expand All @@ -48,7 +50,6 @@
},
"scripts": {
"test": "phpunit",
"test-coverage": "phpdbg -qrr vendor/bin/phpunit --coverage-html tests/_reports",
"fixer-check": "php-cs-fixer fix --verbose --dry-run",
"fixer-fix": "php-cs-fixer fix"
},
Expand Down
28 changes: 28 additions & 0 deletions phpunit-9.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Package">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<php>
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
<env name="DB_CONNECTION" value="testing"/>
</php>
</phpunit>
21 changes: 10 additions & 11 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
stopOnFailure="false"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false"
>
<testsuites>
<testsuite name="Package">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
<php>
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
<env name="DB_CONNECTION" value="testing"/>
</php>
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</source>
</phpunit>
2 changes: 1 addition & 1 deletion tests/VouchersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public function testInvalidMagicCall(): void
*
* @return array
*/
public function wrapProvider(): array
public static function wrapProvider(): array
{
return [
'string only' => ['code', null, null, '-', 'code'],
Expand Down