Skip to content

Commit

Permalink
Support Laravel 10 and 11
Browse files Browse the repository at this point in the history
  • Loading branch information
oanhnn committed Dec 28, 2024
1 parent 788625f commit ac068fd
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 31 deletions.
45 changes: 37 additions & 8 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,54 @@ on: [push, pull_request]

jobs:
test:
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
strategy:
fail-fast: true
fail-fast: false
matrix:
os: [ubuntu-latest]
php:
- "8.0"
- "8.1"
- "8.2"
- "8.3"
- "8.4"
laravel:
- "^8.12"
- "^9.0"
- "^10.0"
- "^11.0"
stability: [prefer-lowest, prefer-stable]
include:
- laravel: "^11.0"
testbench: 9.*
- laravel: "^10.0"
testbench: 8.*
- laravel: "^9.0"
testbench: 7.*
- laravel: "^8.12"
testbench: "^6.23"
exclude:
- laravel: "^11.0"
php: 8.1
- laravel: "^11.0"
php: 8.0
- laravel: "^10.0"
php: 8.0
- laravel: "^8.12"
php: 8.3
- laravel: "^8.12"
php: 8.4

name: PHP${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}
name: PHP${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }}

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
extensions: curl, mbstring, fileinfo
coverage: none

- name: Setup problem matchers
Expand All @@ -36,10 +63,12 @@ jobs:
uses: actions/cache@v2
with:
path: vendor
key: composer-${{ matrix.stability }}-${{ hashFiles('composer.json') }}
key: composer-PHP${{ matrix.php }}-L${{ matrix.laravel }}-${{ matrix.stability }}-${{ hashFiles('composer.json') }}

- name: Install dependencies
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction
run: |
composer require "illuminate/support:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}"
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: Execute tests
run: vendor/bin/phpunit
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#################################################
composer.lock
vendor
.phpunit.result.cache
.phpunit.cache
phpunit.xml
phpcs.xml
build
Expand Down
13 changes: 5 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,13 @@
}
],
"require": {
"php": "^8.0",
"illuminate/support": "^8.12|^9.0"
"php": ">=8.0",
"illuminate/support": "^8.12|^9.0|^10.0|^11.0"
},
"require-dev": {
"nunomaduro/collision": "^6.2",
"orchestra/testbench": "^6.0|^7.0",
"phpunit/phpunit": "^9.5",
"psalm/plugin-laravel": "^1.0|^2.0",
"squizlabs/php_codesniffer": "^3.6",
"vimeo/psalm": "^4.11"
"orchestra/testbench": "^6.23|^7.0|^8.0|^9.0",
"phpunit/phpunit": "^9.0|^10.0|^11.0",
"squizlabs/php_codesniffer": "^3.10"
},
"autoload": {
"psr-4": {
Expand Down
29 changes: 15 additions & 14 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
cacheDirectory=".phpunit.cache"
>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./app</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Tests">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<php>
<env name="APP_ENV" value="testing" />
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
</php>
<testsuites>
<testsuite name="Tests">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<php>
<env name="APP_ENV" value="testing"/>
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
</php>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
2 changes: 2 additions & 0 deletions tests/ServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ protected function getPackageProviders($app)
}

/** @test */
#[\PHPUnit\Framework\Attributes\Test]
public function it_should_has_temporary_url()
{
$path = 'test/file.txt';
Expand All @@ -35,6 +36,7 @@ public function it_should_has_temporary_url()
$response->assertOk()
->assertDownload('file.txt');

// Sleep 2 seconds
sleep(2);

$response = $this->get($url);
Expand Down

0 comments on commit ac068fd

Please sign in to comment.