Skip to content

Commit 8f23b6c

Browse files
authored
Merge pull request #1 from carandclassic/laravel-12
Laravel 12
2 parents 3c8c8bd + d598094 commit 8f23b6c

File tree

7 files changed

+83
-62
lines changed

7 files changed

+83
-62
lines changed

.github/workflows/run-tests.yml

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,26 @@ jobs:
88
strategy:
99
fail-fast: true
1010
matrix:
11-
php: [ 8.1, 8.2, 8.3 ]
12-
laravel: [ 10.* , 11.*]
11+
php: [ 8.3, 8.4 ]
12+
laravel: [ 11.*, 12.* ]
1313
dependency-version: [ prefer-stable ]
14-
exclude:
15-
- laravel: 11.*
16-
php: 8.1
14+
# exclude:
15+
# - laravel: 11.*
16+
# php: 8.1
1717
include:
18-
- laravel: 10.*
19-
testbench: 8.*
2018
- laravel: 11.*
2119
testbench: 9.*
20+
- laravel: 12.*
21+
testbench: 10.*
2222

2323
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
2424

2525
steps:
2626
- name: Checkout code
27-
uses: actions/checkout@v2
27+
uses: actions/checkout@v4
2828

2929
- name: Cache dependencies
30-
uses: actions/cache@v2
30+
uses: actions/cache@v4
3131
with:
3232
path: ~/.composer/cache/files
3333
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
@@ -44,10 +44,3 @@ jobs:
4444

4545
- name: Execute tests
4646
run: vendor/bin/phpunit --coverage-clover=coverage.xml
47-
48-
- if: github.event_name == 'push'
49-
name: Run Codacy Coverage Reporter
50-
uses: codacy/codacy-coverage-reporter-action@master
51-
with:
52-
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
53-
coverage-reports: coverage.xml

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ A convenient way to set up and use localized routes in a Laravel app.
5353

5454
## ✅ Requirements
5555

56-
- PHP >= 8.1
57-
- Laravel >= 10
56+
- PHP >= 8.3
57+
- Laravel >= 11
5858
- Composer ^2.3 (for [codezero/composer-preload-files](https://github.com/codezero-be/composer-preload-files))
5959

6060
## ⬆ Upgrade
@@ -756,7 +756,7 @@ composer test
756756

757757
## 🔒 Security
758758

759-
If you discover any security related issues, please [e-mail me](mailto:ivan@codezero.be) instead of using the issue tracker.
759+
If you discover any security-related issues, please [e-mail us](mailto:security@carandclassic.com) instead of using the issue tracker.
760760

761761
## 📑 Changelog
762762

UPGRADE.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Upgrade Guide
22

3-
## Upgrading To 4.0 From 3.x
3+
## Upgrading to 5.0 from 4.x
4+
5+
- The minimum PHP version required is now 8.3
6+
- The minimum Laravel version required is now 11
7+
8+
## Upgrading to 4.0 From 3.x
49

510
### ➡ Minimum Requirements Updated
611

@@ -20,7 +25,7 @@ This is now handled in `bootstrap/app.php`.
2025

2126
If you use Laravel 11, register the middleware in `bootstrap/app.php` as described in the README.
2227

23-
## Upgrading To 3.0 From 2.x
28+
## Upgrading to 3.0 From 2.x
2429

2530
This upgrade contains a number of small but breaking changes, as well as a huge internal makeover.
2631
I listed the most important ones below.

composer.json

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
2-
"name": "codezero/laravel-localized-routes",
2+
"name": "carandclassic/laravel-localized-routes",
33
"description": "A convenient way to set up, manage and use localized routes in a Laravel app.",
4+
"type": "library",
45
"keywords": [
56
"php",
67
"laravel",
@@ -20,20 +21,17 @@
2021
}
2122
],
2223
"require": {
23-
"php": "^8.1",
24+
"php": "^8.3",
25+
"carandclassic/laravel-uri-translator": "^3.0",
2426
"codezero/browser-locale": "^3.0",
2527
"codezero/composer-preload-files": "^1.0",
26-
"codezero/laravel-uri-translator": "^2.0",
2728
"codezero/php-url-builder": "^1.0",
28-
"illuminate/support": "^10.0|^11.0"
29+
"illuminate/support": "^11.0|^12.0.1"
2930
},
3031
"require-dev": {
3132
"mockery/mockery": "^1.3.3",
32-
"orchestra/testbench": "^8.0|^9.0",
33-
"phpunit/phpunit": "^10.5"
34-
},
35-
"scripts": {
36-
"test": "phpunit"
33+
"orchestra/testbench": "^8.0|^9.0|^10.0",
34+
"phpunit/phpunit": "^10.5|^11.0"
3735
},
3836
"autoload": {
3937
"psr-4": {
@@ -45,6 +43,25 @@
4543
"CodeZero\\LocalizedRoutes\\Tests\\": "tests"
4644
}
4745
},
46+
"minimum-stability": "dev",
47+
"prefer-stable": true,
48+
"repositories": [
49+
{
50+
"type": "github",
51+
"url": "https://github.com/carandclassic/laravel-uri-translator"
52+
}
53+
],
54+
"config": {
55+
"preferred-install": "dist",
56+
"sort-packages": true,
57+
"optimize-autoloader": true,
58+
"allow-plugins": {
59+
"codezero/composer-preload-files": true
60+
}
61+
},
62+
"scripts": {
63+
"test": "phpunit"
64+
},
4865
"extra": {
4966
"laravel": {
5067
"providers": [
@@ -57,15 +74,5 @@
5774
"preload-files": [
5875
"src/helpers.php"
5976
]
60-
},
61-
"config": {
62-
"preferred-install": "dist",
63-
"sort-packages": true,
64-
"optimize-autoloader": true,
65-
"allow-plugins": {
66-
"codezero/composer-preload-files": true
67-
}
68-
},
69-
"minimum-stability": "dev",
70-
"prefer-stable": true
77+
}
7178
}

phpunit.xml.dist

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
backupGlobals="false"
4-
bootstrap="vendor/autoload.php"
5-
colors="true"
6-
processIsolation="false"
7-
stopOnFailure="false"
8-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
9-
cacheDirectory=".phpunit.cache"
10-
backupStaticProperties="false">
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
5+
backupGlobals="false"
6+
bootstrap="vendor/autoload.php"
7+
cacheDirectory=".phpunit.cache"
8+
colors="true"
9+
>
1110
<testsuites>
1211
<testsuite name="Unit">
13-
<directory suffix="Test.php">./tests/Unit</directory>
12+
<directory>tests/Unit</directory>
1413
</testsuite>
1514
<testsuite name="Feature">
16-
<directory suffix="Test.php">./tests/Feature</directory>
15+
<directory>tests/Feature</directory>
1716
</testsuite>
1817
</testsuites>
1918
<php>
@@ -24,7 +23,7 @@
2423
</php>
2524
<source>
2625
<include>
27-
<directory suffix=".php">./src</directory>
26+
<directory>src</directory>
2827
</include>
2928
</source>
3029
</phpunit>

tests/Feature/Macros/Route/LocalizedMacroTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function it_registers_routes_in_the_correct_order_without_prefix_for_a_co
9696

9797
$this->assertEquals(
9898
['nl', 'nl/{slug}', '/', '{slug}'],
99-
$this->getRoutes()->pluck('uri')->toArray()
99+
$this->getRoutes()->where('uri', '!=', 'storage/{path}')->pluck('uri')->toArray()
100100
);
101101
}
102102

