Skip to content
This repository was archived by the owner on Jan 2, 2024. It is now read-only.

Commit d4bf426

Browse files
Laravel 10.x Compatibility (#98)
Co-authored-by: Pascal Baljet <[email protected]>
1 parent dbf3acb commit d4bf426

File tree

6 files changed

+24
-17
lines changed

6 files changed

+24
-17
lines changed

.github/workflows/run-tests.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ jobs:
88
strategy:
99
fail-fast: true
1010
matrix:
11-
php: [8.2, 8.1, 8.0]
12-
laravel: [9.*]
11+
php: [8.2, 8.1]
12+
laravel: [10.*, 9.*]
1313
framework: [tailwind, tailwind-2, tailwind-forms-simple, bootstrap-4, bootstrap-5]
1414
dependency-version: [prefer-lowest, prefer-stable]
1515
include:
16+
- laravel: 10.*
17+
testbench: 8.*
1618
- laravel: 9.*
1719
testbench: 7.*
1820

composer.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@
2929
}
3030
],
3131
"require": {
32-
"php": "^8.0 || ^8.1 || ^8.2",
33-
"illuminate/support": "^9.0",
32+
"php": "^8.1 || ^8.2",
33+
"illuminate/support": "^9.0 || ^10.0",
3434
"symfony/http-foundation": "^6.0"
3535
},
3636
"require-dev": {
37-
"livewire/livewire": "^2.0",
38-
"mockery/mockery": "^1.3.3",
39-
"nesbot/carbon": "^2.63",
40-
"orchestra/testbench-browser-kit": "^7.0",
37+
"livewire/livewire": "^2.12",
38+
"mockery/mockery": "^1.4.4",
39+
"nesbot/carbon": "^2.66",
40+
"orchestra/testbench-browser-kit": "^7.0 || ^8.0",
4141
"phpunit/phpunit": "^9.5",
42-
"spatie/laravel-translatable": "^5.0",
42+
"spatie/laravel-translatable": "^6.0",
4343
"symfony/dom-crawler": "^6.0"
4444
},
4545
"autoload": {
@@ -68,4 +68,4 @@
6868
]
6969
}
7070
}
71-
}
71+
}

tests/Feature/LivewireTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ public function it_can_validate_the_fields()
9898
->assertSeeHtml('The textarea field is required')
9999
->assertSeeHtml('The select field is required')
100100
->assertSeeHtml('The multi select field is required')
101-
->assertSeeHtml('The checkbox must be accepted')
102-
->assertSeeHtml('The radio must be accepted');
101+
->assertSeeHtml(TestCase::isLaravel10() ? 'The checkbox field must be accepted' : 'The checkbox must be accepted')
102+
->assertSeeHtml(TestCase::isLaravel10() ? 'The radio field must be accepted' : 'The radio must be accepted');
103103
}
104104

105105
/** @test */
@@ -125,8 +125,8 @@ public function it_can_add_a_modifier_to_the_wire_directive()
125125
->assertSeeHtml('The textarea field is required')
126126
->assertSeeHtml('The select field is required')
127127
->assertSeeHtml('The multi select field is required')
128-
->assertSeeHtml('The checkbox must be accepted')
129-
->assertSeeHtml('The radio must be accepted');
128+
->assertSeeHtml(TestCase::isLaravel10() ? 'The checkbox field must be accepted' : 'The checkbox must be accepted')
129+
->assertSeeHtml(TestCase::isLaravel10() ? 'The radio field must be accepted' : 'The radio must be accepted');
130130
}
131131

132132
/** @test */

tests/Feature/MultipleSelectTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ public function it_posts_all_selected_options()
2222
->press('Submit')
2323
->seeElement('option[value="be"]:selected')
2424
->seeElement('option[value="nl"]:selected')
25-
->seeText('The select must be a string.');
25+
->seeText(static::isLaravel10() ? 'The select field must be a string.' : 'The select must be a string.');
2626
}
2727
}

tests/Feature/TranslationTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function it_shows_the_validation_errors_and_old_values_correctly()
5252
->press('Submit')
5353
->seeElement('input[name="input[nl]"][value="hoi"]')
5454
->seeElement('input[name="input[en]"][value="hey"]')
55-
->seeText('The input.nl must be at least 5 characters')
56-
->seeText('The input.en must be at least 5 characters');
55+
->seeText(static::isLaravel10() ? 'The input.nl field must be at least 5 characters' : 'The input.nl must be at least 5 characters')
56+
->seeText(static::isLaravel10() ? 'The input.en field must be at least 5 characters' : 'The input.en must be at least 5 characters');
5757
}
5858
}

tests/TestCase.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ abstract class TestCase extends BaseTestCase
1212
{
1313
protected $baseUrl = 'http://localhost';
1414

15+
public static function isLaravel10(): bool
16+
{
17+
return version_compare(app()->version(), '10.0', '>=');
18+
}
19+
1520
public function setUp(): void
1621
{
1722
parent::setUp();

0 commit comments

Comments
 (0)