mirror of
https://github.com/shlinkio/shlink.git
synced 2024-12-25 08:21:11 -06:00
Ensured CloseDbConnectionMiddleware clears the entity manager
This commit is contained in:
parent
0c26490e3f
commit
f0330e9ae3
@ -27,6 +27,7 @@ class CloseDbConnectionMiddleware implements MiddlewareInterface
|
||||
{
|
||||
$handledRequest = $handler->handle($request);
|
||||
$this->em->getConnection()->close();
|
||||
$this->em->clear();
|
||||
|
||||
return $handledRequest;
|
||||
}
|
||||
|
@ -41,6 +41,8 @@ class CloseDbConnectionMiddlewareTest extends TestCase
|
||||
$closeConn = $conn->close()->will(function () {
|
||||
});
|
||||
$getConn = $this->em->getConnection()->willReturn($conn->reveal());
|
||||
$clear = $this->em->clear()->will(function () {
|
||||
});
|
||||
$handle = $this->handler->handle($req)->willReturn($resp);
|
||||
|
||||
$result = $this->middleware->process($req, $this->handler->reveal());
|
||||
@ -48,6 +50,7 @@ class CloseDbConnectionMiddlewareTest extends TestCase
|
||||
$this->assertSame($result, $resp);
|
||||
$getConn->shouldHaveBeenCalledOnce();
|
||||
$closeConn->shouldHaveBeenCalledOnce();
|
||||
$clear->shouldHaveBeenCalledOnce();
|
||||
$handle->shouldHaveBeenCalledOnce();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user