mirror of
https://github.com/shlinkio/shlink.git
synced 2025-03-14 04:00:57 +03:00
Migrated BackwardsCompatibleProblemDetailsHandlerTest to use PHPUnit mocks
This commit is contained in:
parent
dfc8e8d74e
commit
db85915c2f
1 changed files with 3 additions and 7 deletions
|
@ -6,7 +6,6 @@ namespace ShlinkioTest\Shlink\Rest\Middleware\ErrorHandler;
|
|||
|
||||
use Laminas\Diactoros\ServerRequestFactory;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Prophecy\PhpUnit\ProphecyTrait;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Server\RequestHandlerInterface;
|
||||
use Shlinkio\Shlink\Core\Exception\ValidationException;
|
||||
|
@ -16,8 +15,6 @@ use Throwable;
|
|||
|
||||
class BackwardsCompatibleProblemDetailsHandlerTest extends TestCase
|
||||
{
|
||||
use ProphecyTrait;
|
||||
|
||||
private BackwardsCompatibleProblemDetailsHandler $handler;
|
||||
|
||||
protected function setUp(): void
|
||||
|
@ -34,13 +31,12 @@ class BackwardsCompatibleProblemDetailsHandlerTest extends TestCase
|
|||
Throwable $thrownException,
|
||||
string $expectedException,
|
||||
): void {
|
||||
$handler = $this->prophesize(RequestHandlerInterface::class);
|
||||
$handle = $handler->handle($request)->willThrow($thrownException);
|
||||
$handler = $this->createMock(RequestHandlerInterface::class);
|
||||
$handler->expects($this->once())->method('handle')->with($request)->willThrowException($thrownException);
|
||||
|
||||
$this->expectException($expectedException);
|
||||
$handle->shouldBeCalledOnce();
|
||||
|
||||
$this->handler->process($request, $handler->reveal());
|
||||
$this->handler->process($request, $handler);
|
||||
}
|
||||
|
||||
public function provideExceptions(): iterable
|
||||
|
|
Loading…
Add table
Reference in a new issue