Skip to content

Commit

Permalink
Allow Laravel 10 (#11)
Browse files Browse the repository at this point in the history
* Allow Laravel 10

* Exclude PHP 8.0 with Laravel 10

* Add additional version of testbench

* Avoid DB::raw because of Laravel 10 changes and keep the expression compatible with older versions
  • Loading branch information
jclarkkoala authored Apr 25, 2023
1 parent 460d7fe commit 271eec7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ jobs:
strategy:
fail-fast: false
matrix:
laravel-version: ['^8.0', '^9.0']
php-version: ['7.4', '8.0', '8.1']
laravel-version: ['^8.0', '^9.0', '^10.0']
php-version: ['7.4', '8.0', '8.1', '8.2']
exclude:
- laravel-version: '^8.0'
php-version: '8.2'
- laravel-version: '^9.0'
php-version: '7.4'
- laravel-version: '^10.0'
php-version: '7.4'
- laravel-version: '^10.0'
php-version: '8.0'
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"homepage": "https://koala.io/",
"require": {
"php": "^7.4|^8.0",
"illuminate/database": "^8|^9"
"illuminate/database": "^8|^9|^10"
},
"require-dev": {
"phpunit/phpunit": "^9",
"orchestra/testbench": "^6|^7",
"orchestra/testbench": "^6|^7|^8",
"mockery/mockery": "^1",
"friendsofphp/php-cs-fixer": "3.4.*"
},
Expand Down
6 changes: 4 additions & 2 deletions tests/EloquentRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,8 @@ public function testItModifiesQueries()
$this->assertEquals($repository->count(), 1);
$repository->modify()->set([
function (Builder $query) {
$query->whereRaw(DB::raw('0 = 1'));
//Force the query to return no results
$query->where('id', 'a-value-that-will-not-be-found');
}
]);
$this->assertEquals($repository->count(), 0);
Expand All @@ -476,7 +477,8 @@ public function testItAddsModifier()
$repository->save();
$this->assertEquals($repository->count(), 1);
$repository->modify()->add(function (Builder $query) {
$query->whereRaw(DB::raw('0 = 1'));
//Force the query to return no results
$query->where('id', 'a-value-that-will-not-be-found');
});

$this->assertSame(1, count($repository->modify()->getModifiers()));
Expand Down

0 comments on commit 271eec7

Please sign in to comment.