summaryrefslogtreecommitdiff
path: root/tests/Unit
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-09-15 14:58:31 +0200
committerIgor Scheller <igor.scheller@igorshp.de>2018-09-15 14:58:31 +0200
commitd0abc27c079f058c40a74b89e54bd21ba4aad53e (patch)
tree2d42f2a3c99d4a01930832c4e257bd550cbe9ac5 /tests/Unit
parent13d2786b7b51df927c8976dc767cc27e88bc8e84 (diff)
parent5456fea5031000a6325cdcae5f1e9d4c16b6ed50 (diff)
Merge remote-tracking branch 'MyIgel/translations'
Diffstat (limited to 'tests/Unit')
-rw-r--r--tests/Unit/Middleware/LegacyMiddlewareTest.php25
1 files changed, 21 insertions, 4 deletions
diff --git a/tests/Unit/Middleware/LegacyMiddlewareTest.php b/tests/Unit/Middleware/LegacyMiddlewareTest.php
index ed9a5a74..09674a59 100644
--- a/tests/Unit/Middleware/LegacyMiddlewareTest.php
+++ b/tests/Unit/Middleware/LegacyMiddlewareTest.php
@@ -2,6 +2,7 @@
namespace Engelsystem\Test\Unit\Middleware;
+use Engelsystem\Helpers\Translator;
use Engelsystem\Http\Request;
use Engelsystem\Middleware\LegacyMiddleware;
use PHPUnit\Framework\TestCase;
@@ -37,6 +38,10 @@ class LegacyMiddlewareTest extends TestCase
$handler = $this->getMockForAbstractClass(RequestHandlerInterface::class);
/** @var ServerRequestInterface|MockObject $request */
$request = $this->getMockForAbstractClass(ServerRequestInterface::class);
+ /** @var Translator|MockObject $translator */
+ $translator = $this->getMockBuilder(Translator::class)
+ ->disableOriginalConstructor()
+ ->getMock();
$middleware->expects($this->exactly(2))
->method('loadPage')
@@ -50,15 +55,27 @@ class LegacyMiddlewareTest extends TestCase
->method('renderPage')
->withConsecutive(
['user_worklog', 'title', 'content'],
- ['404', 'Page not found'],
+ ['404', 'Page not found', 'It\'s not available!'],
['login', 'title2', 'content2']
)
->willReturn($response);
- $container->expects($this->atLeastOnce())
+ $container->expects($this->exactly(4))
->method('get')
- ->with('request')
- ->willReturn($defaultRequest);
+ ->withConsecutive(['request'], ['request'], ['translator'], ['request'])
+ ->willReturnOnConsecutiveCalls(
+ $defaultRequest,
+ $defaultRequest,
+ $translator,
+ $defaultRequest
+ );
+
+ $translator->expects($this->exactly(2))
+ ->method('translate')
+ ->willReturnOnConsecutiveCalls(
+ 'Page not found',
+ 'It\'s not available!'
+ );
$defaultRequest->query = $parameters;
$defaultRequest->expects($this->once())