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

Commit

Permalink
Laravel 10.x Compatibility (#98)
Browse files Browse the repository at this point in the history
Co-authored-by: Pascal Baljet <[email protected]>
  • Loading branch information
laravel-shift and pascalbaljet authored Feb 21, 2023
1 parent dbf3acb commit d4bf426
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 17 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [8.2, 8.1, 8.0]
laravel: [9.*]
php: [8.2, 8.1]
laravel: [10.*, 9.*]
framework: [tailwind, tailwind-2, tailwind-forms-simple, bootstrap-4, bootstrap-5]
dependency-version: [prefer-lowest, prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
- laravel: 9.*
testbench: 7.*

Expand Down
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@
}
],
"require": {
"php": "^8.0 || ^8.1 || ^8.2",
"illuminate/support": "^9.0",
"php": "^8.1 || ^8.2",
"illuminate/support": "^9.0 || ^10.0",
"symfony/http-foundation": "^6.0"
},
"require-dev": {
"livewire/livewire": "^2.0",
"mockery/mockery": "^1.3.3",
"nesbot/carbon": "^2.63",
"orchestra/testbench-browser-kit": "^7.0",
"livewire/livewire": "^2.12",
"mockery/mockery": "^1.4.4",
"nesbot/carbon": "^2.66",
"orchestra/testbench-browser-kit": "^7.0 || ^8.0",
"phpunit/phpunit": "^9.5",
"spatie/laravel-translatable": "^5.0",
"spatie/laravel-translatable": "^6.0",
"symfony/dom-crawler": "^6.0"
},
"autoload": {
Expand Down Expand Up @@ -68,4 +68,4 @@
]
}
}
}
}
8 changes: 4 additions & 4 deletions tests/Feature/LivewireTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ public function it_can_validate_the_fields()
->assertSeeHtml('The textarea field is required')
->assertSeeHtml('The select field is required')
->assertSeeHtml('The multi select field is required')
->assertSeeHtml('The checkbox must be accepted')
->assertSeeHtml('The radio must be accepted');
->assertSeeHtml(TestCase::isLaravel10() ? 'The checkbox field must be accepted' : 'The checkbox must be accepted')
->assertSeeHtml(TestCase::isLaravel10() ? 'The radio field must be accepted' : 'The radio must be accepted');
}

/** @test */
Expand All @@ -125,8 +125,8 @@ public function it_can_add_a_modifier_to_the_wire_directive()
->assertSeeHtml('The textarea field is required')
->assertSeeHtml('The select field is required')
->assertSeeHtml('The multi select field is required')
->assertSeeHtml('The checkbox must be accepted')
->assertSeeHtml('The radio must be accepted');
->assertSeeHtml(TestCase::isLaravel10() ? 'The checkbox field must be accepted' : 'The checkbox must be accepted')
->assertSeeHtml(TestCase::isLaravel10() ? 'The radio field must be accepted' : 'The radio must be accepted');
}

/** @test */
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/MultipleSelectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ public function it_posts_all_selected_options()
->press('Submit')
->seeElement('option[value="be"]:selected')
->seeElement('option[value="nl"]:selected')
->seeText('The select must be a string.');
->seeText(static::isLaravel10() ? 'The select field must be a string.' : 'The select must be a string.');
}
}
4 changes: 2 additions & 2 deletions tests/Feature/TranslationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function it_shows_the_validation_errors_and_old_values_correctly()
->press('Submit')
->seeElement('input[name="input[nl]"][value="hoi"]')
->seeElement('input[name="input[en]"][value="hey"]')
->seeText('The input.nl must be at least 5 characters')
->seeText('The input.en must be at least 5 characters');
->seeText(static::isLaravel10() ? 'The input.nl field must be at least 5 characters' : 'The input.nl must be at least 5 characters')
->seeText(static::isLaravel10() ? 'The input.en field must be at least 5 characters' : 'The input.en must be at least 5 characters');
}
}
5 changes: 5 additions & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ abstract class TestCase extends BaseTestCase
{
protected $baseUrl = 'http://localhost';

public static function isLaravel10(): bool
{
return version_compare(app()->version(), '10.0', '>=');
}

public function setUp(): void
{
parent::setUp();
Expand Down

0 comments on commit d4bf426

Please sign in to comment.