diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index b4345c0..66c8486 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -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 }} @@ -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 diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 8a9285f..69d4755 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -22,7 +22,7 @@ checks: tools: external_code_coverage: timeout: 600 - runs: 6 + runs: 4 php_code_sniffer: enabled: true config: diff --git a/README.md b/README.md index eedfd29..e283298 100644 --- a/README.md +++ b/README.md @@ -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). @@ -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. @@ -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 diff --git a/_docs/0-Home.md b/_docs/0-Home.md deleted file mode 100644 index ac5f355..0000000 --- a/_docs/0-Home.md +++ /dev/null @@ -1,22 +0,0 @@ -# Localization - -Easy i18n localization for Laravel, an useful tool to combine with Laravel localization classes. - -Feel free to check out the [Releases](https://github.com/ARCANEDEV/Localization/releases), [License](https://github.com/ARCANEDEV/Localization/blob/master/LICENSE.md), and [Contribution Guidelines](https://github.com/ARCANEDEV/Localization/blob/master/CONTRIBUTING.md). - -### Features - - * Easy setup & configuration. - * Laravel `5.x` to `8.x` are supported. - * SEO-Friendly (Search engine optimization). - * New extended Router to manage your localized routes. - * Locales selector menu (Publishable & Customizable). - * Locales manager: List all locales / supported locales, change default locale / supported locales on the fly, and more. - * Made with :heart: & :coffee:. - -## Table of contents - - 1. [Installation and Setup](1-Installation-and-Setup.md) - 2. [Configuration](2-Configuration.md) - 3. [Usage](3-Usage.md) - 4. [FAQ](4-FAQ.md) diff --git a/_docs/1-Installation-and-Setup.md b/_docs/1-Installation-and-Setup.md index efba47e..d37c52d 100644 --- a/_docs/1-Installation-and-Setup.md +++ b/_docs/1-Installation-and-Setup.md @@ -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] | @@ -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.*" @@ -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.*" diff --git a/composer.json b/composer.json index 1619688..e57c3b8 100644 --- a/composer.json +++ b/composer.json @@ -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": { @@ -43,7 +43,7 @@ }, "extra": { "branch-alias": { - "dev-develop": "8.x-dev" + "dev-develop": "9.x-dev" }, "laravel": { "providers": [ diff --git a/tests/Stubs/Http/Kernel.php b/tests/Stubs/Http/Kernel.php index 056efcd..a2c39f4 100644 --- a/tests/Stubs/Http/Kernel.php +++ b/tests/Stubs/Http/Kernel.php @@ -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 @@ -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. * @@ -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, + ]; } diff --git a/tests/TranslatableModelTest.php b/tests/TranslatableModelTest.php index baa97ca..2298e6d 100644 --- a/tests/TranslatableModelTest.php +++ b/tests/TranslatableModelTest.php @@ -6,6 +6,7 @@ use Arcanedev\Localization\Events\TranslationHasBeenSet; use Arcanedev\Localization\Tests\Stubs\Models\TranslatableModel; +use Illuminate\Support\Facades\Event; /** * Class TranslatableModelTest @@ -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 */