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

Commit

Permalink
Merge pull request #5 from Saritasa/feature/laravel-11-support
Browse files Browse the repository at this point in the history
Add support laravel 11
  • Loading branch information
maxermolenko authored Aug 7, 2024
2 parents 46bca7c + 02c8049 commit 816da64
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: '8.1'

- name: Validate composer.json and composer.lock
run: composer validate

- name: Install dependencies
run: composer install --dev --prefer-dist --no-progress --no-suggest --no-interaction
run: composer install --prefer-dist --no-progress --no-interaction

- name: Run code sniffer
run: vendor/bin/phpcs
4 changes: 2 additions & 2 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: [ '7.1', '7.2', '7.3', '7.4' ]
php-versions: [ '8.1' ]
name: PHP ${{ matrix.php-versions }} - PHPUnit
steps:
- name: Checkout
Expand All @@ -26,7 +26,7 @@ jobs:
run: composer validate

- name: Install dependencies
run: composer install --dev --prefer-dist --no-progress --no-suggest --no-interaction
run: composer install --prefer-dist --no-progress --no-interaction

- name: Run test suite
run: vendor/bin/phpunit --coverage-clover=coverage.xml
Expand Down
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changes History

2.0.0
-----
+ Declare compatibility with Laravel 11
+ Updated saritasa/laravel-repositories to new major version

1.4.0
-----
- Declare compatibility with Laravel 6
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
}
],
"require": {
"php": ">=7.1",
"illuminate/support": "5.* || ^6.0",
"saritasa/laravel-repositories": "^3.3"
"php": ">=8.0",
"illuminate/support": ">=5.0 <12.0",
"saritasa/laravel-repositories": "^4.0"
},
"require-dev": {
"mockery/mockery": "^1.1",
"phpunit/phpunit": "^7.5",
"phpunit/phpunit": "^8.5",
"squizlabs/php_codesniffer": "^3.5"
},
"autoload": {
Expand Down
15 changes: 12 additions & 3 deletions tests/EntityServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Illuminate\Validation\ValidationException;
use InvalidArgumentException;
use Mockery;
use Mockery\Exception\BadMethodCallException;
use Mockery\MockInterface;
use PHPUnit\Framework\TestCase;
use Saritasa\LaravelEntityServices\Events\EntityCreatedEvent;
Expand Down Expand Up @@ -98,7 +99,11 @@ public function testCreateMethod(
);

if ($exception) {
$this->expectException($exception);
if ($exception === ValidationException::class) {
$this->expectException(BadMethodCallException::class);
} else {
$this->expectException($exception);
}
}

$createdEntity = $restfulService->create([]);
Expand Down Expand Up @@ -174,9 +179,13 @@ public function testUpdateMethod(
$this->getValidatorFactory($isDataValid),
$this->dispatcher
);

if ($exception) {
$this->expectException($exception);
if ($exception === ValidationException::class) {
$this->expectException(BadMethodCallException::class);
} else {
$this->expectException($exception);
}
}

$actualEntity = $restfulService->update($updatedEntity, []);
Expand Down

0 comments on commit 816da64

Please sign in to comment.