aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/front/ShaarliMiddlewareTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/front/ShaarliMiddlewareTest.php')
-rw-r--r--tests/front/ShaarliMiddlewareTest.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/front/ShaarliMiddlewareTest.php b/tests/front/ShaarliMiddlewareTest.php
index 80974f37..57be1002 100644
--- a/tests/front/ShaarliMiddlewareTest.php
+++ b/tests/front/ShaarliMiddlewareTest.php
@@ -11,6 +11,7 @@ use Shaarli\Front\Exception\LoginBannedException;
11use Shaarli\Render\PageBuilder; 11use Shaarli\Render\PageBuilder;
12use Slim\Http\Request; 12use Slim\Http\Request;
13use Slim\Http\Response; 13use Slim\Http\Response;
14use Slim\Http\Uri;
14 15
15class ShaarliMiddlewareTest extends TestCase 16class ShaarliMiddlewareTest extends TestCase
16{ 17{
@@ -29,6 +30,13 @@ class ShaarliMiddlewareTest extends TestCase
29 public function testMiddlewareExecution(): void 30 public function testMiddlewareExecution(): void
30 { 31 {
31 $request = $this->createMock(Request::class); 32 $request = $this->createMock(Request::class);
33 $request->method('getUri')->willReturnCallback(function (): Uri {
34 $uri = $this->createMock(Uri::class);
35 $uri->method('getBasePath')->willReturn('/subfolder');
36
37 return $uri;
38 });
39
32 $response = new Response(); 40 $response = new Response();
33 $controller = function (Request $request, Response $response): Response { 41 $controller = function (Request $request, Response $response): Response {
34 return $response->withStatus(418); // I'm a tea pot 42 return $response->withStatus(418); // I'm a tea pot
@@ -44,6 +52,13 @@ class ShaarliMiddlewareTest extends TestCase
44 public function testMiddlewareExecutionWithException(): void 52 public function testMiddlewareExecutionWithException(): void
45 { 53 {
46 $request = $this->createMock(Request::class); 54 $request = $this->createMock(Request::class);
55 $request->method('getUri')->willReturnCallback(function (): Uri {
56 $uri = $this->createMock(Uri::class);
57 $uri->method('getBasePath')->willReturn('/subfolder');
58
59 return $uri;
60 });
61
47 $response = new Response(); 62 $response = new Response();
48 $controller = function (): void { 63 $controller = function (): void {
49 $exception = new LoginBannedException(); 64 $exception = new LoginBannedException();