diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-08-13 11:08:13 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-08-13 11:08:13 +0200 |
commit | bedbb845eec20363b928b424143787dbe988eefe (patch) | |
tree | 6b835ca247e39157b333323a539dde3c410c08f5 /tests/front/controller/admin/ShaarliAdminControllerTest.php | |
parent | 1a68ae5a29bc33ab80c9cfbe043cb1213551533c (diff) | |
download | Shaarli-bedbb845eec20363b928b424143787dbe988eefe.tar.gz Shaarli-bedbb845eec20363b928b424143787dbe988eefe.tar.zst Shaarli-bedbb845eec20363b928b424143787dbe988eefe.zip |
Move all admin controller into a dedicated group
Also handle authentication check in a new middleware for the admin group.
Diffstat (limited to 'tests/front/controller/admin/ShaarliAdminControllerTest.php')
-rw-r--r-- | tests/front/controller/admin/ShaarliAdminControllerTest.php | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/tests/front/controller/admin/ShaarliAdminControllerTest.php b/tests/front/controller/admin/ShaarliAdminControllerTest.php index 7c5f50a6..fff427cb 100644 --- a/tests/front/controller/admin/ShaarliAdminControllerTest.php +++ b/tests/front/controller/admin/ShaarliAdminControllerTest.php | |||
@@ -5,9 +5,7 @@ declare(strict_types=1); | |||
5 | namespace Shaarli\Front\Controller\Admin; | 5 | namespace Shaarli\Front\Controller\Admin; |
6 | 6 | ||
7 | use PHPUnit\Framework\TestCase; | 7 | use PHPUnit\Framework\TestCase; |
8 | use Shaarli\Front\Exception\UnauthorizedException; | ||
9 | use Shaarli\Front\Exception\WrongTokenException; | 8 | use Shaarli\Front\Exception\WrongTokenException; |
10 | use Shaarli\Security\LoginManager; | ||
11 | use Shaarli\Security\SessionManager; | 9 | use Shaarli\Security\SessionManager; |
12 | use Slim\Http\Request; | 10 | use Slim\Http\Request; |
13 | 11 | ||
@@ -53,19 +51,6 @@ class ShaarliAdminControllerTest extends TestCase | |||
53 | } | 51 | } |
54 | 52 | ||
55 | /** | 53 | /** |
56 | * Creating an instance of an admin controller while logged out should raise an exception. | ||
57 | */ | ||
58 | public function testInstantiateWhileLoggedOut(): void | ||
59 | { | ||
60 | $this->expectException(UnauthorizedException::class); | ||
61 | |||
62 | $this->container->loginManager = $this->createMock(LoginManager::class); | ||
63 | $this->container->loginManager->method('isLoggedIn')->willReturn(false); | ||
64 | |||
65 | $this->controller = new class($this->container) extends ShaarliAdminController {}; | ||
66 | } | ||
67 | |||
68 | /** | ||
69 | * Trigger controller's checkToken with a valid token. | 54 | * Trigger controller's checkToken with a valid token. |
70 | */ | 55 | */ |
71 | public function testCheckTokenWithValidToken(): void | 56 | public function testCheckTokenWithValidToken(): void |