diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 9e9fd1f..4554c07 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -8,28 +8,17 @@ jobs: strategy: fail-fast: true matrix: - php: [ 8.0, 8.1 ] - laravel: [ 8.*, 9.*, 10.* ] + php: [ 8.1, 8.2, 8.3 ] + laravel: [ 10.*, 11.* ] dependency-version: [ prefer-stable ] exclude: - - laravel: 10.* - php: 8.0 + - laravel: 11.* + php: 8.1 include: - - laravel: 7.* - php: 7.2 - testbench: 5.* - - laravel: 7.* - php: 8.0 - testbench: 5.* - - laravel: 8.* - php: 7.3 - testbench: 6.* - - laravel: 8.* - testbench: 6.* - - laravel: 9.* - testbench: 7.* - laravel: 10.* testbench: 8.* + - laravel: 11.* + testbench: 9.* name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} diff --git a/.gitignore b/.gitignore index fe1052a..667fe37 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /vendor /phpunit.xml composer.lock +/.phpunit.cache /.phpunit.result.cache diff --git a/README.md b/README.md index a19a109..8323ead 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Laravel URI Translator [![GitHub release](https://img.shields.io/github/release/codezero-be/laravel-uri-translator.svg?style=flat-square)](https://github.com/codezero-be/laravel-uri-translator/releases) -[![Laravel](https://img.shields.io/badge/laravel-10-red?style=flat-square&logo=laravel&logoColor=white)](https://laravel.com) +[![Laravel](https://img.shields.io/badge/laravel-11-red?style=flat-square&logo=laravel&logoColor=white)](https://laravel.com) [![License](https://img.shields.io/packagist/l/codezero/laravel-uri-translator.svg?style=flat-square)](LICENSE.md) [![Build Status](https://img.shields.io/github/actions/workflow/status/codezero-be/laravel-uri-translator/run-tests.yml?style=flat-square&logo=github&logoColor=white&label=tests)](https://github.com/codezero-be/laravel-uri-translator/actions) [![Code Coverage](https://img.shields.io/codacy/coverage/ad6fcea152b449d380a187a375d0f7d7/master?style=flat-square)](https://app.codacy.com/gh/codezero-be/laravel-uri-translator) @@ -17,8 +17,8 @@ Parameters will not be translated by this macro. That remains the responsibility ## ✅ Requirements -- PHP >= 7.2.5 -- Laravel >= 7.0 +- PHP >= 8.1 +- Laravel >= 10.0 ## 📦 Install diff --git a/composer.json b/composer.json index b324806..eb541e2 100644 --- a/composer.json +++ b/composer.json @@ -20,12 +20,12 @@ } ], "require": { - "php": "^7.2.5|^8.0", - "illuminate/support": "^7.0|^8.0|^9.0|^10.0" + "php": "^8.1", + "illuminate/support": "^10.0|^11.0" }, "require-dev": { - "orchestra/testbench": "^5.0|^6.0|^7.0|^8.0", - "phpunit/phpunit": "^8.0|^9.0" + "orchestra/testbench": "^8.0|^9.0", + "phpunit/phpunit": "^10.5" }, "scripts": { "test": "phpunit" @@ -50,10 +50,7 @@ "config": { "preferred-install": "dist", "sort-packages": true, - "optimize-autoloader": true, - "allow-plugins": { - "kylekatarnls/update-helper": true - } + "optimize-autoloader": true }, "minimum-stability": "dev", "prefer-stable": true diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 461f1f9..3029c21 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,27 +1,27 @@ - + stopOnFailure="false" + xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" + cacheDirectory=".phpunit.cache" + backupStaticProperties="false"> ./tests/Feature - - - ./src - - + + + ./src + + diff --git a/tests/Feature/UriTranslatorTest.php b/tests/Feature/UriTranslatorTest.php index 41267b6..15dec40 100644 --- a/tests/Feature/UriTranslatorTest.php +++ b/tests/Feature/UriTranslatorTest.php @@ -2,13 +2,14 @@ namespace CodeZero\UriTranslator\Tests\Feature; +use PHPUnit\Framework\Attributes\Test; use CodeZero\UriTranslator\Tests\TestCase; use Illuminate\Support\Facades\Lang; -class UriTranslatorTest extends TestCase +final class UriTranslatorTest extends TestCase { - /** @test */ - public function it_translates_every_segment_in_a_uri_to_the_current_locale() + #[Test] + public function it_translates_every_segment_in_a_uri_to_the_current_locale(): void { $this->setTranslations([ 'nl' => [ @@ -26,8 +27,8 @@ public function it_translates_every_segment_in_a_uri_to_the_current_locale() $this->assertEquals('mijn/nieuwe/pagina', trans()->uri('my/new/page')); } - /** @test */ - public function it_translates_every_segment_in_a_uri_to_the_given_locale() + #[Test] + public function it_translates_every_segment_in_a_uri_to_the_given_locale(): void { $this->setTranslations([ 'nl' => [ @@ -40,8 +41,8 @@ public function it_translates_every_segment_in_a_uri_to_the_given_locale() $this->assertEquals('mijn/nieuwe/pagina', Lang::uri('my/new/page', 'nl')); } - /** @test */ - public function it_uses_the_original_values_if_a_translation_does_not_exist() + #[Test] + public function it_uses_the_original_values_if_a_translation_does_not_exist(): void { $this->setTranslations([ 'nl' => [ @@ -54,8 +55,8 @@ public function it_uses_the_original_values_if_a_translation_does_not_exist() $this->assertEquals('my/new/page', Lang::uri('my/new/page', 'fr')); } - /** @test */ - public function it_ignores_trailing_slashes() + #[Test] + public function it_ignores_trailing_slashes(): void { $this->setTranslations([ 'nl' => [ @@ -68,8 +69,8 @@ public function it_ignores_trailing_slashes() $this->assertEquals('mijn/nieuwe/pagina', Lang::uri('/my/new/page/', 'nl')); } - /** @test */ - public function it_skips_placeholders_in_a_uri() + #[Test] + public function it_skips_placeholders_in_a_uri(): void { $this->setTranslations([ 'nl' => [ @@ -80,8 +81,8 @@ public function it_skips_placeholders_in_a_uri() $this->assertEquals('artikels/{articles}', Lang::uri('articles/{articles}', 'nl')); } - /** @test */ - public function you_can_translate_a_full_uri() + #[Test] + public function you_can_translate_a_full_uri(): void { $this->setTranslations([ 'nl' => [ @@ -94,8 +95,8 @@ public function you_can_translate_a_full_uri() $this->assertEquals('producten/glazen', Lang::uri('products/glass', 'nl')); } - /** @test */ - public function you_can_translate_a_full_uri_with_placeholder() + #[Test] + public function you_can_translate_a_full_uri_with_placeholder(): void { $this->setTranslations([ 'nl' => [ @@ -108,8 +109,8 @@ public function you_can_translate_a_full_uri_with_placeholder() $this->assertEquals('producten/glazen/{type}', Lang::uri('products/glass/{type}', 'nl')); } - /** @test */ - public function you_can_specify_a_namespace() + #[Test] + public function you_can_specify_a_namespace(): void { $this->setTranslations([ 'nl' => [ @@ -120,8 +121,8 @@ public function you_can_specify_a_namespace() $this->assertEquals('artikels/{article}', Lang::uri('articles/{article}', 'nl', 'blog')); } - /** @test */ - public function the_uri_macro_is_available_via_the_trans_helper() + #[Test] + public function the_uri_macro_is_available_via_the_trans_helper(): void { $this->setTranslations([ 'nl' => [