Skip to content

Commit

Permalink
Add support laravel 11
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardogobbosouza committed Apr 26, 2024
1 parent ea1b237 commit 2d24527
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 23 deletions.
26 changes: 17 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,32 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [7.4, 8.0, 8.1]
laravel: [^8.0, ^9.0, ^10.0]
php: [7.4, 8.0, 8.1, 8.2]
laravel: [^8.0, ^9.0, ^10.0, ^11.0]
#stability: [prefer-lowest, prefer-stable]
stability: [prefer-stable]
exclude:
- php: 7.4
laravel: 9
laravel: ^9.0
- php: 7.4
laravel: 10
laravel: ^10.0
- php: 7.4
laravel: ^11.0
- php: 8.0
laravel: ^10.0
- php: 8.0
laravel: 10
laravel: ^11.0
- php: 8.1
laravel: ^11.0

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 @@ -45,7 +51,9 @@ 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
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
16 changes: 7 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,14 @@
"php": "^7.4|^8.0",
"datalogix/laravel-translation": "^1.1|^2.0",
"datalogix/laravel-validation": "^1.3|^2.0",
"illuminate/contracts": "^8.0|^9.0|^10.0",
"illuminate/database": "^8.0|^9.0|^10.0",
"illuminate/pagination": "^8.0|^9.0|^10.0",
"illuminate/support": "^8.0|^9.0|^10.0"
"illuminate/contracts": "^8.0|^9.0|^10.0|^11.0",
"illuminate/database": "^8.0|^9.0|^10.0|^11.0",
"illuminate/pagination": "^8.0|^9.0|^10.0|^11.0",
"illuminate/support": "^8.0|^9.0|^10.0|^11.0"
},
"require-dev": {
"graham-campbell/testbench": "^6.0",
"phpunit/phpunit": "^9.5|^10.0",
"spatie/phpunit-watcher": "^1.23"
"graham-campbell/testbench": "^6.1",
"phpunit/phpunit": "^9.5|^10.5"
},
"autoload": {
"psr-4": {
Expand All @@ -48,8 +47,7 @@
}
},
"scripts": {
"test": "vendor/bin/phpunit",
"watch": "vendor/bin/phpunit-watcher watch"
"test": "vendor/bin/phpunit"
},
"extra": {
"laravel": {
Expand Down
9 changes: 7 additions & 2 deletions tests/CustomValuesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

namespace Datalogix\Utils\Tests;

use Carbon\Carbon;
use Datalogix\Utils\Http\Middleware\HttpsProtocolMiddleware;
use Illuminate\Contracts\Http\Kernel;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Schema\Builder;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\Str;

class CustomValuesTest extends TestCase
{
Expand Down Expand Up @@ -47,8 +48,12 @@ public function testModelUnguarded()
public function testLocale()
{
$this->app->setLocale('en');
$this->assertEquals('en', Carbon::getLocale());
$this->assertEquals('january', Str::lower(Carbon::parse('2020-01-01')->getTranslatedMonthName()));

$this->assertEquals('01 January 2020', Carbon::parse('2020-01-01')->formatLocalized('%d %B %Y'));
$this->app->setLocale('pt_BR');
$this->assertEquals('pt_BR', Carbon::getLocale());
$this->assertEquals('janeiro', Str::lower(Carbon::parse('2020-01-01')->getTranslatedMonthName()));
}

public function testSchemaDefaultStringLength()
Expand Down
9 changes: 6 additions & 3 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@

namespace Datalogix\Utils\Tests;

use Carbon\Laravel\ServiceProvider as CarbonServiceProvider;
use Datalogix\Utils\UtilsServiceProvider;
use GrahamCampbell\TestBench\AbstractPackageTestCase;

abstract class TestCase extends AbstractPackageTestCase
{
/**
* Get the service provider class.
*/
protected static function getServiceProviderClass(): string
{
return UtilsServiceProvider::class;
}

protected static function getRequiredServiceProviders(): array
{
return [CarbonServiceProvider::class];
}
}

0 comments on commit 2d24527

Please sign in to comment.