Skip to content

Commit

Permalink
Merge pull request #169 from ARCANEDEV/update-laravel_9
Browse files Browse the repository at this point in the history
Adding Support to Laravel 9
  • Loading branch information
arcanedev-maroc authored Feb 26, 2022
2 parents 4bdc321 + f8f4599 commit 9b22fc5
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 38 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [7.3, 7.4, 8.0]
php: [8.0, 8.1]
dependency-version: [prefer-lowest, prefer-stable]

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: curl, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, iconv, intl
coverage: xdebug
tools: composer:v2
coverage: pcov

- name: Install dependencies
run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
Expand Down
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ checks:
tools:
external_code_coverage:
timeout: 600
runs: 6
runs: 4
php_code_sniffer:
enabled: true
config:
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

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

Easy i18n localization for Laravel, an useful tool to combine with Laravel localization classes.
Easy i18n localization for Laravel, a useful tool to combine with Laravel localization classes.

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

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

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

[badge_license]: http://img.shields.io/packagist/l/arcanedev/localization.svg?style=flat-square
[badge_laravel]: https://img.shields.io/badge/Laravel-5.x%20to%208.x-orange.svg?style=flat-square
[badge_laravel]: https://img.shields.io/badge/Laravel-5.x%20to%209.x-orange.svg?style=flat-square
[badge_build]: https://img.shields.io/github/workflow/status/ARCANEDEV/Localization/run-tests?style=flat-square
[badge_coverage]: https://img.shields.io/scrutinizer/coverage/g/ARCANEDEV/Localization.svg?style=flat-square
[badge_quality]: https://img.shields.io/scrutinizer/g/ARCANEDEV/Localization.svg?style=flat-square
Expand Down
22 changes: 0 additions & 22 deletions _docs/0-Home.md

This file was deleted.

3 changes: 3 additions & 0 deletions _docs/1-Installation-and-Setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

| Laravel | Localization |
|:-----------------------------|:---------------------------------------|
| ![Laravel v9.*][laravel_9_x] | ![Localization v9.x][localization_9_x] |
| ![Laravel v8.*][laravel_8_x] | ![Localization v8.x][localization_8_x] |
| ![Laravel v7.*][laravel_7_x] | ![Localization v7.x][localization_7_x] |
| ![Laravel v6.*][laravel_6_x] | ![Localization v6.x][localization_6_x] |
Expand All @@ -24,6 +25,7 @@
| ![Laravel v5.1][laravel_5_1] | ![Localization v0.x][localization_0_x] |
| ![Laravel v5.0][laravel_5_0] | ![Localization v0.x][localization_0_x] |

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

[localization_9_x]: https://img.shields.io/badge/version-9.*-blue.svg?style=flat-square "Localization v9.*"
[localization_8_x]: https://img.shields.io/badge/version-8.*-blue.svg?style=flat-square "Localization v8.*"
[localization_7_x]: https://img.shields.io/badge/version-7.*-blue.svg?style=flat-square "Localization v7.*"
[localization_6_x]: https://img.shields.io/badge/version-6.*-blue.svg?style=flat-square "Localization v6.*"
Expand Down
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
"type": "library",
"license": "MIT",
"require": {
"php": "^7.3|^8.0",
"php": "^8.0",
"ext-json": "*",
"arcanedev/support": "^8.0"
"arcanedev/support": "^9.0"
},
"require-dev": {
"ext-intl": "*",
"laravel/framework": "^8.19",
"mockery/mockery": "^1.4.2",
"orchestra/testbench-core": "^6.4",
"phpunit/phpunit": "^9.3.3"
"laravel/framework": "^9.0",
"mockery/mockery": "^1.4.4",
"orchestra/testbench-core": "^7.0",
"phpunit/phpunit": "^9.5.10"
},
"autoload": {
"psr-4": {
Expand All @@ -43,7 +43,7 @@
},
"extra": {
"branch-alias": {
"dev-develop": "8.x-dev"
"dev-develop": "9.x-dev"
},
"laravel": {
"providers": [
Expand Down
37 changes: 36 additions & 1 deletion tests/Stubs/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Arcanedev\Localization\Tests\Stubs\Http;

use Orchestra\Testbench\Http\Kernel as HttpKernel;
use Orchestra\Testbench\Foundation\Http\Kernel as HttpKernel;

/**
* Class Kernel
Expand All @@ -18,6 +18,22 @@ class Kernel extends HttpKernel
| -----------------------------------------------------------------
*/

/**
* The application's middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array
*/
protected $middleware = [
// Middleware\TrustHosts::class,
// Middleware\TrustProxies::class,
\Orchestra\Testbench\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\Orchestra\Testbench\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
];

/**
* The application's route middleware groups.
*
Expand All @@ -35,4 +51,23 @@ class Kernel extends HttpKernel
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];

/**
* The application's route middleware.
*
* These middleware may be assigned to groups or used individually.
*
* @var array
*/
protected $routeMiddleware = [
'auth' => \Orchestra\Testbench\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \Orchestra\Testbench\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
];
}
5 changes: 4 additions & 1 deletion tests/TranslatableModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Arcanedev\Localization\Events\TranslationHasBeenSet;
use Arcanedev\Localization\Tests\Stubs\Models\TranslatableModel;
use Illuminate\Support\Facades\Event;

/**
* Class TranslatableModelTest
Expand Down Expand Up @@ -322,11 +323,13 @@ public function it_can_check_if_an_attribute_has_translation(): void
/** @test */
public function it_will_fire_an_event_when_a_translation_has_been_set(): void
{
$this->expectsEvents([TranslationHasBeenSet::class]);
Event::fake();

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

static::assertSame(['en' => 'Name'], $this->model->getTranslations('name'));

Event::assertDispatched(TranslationHasBeenSet::class);
}

/** @test */
Expand Down

0 comments on commit 9b22fc5

Please sign in to comment.