tests/TestCase.php

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
use CodeZero\BrowserLocale\BrowserLocale;
66
use CodeZero\LocalizedRoutes\LocalizedRoutesServiceProvider;
77
use CodeZero\UriTranslator\UriTranslatorServiceProvider;
8+
use Illuminate\Config\Repository;
9+
use Illuminate\Contracts\Container\BindingResolutionException;
10+
use Illuminate\Contracts\Foundation\Application;
811
use Illuminate\Contracts\View\View;
912
use Illuminate\Support\Collection;
1013
use Illuminate\Support\Facades\App;
@@ -17,27 +20,25 @@
1720
use Orchestra\Testbench\TestCase as BaseTestCase;
1821
use PHPUnit\Framework\Assert;
1922

20-
abstract class TestCase extends BaseTestCase
23+
abstract class TestCase extends BaseTestCase
2124
{
22-
protected $sessionKey;
23-
protected $cookieName;
25+
protected string $sessionKey;
26+
protected string $cookieName;
2427

2528
/**
26-
* Setup the test environment.
29+
* Set up the test environment.
2730
*
2831
* @return void
2932
*/
3033
protected function setUp(): void
3134
{
3235
parent::setUp();
3336

34-
Config::set('app.key', Str::random(32));
35-
3637
// Remove any default browser locales
3738
$this->setBrowserLocales(null);
3839

39-
$this->sessionKey = Config::get('localized-routes.session_key');
40-
$this->cookieName = Config::get('localized-routes.cookie_name');
40+
$this->sessionKey = Config::string('localized-routes.session_key');
41+
$this->cookieName = Config::string('localized-routes.cookie_name');
4142

4243
TestResponse::macro('assertResponseHasNoView', function () {
4344
if (isset($this->original) && $this->original instanceof View) {
@@ -48,6 +49,22 @@ protected function setUp(): void
4849
});
4950
}
5051

52+
/**
53+
* Define the environment setup for the application.
54+
*
55+
* @param Application $app
56+
*
57+
* @return void
58+
*/
59+
protected function defineEnvironment($app): void
60+
{
61+
$config = $app->make(Repository::class);
62+
$config->set([
63+
'app.key' => Str::random(32),
64+
'filesystems.disks.local.serve' => false,
65+
]);
66+
}
67+
5168
/**
5269
* Skip test if laravel version is lower than the given version.
5370
*

0 commit comments

Comments
 (0)