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

Commit 02c8049

Browse files
committed
Fix test
1 parent fb8ca75 commit 02c8049

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

tests/EntityServiceTest.php

+12-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Illuminate\Validation\ValidationException;
1111
use InvalidArgumentException;
1212
use Mockery;
13+
use Mockery\Exception\BadMethodCallException;
1314
use Mockery\MockInterface;
1415
use PHPUnit\Framework\TestCase;
1516
use Saritasa\LaravelEntityServices\Events\EntityCreatedEvent;
@@ -98,7 +99,11 @@ public function testCreateMethod(
9899
);
99100

100101
if ($exception) {
101-
$this->expectException($exception);
102+
if ($exception === ValidationException::class) {
103+
$this->expectException(BadMethodCallException::class);
104+
} else {
105+
$this->expectException($exception);
106+
}
102107
}
103108

104109
$createdEntity = $restfulService->create([]);
@@ -174,9 +179,13 @@ public function testUpdateMethod(
174179
$this->getValidatorFactory($isDataValid),
175180
$this->dispatcher
176181
);
177-
182+
178183
if ($exception) {
179-
$this->expectException($exception);
184+
if ($exception === ValidationException::class) {
185+
$this->expectException(BadMethodCallException::class);
186+
} else {
187+
$this->expectException($exception);
188+
}
180189
}
181190

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

0 commit comments

Comments
 (0)