Skip to content

Commit 4439689

Browse files
update validator middleware test
1 parent 3a87e64 commit 4439689

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/unit/Core/Middleware/ValidationExceptionMiddlewareTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,25 @@
88
namespace SELN\App\Test\UnitTest\Core\Middleware;
99

1010
use Codeception\Test\Unit;
11+
use Laminas\Diactoros\ResponseFactory;
12+
use Laminas\Diactoros\ServerRequestFactory;
13+
use Psr\Http\Server\RequestHandlerInterface;
14+
use SELN\App\Core\HTTP\Middleware\ValidationExceptionMiddleware;
1115
use SELN\App\Test\UnitTest\Core\UnitTemplate;
1216

1317
class ValidationExceptionMiddlewareTest extends Unit implements UnitTemplate
1418
{
1519

1620
public function testSuccess(): void
1721
{
22+
$middleware = new ValidationExceptionMiddleware();
23+
$handler = $this->createStub(RequestHandlerInterface::class);
24+
$handler->method('handle')->willReturn($source = (new ResponseFactory())->createResponse());
1825

26+
$request = (new ServerRequestFactory())->createServerRequest('POST', 'http://localhost');
27+
$response = $middleware->process($request, $handler);
28+
29+
$this->assertEquals($source, $response);
1930
}
2031

2132
public function testException(): void

0 commit comments

Comments
 (0)