Skip to content

Commit

Permalink
[8.x] Support Laravel 11 (#158)
Browse files Browse the repository at this point in the history
* chore: prepare for laravel 11

* fix: remove phpunit verbose flag

* fix: use phpunit 10.5 as minimum

* fix: run loadMigrationsFrom in defineDatabaseMigrations

---------

Co-authored-by: Ricardo Gobbo de Souza <[email protected]>
  • Loading branch information
joostdebruijn and ricardogobbosouza authored Mar 16, 2024
1 parent 46ab840 commit 799f2f3
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 52 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [7.3, 7.4, 8.0, 8.1, 8.2]
laravel: [7.*, 8.*, 9.*, 10.*]
php: [8.1, 8.2, 8.3]
laravel: [9.*, 10.*, 11.*]
stability: [prefer-lowest, prefer-stable]
exclude:
- php: 8.1
stability: prefer-lowest
- php: 8.2
stability: prefer-lowest
- laravel: 9.*
php: 8.3
- laravel: 11.*
php: 8.1

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

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

- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
Expand All @@ -42,7 +42,7 @@ jobs:
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-suggest

- name: Execute tests
run: vendor/bin/phpunit --verbose
run: vendor/bin/phpunit

- name: Coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
7 changes: 0 additions & 7 deletions .phpunit-watcher.yml

This file was deleted.

20 changes: 9 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,18 @@
}
],
"require": {
"php": "^7.3|^8.0",
"php": "^8.1",
"ext-json": "*",
"ext-intl": "*",
"illuminate/support": "^7.0|^8.0|^9.0|^10.0",
"illuminate/view": "^7.0|^8.0|^9.0|^10.0",
"moneyphp/money": "^3.3|^4.2"
"illuminate/support": "^9.0|^10.0|^11.0",
"illuminate/view": "^9.0|^10.0|^11.0",
"moneyphp/money": "^4.2"
},
"require-dev": {
"graham-campbell/testbench": "^5.7",
"illuminate/filesystem": "^7.0|^8.0|^9.0|^10.0",
"graham-campbell/testbench": "^6.0",
"illuminate/filesystem": "^9.0|^10.0|^11.0",
"mockery/mockery": "^1.6",
"phpunit/phpunit": "^8.5|^9.5.10|^10.0",
"spatie/phpunit-watcher": "^1.23"
"phpunit/phpunit": "^10.5"
},
"autoload": {
"psr-4": {
Expand Down Expand Up @@ -59,7 +58,6 @@
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"test": "vendor/bin/phpunit",
"watch": "vendor/bin/phpunit-watcher watch"
"test": "vendor/bin/phpunit"
}
}
}
36 changes: 17 additions & 19 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
<?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"
>
<testsuites>
<testsuite name="Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
<report>
<clover outputFile="clover.xml"/>
<text outputFile="php://stdout"/>
</report>
</coverage>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true" cacheDirectory=".phpunit.cache">
<testsuites>
<testsuite name="Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<coverage>
<report>
<clover outputFile="clover.xml"/>
<text outputFile="php://stdout"/>
</report>
</coverage>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
4 changes: 1 addition & 3 deletions tests/MoneyCastTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ protected function setUp(): void
{
parent::setUp();

$this->loadMigrationsFrom(__DIR__.'/Database/Migrations');

Money::setCurrencies(config('money.currencies'));
}

protected function defineDatabaseMigrations()
protected function defineDatabaseMigrations(): void
{
$this->loadMigrationsFrom(__DIR__.'/Database/Migrations');
}
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ abstract class TestCase extends AbstractPackageTestCase
* @param \Illuminate\Contracts\Foundation\Application $app
* @return void
*/
protected function getEnvironmentSetUp($app)
protected function getEnvironmentSetUp($app): void
{
$app->config->set('money.locale', 'en_US');

Expand All @@ -25,7 +25,7 @@ protected function getEnvironmentSetUp($app)
*
* @return string
*/
protected function getServiceProviderClass()
protected static function getServiceProviderClass(): string
{
return MoneyServiceProvider::class;
}
Expand Down

0 comments on commit 799f2f3

Please sign in to comment.