Skip to content

Commit 8f99e76

Browse files
Add support for Laravel 10 (#72)
1 parent d47230c commit 8f99e76

File tree

8 files changed

+14
-9
lines changed

8 files changed

+14
-9
lines changed

.github/workflows/run-tests.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ jobs:
99
fail-fast: true
1010
matrix:
1111
php: [ 8.0, 8.1 ]
12-
laravel: [ 8.*, 9.* ]
12+
laravel: [ 8.*, 9.* , 10.*]
1313
dependency-version: [ prefer-stable ]
14+
exclude:
15+
- laravel: 10.*
16+
php: 8.0
1417
include:
1518
- laravel: 5.6.*
1619
php: 7.1
@@ -40,6 +43,8 @@ jobs:
4043
testbench: 6.*
4144
- laravel: 9.*
4245
testbench: 7.*
46+
- laravel: 10.*
47+
testbench: 8.*
4348

4449
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
4550

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
"php": "^7.1|^8.0",
2424
"0.0.0/composer-include-files": "^1.5",
2525
"codezero/laravel-localizer": "^1.1",
26-
"illuminate/support": "^5.6|^6.0|^7.0|^8.0|^9.0"
26+
"illuminate/support": "^5.6|^6.0|^7.0|^8.0|^9.0|^10.0"
2727
},
2828
"require-dev": {
2929
"mockery/mockery": "^1.3.3",
30-
"orchestra/testbench": "^3.6|^4.0|^5.0|^6.0|^7.0",
30+
"orchestra/testbench": "^3.6|^4.0|^5.0|^6.0|^7.0|^8.0",
3131
"phpunit/phpunit": "^7.0|^8.0|^9.0"
3232
},
3333
"scripts": {

src/LocalizedUrlGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ protected function getLocalizedRouteKey($key, UrlRoutable $model, $locale)
431431
*/
432432
protected function getBindingFieldFor($key, UrlRoutable $model)
433433
{
434-
if (App::version() < 7) {
434+
if (version_compare(App::version(), '7.0.0') === -1) {
435435
return $model->getRouteKeyName();
436436
}
437437

tests/TestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ protected function setUp(): void
2323
{
2424
parent::setUp();
2525

26-
if ($this->app->version() < 7) {
26+
if (version_compare($this->app->version(), '7.0.0') === -1) {
2727
\Illuminate\Foundation\Testing\TestResponse::macro('assertResponseHasNoView', function () {
2828
if (isset($this->original) && $this->original instanceof View) {
2929
Illuminate\Foundation\Testing\Assert::fail('The response has a view.');

tests/Unit/HelpersFileTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function it_throws_when_route_helper_locale_is_unsupported(): void
3333
Route::get('route')->name('route');
3434
});
3535

36-
if ($this->app->version() < 6) {
36+
if (version_compare($this->app->version(), '6.0.0') === -1) {
3737
$this->expectExceptionMessage('Route [wk.route] not defined.');
3838
} else {
3939
$this->expectException(RouteNotFoundException::class);

tests/Unit/Macros/LocalizedUrlMacroTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function it_generates_urls_for_the_current_route_with_diferent_models_usi
9696
/** @test */
9797
public function it_generates_urls_with_custom_localized_route_keys_for_the_current_route_using_route_model_binding()
9898
{
99-
if (App::version() < 7) {
99+
if (version_compare($this->app->version(), '7.0.0') === -1) {
100100
$this->markTestSkipped('This feature is only available in Laravel 7 and newer.');
101101
}
102102

tests/Unit/RouteModelBindingTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function it_loads_a_route_with_a_localized_route_key_based_on_the_active_
4545
/** @test */
4646
public function it_loads_a_route_with_a_custom_localized_route_key_based_on_the_active_locale()
4747
{
48-
if (App::version() < 7) {
48+
if (version_compare($this->app->version(), '7.0.0') === -1) {
4949
$this->markTestSkipped('This feature is only available in Laravel 7 and newer.');
5050
}
5151

tests/Unit/UrlGeneratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public function it_generates_a_url_for_a_route_with_a_default_localized_route_ke
188188
/** @test */
189189
public function it_generates_a_url_for_a_route_with_a_custom_localized_route_key()
190190
{
191-
if (App::version() < 7) {
191+
if (version_compare($this->app->version(), '7.0.0') === -1) {
192192
$this->markTestSkipped('This feature is only available in Laravel 7 and newer.');
193193
}
194194

0 commit comments

Comments
 (0)