From 9198e963859be737ea2eb8e2b8a86bfa3a931048 Mon Sep 17 00:00:00 2001 From: kirkbushell Date: Mon, 28 Sep 2015 16:02:37 +0100 Subject: [PATCH] Added tests for admin login/cookie checks --- .../Admin/Middleware/LoginWithCookieAndCheckAdminTest.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/framework/core/tests/Flarum/Admin/Middleware/LoginWithCookieAndCheckAdminTest.php b/framework/core/tests/Flarum/Admin/Middleware/LoginWithCookieAndCheckAdminTest.php index accfea1d9..84868b77d 100644 --- a/framework/core/tests/Flarum/Admin/Middleware/LoginWithCookieAndCheckAdminTest.php +++ b/framework/core/tests/Flarum/Admin/Middleware/LoginWithCookieAndCheckAdminTest.php @@ -3,6 +3,7 @@ namespace tests\Flarum\Admin\Middleware; use Flarum\Admin\Middleware\LoginWithCookieAndCheckAdmin; use Flarum\Core\Exceptions\PermissionDeniedException; +use Illuminate\Contracts\Container\Container; use Mockery as m; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; @@ -14,10 +15,13 @@ class LoginWithCookieAndCheckAdminTest extends TestCase { $this->setExpectedException(PermissionDeniedException::class); + $container = m::mock(Container::class); $request = m::mock(ServerRequestInterface::class); $response = m::mock(ResponseInterface::class); - $middleware = new LoginWithCookieAndCheckAdmin; + $request->shouldReceive('getCookieParams')->andReturn([]); + + $middleware = new LoginWithCookieAndCheckAdmin($container); $middleware->__invoke($request, $response); } }