Skip to content

Commit 9b22fc5

Browse files
Merge pull request #169 from ARCANEDEV/update-laravel_9
Adding Support to Laravel 9
2 parents 4bdc321 + f8f4599 commit 9b22fc5

8 files changed

Lines changed: 57 additions & 38 deletions

File tree

.github/workflows/run-tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
strategy:
1010
fail-fast: true
1111
matrix:
12-
php: [7.3, 7.4, 8.0]
12+
php: [8.0, 8.1]
1313
dependency-version: [prefer-lowest, prefer-stable]
1414

1515
name: PHP ${{ matrix.php }} - ${{ matrix.dependency-version }}
@@ -24,15 +24,15 @@ jobs:
2424
uses: actions/cache@v2
2525
with:
2626
path: ~/.composer/cache/files
27-
key: dependencies-laravel-8-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
27+
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
2828

2929
- name: Setup PHP
3030
uses: shivammathur/setup-php@v2
3131
with:
3232
php-version: ${{ matrix.php }}
3333
extensions: curl, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, iconv, intl
34-
coverage: xdebug
3534
tools: composer:v2
35+
coverage: pcov
3636

3737
- name: Install dependencies
3838
run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction

.scrutinizer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ checks:
2222
tools:
2323
external_code_coverage:
2424
timeout: 600
25-
runs: 6
25+
runs: 4
2626
php_code_sniffer:
2727
enabled: true
2828
config:

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
*By [ARCANEDEV©](http://www.arcanedev.net/)*
1414

15-
Easy i18n localization for Laravel, an useful tool to combine with Laravel localization classes.
15+
Easy i18n localization for Laravel, a useful tool to combine with Laravel localization classes.
1616

1717
Official documentation for Localization package can be found at the [Docs folder](_docs).
1818

@@ -21,7 +21,7 @@ Feel free to check out the [releases](https://github.com/ARCANEDEV/Localization/
2121
### Features
2222

2323
* Easy setup & configuration.
24-
* Laravel `5.x` to `8.x` are supported.
24+
* Laravel `5.x` to `9.x` are supported.
2525
* SEO-Friendly (Search engine optimization).
2626
* New extended Router to manage your localized routes.
2727
* Translated Eloquent Models.
@@ -52,7 +52,7 @@ If you discover any security related issues, please email arcanedev.maroc@gmail.
5252
- [All Contributors][link-contributors]
5353

5454
[badge_license]: http://img.shields.io/packagist/l/arcanedev/localization.svg?style=flat-square
55-
[badge_laravel]: https://img.shields.io/badge/Laravel-5.x%20to%208.x-orange.svg?style=flat-square
55+
[badge_laravel]: https://img.shields.io/badge/Laravel-5.x%20to%209.x-orange.svg?style=flat-square
5656
[badge_build]: https://img.shields.io/github/workflow/status/ARCANEDEV/Localization/run-tests?style=flat-square
5757
[badge_coverage]: https://img.shields.io/scrutinizer/coverage/g/ARCANEDEV/Localization.svg?style=flat-square
5858
[badge_quality]: https://img.shields.io/scrutinizer/g/ARCANEDEV/Localization.svg?style=flat-square

_docs/0-Home.md

Lines changed: 0 additions & 22 deletions
This file was deleted.

_docs/1-Installation-and-Setup.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
| Laravel | Localization |
1313
|:-----------------------------|:---------------------------------------|
14+
| ![Laravel v9.*][laravel_9_x] | ![Localization v9.x][localization_9_x] |
1415
| ![Laravel v8.*][laravel_8_x] | ![Localization v8.x][localization_8_x] |
1516
| ![Laravel v7.*][laravel_7_x] | ![Localization v7.x][localization_7_x] |
1617
| ![Laravel v6.*][laravel_6_x] | ![Localization v6.x][localization_6_x] |
@@ -24,6 +25,7 @@
2425
| ![Laravel v5.1][laravel_5_1] | ![Localization v0.x][localization_0_x] |
2526
| ![Laravel v5.0][laravel_5_0] | ![Localization v0.x][localization_0_x] |
2627

28+
[laravel_9_x]: https://img.shields.io/badge/version-9.x-blue.svg?style=flat-square "Laravel v9.*"
2729
[laravel_8_x]: https://img.shields.io/badge/version-8.x-blue.svg?style=flat-square "Laravel v8.*"
2830
[laravel_7_x]: https://img.shields.io/badge/version-7.x-blue.svg?style=flat-square "Laravel v7.*"
2931
[laravel_6_x]: https://img.shields.io/badge/version-6.x-blue.svg?style=flat-square "Laravel v6.*"
@@ -37,6 +39,7 @@
3739
[laravel_5_1]: https://img.shields.io/badge/version-5.1-blue.svg?style=flat-square "Laravel v5.1"
3840
[laravel_5_0]: https://img.shields.io/badge/version-5.0-blue.svg?style=flat-square "Laravel v5.0"
3941

42+
[localization_9_x]: https://img.shields.io/badge/version-9.*-blue.svg?style=flat-square "Localization v9.*"
4043
[localization_8_x]: https://img.shields.io/badge/version-8.*-blue.svg?style=flat-square "Localization v8.*"
4144
[localization_7_x]: https://img.shields.io/badge/version-7.*-blue.svg?style=flat-square "Localization v7.*"
4245
[localization_6_x]: https://img.shields.io/badge/version-6.*-blue.svg?style=flat-square "Localization v6.*"

composer.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@
1414
"type": "library",
1515
"license": "MIT",
1616
"require": {
17-
"php": "^7.3|^8.0",
17+
"php": "^8.0",
1818
"ext-json": "*",
19-
"arcanedev/support": "^8.0"
19+
"arcanedev/support": "^9.0"
2020
},
2121
"require-dev": {
2222
"ext-intl": "*",
23-
"laravel/framework": "^8.19",
24-
"mockery/mockery": "^1.4.2",
25-
"orchestra/testbench-core": "^6.4",
26-
"phpunit/phpunit": "^9.3.3"
23+
"laravel/framework": "^9.0",
24+
"mockery/mockery": "^1.4.4",
25+
"orchestra/testbench-core": "^7.0",
26+
"phpunit/phpunit": "^9.5.10"
2727
},
2828
"autoload": {
2929
"psr-4": {
@@ -43,7 +43,7 @@
4343
},
4444
"extra": {
4545
"branch-alias": {
46-
"dev-develop": "8.x-dev"
46+
"dev-develop": "9.x-dev"
4747
},
4848
"laravel": {
4949
"providers": [

tests/Stubs/Http/Kernel.php

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Arcanedev\Localization\Tests\Stubs\Http;
66

7-
use Orchestra\Testbench\Http\Kernel as HttpKernel;
7+
use Orchestra\Testbench\Foundation\Http\Kernel as HttpKernel;
88

99
/**
1010
* Class Kernel
@@ -18,6 +18,22 @@ class Kernel extends HttpKernel
1818
| -----------------------------------------------------------------
1919
*/
2020

21+
/**
22+
* The application's middleware stack.
23+
*
24+
* These middleware are run during every request to your application.
25+
*
26+
* @var array
27+
*/
28+
protected $middleware = [
29+
// Middleware\TrustHosts::class,
30+
// Middleware\TrustProxies::class,
31+
\Orchestra\Testbench\Http\Middleware\PreventRequestsDuringMaintenance::class,
32+
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
33+
\Orchestra\Testbench\Http\Middleware\TrimStrings::class,
34+
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
35+
];
36+
2137
/**
2238
* The application's route middleware groups.
2339
*
@@ -35,4 +51,23 @@ class Kernel extends HttpKernel
3551
\Illuminate\Routing\Middleware\SubstituteBindings::class,
3652
],
3753
];
54+
55+
/**
56+
* The application's route middleware.
57+
*
58+
* These middleware may be assigned to groups or used individually.
59+
*
60+
* @var array
61+
*/
62+
protected $routeMiddleware = [
63+
'auth' => \Orchestra\Testbench\Http\Middleware\Authenticate::class,
64+
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
65+
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
66+
'can' => \Illuminate\Auth\Middleware\Authorize::class,
67+
'guest' => \Orchestra\Testbench\Http\Middleware\RedirectIfAuthenticated::class,
68+
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
69+
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
70+
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
71+
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
72+
];
3873
}

tests/TranslatableModelTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use Arcanedev\Localization\Events\TranslationHasBeenSet;
88
use Arcanedev\Localization\Tests\Stubs\Models\TranslatableModel;
9+
use Illuminate\Support\Facades\Event;
910

1011
/**
1112
* Class TranslatableModelTest
@@ -322,11 +323,13 @@ public function it_can_check_if_an_attribute_has_translation(): void
322323
/** @test */
323324
public function it_will_fire_an_event_when_a_translation_has_been_set(): void
324325
{
325-
$this->expectsEvents([TranslationHasBeenSet::class]);
326+
Event::fake();
326327

327328
$this->model->setTranslation('name', 'en', 'Name');
328329

329330
static::assertSame(['en' => 'Name'], $this->model->getTranslations('name'));
331+
332+
Event::assertDispatched(TranslationHasBeenSet::class);
330333
}
331334

332335
/** @test */

0 commit comments

Comments
 (0)