Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 6 additions & 17 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/vendor
/phpunit.xml
composer.lock
/.phpunit.cache
/.phpunit.result.cache
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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

Expand Down
13 changes: 5 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
22 changes: 11 additions & 11 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false">
<testsuites>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
<php>
<env name="APP_ENV" value="testing"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_DRIVER" value="sync"/>
</php>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
39 changes: 20 additions & 19 deletions tests/Feature/UriTranslatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => [
Expand All @@ -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' => [
Expand All @@ -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' => [
Expand All @@ -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' => [
Expand All @@ -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' => [
Expand All @@ -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' => [
Expand All @@ -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' => [
Expand All @@ -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' => [
Expand All @@ -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' => [
Expand Down