diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-05-30 14:00:06 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-07-23 21:19:21 +0200 |
commit | 66063ed1a18d739b1a60bfb163d8656417a4c529 (patch) | |
tree | 5af628861a42af1a4bf84f6dcd18a24b80cc3a1c /tests/front/controller/admin/FrontAdminControllerMockHelper.php | |
parent | 465033230da0398426010aa7bd3694735b71c899 (diff) | |
download | Shaarli-66063ed1a18d739b1a60bfb163d8656417a4c529.tar.gz Shaarli-66063ed1a18d739b1a60bfb163d8656417a4c529.tar.zst Shaarli-66063ed1a18d739b1a60bfb163d8656417a4c529.zip |
Process configure page through Slim controller
Diffstat (limited to 'tests/front/controller/admin/FrontAdminControllerMockHelper.php')
-rw-r--r-- | tests/front/controller/admin/FrontAdminControllerMockHelper.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/front/controller/admin/FrontAdminControllerMockHelper.php b/tests/front/controller/admin/FrontAdminControllerMockHelper.php index bd40c0c7..2b9f2ef1 100644 --- a/tests/front/controller/admin/FrontAdminControllerMockHelper.php +++ b/tests/front/controller/admin/FrontAdminControllerMockHelper.php | |||
@@ -6,6 +6,7 @@ namespace Shaarli\Front\Controller\Admin; | |||
6 | 6 | ||
7 | use Shaarli\Container\ShaarliTestContainer; | 7 | use Shaarli\Container\ShaarliTestContainer; |
8 | use Shaarli\Front\Controller\Visitor\FrontControllerMockHelper; | 8 | use Shaarli\Front\Controller\Visitor\FrontControllerMockHelper; |
9 | use Shaarli\History; | ||
9 | 10 | ||
10 | /** | 11 | /** |
11 | * Trait FrontControllerMockHelper | 12 | * Trait FrontControllerMockHelper |
@@ -27,7 +28,29 @@ trait FrontAdminControllerMockHelper | |||
27 | { | 28 | { |
28 | $this->parentCreateContainer(); | 29 | $this->parentCreateContainer(); |
29 | 30 | ||
31 | $this->container->history = $this->createMock(History::class); | ||
32 | |||
30 | $this->container->loginManager->method('isLoggedIn')->willReturn(true); | 33 | $this->container->loginManager->method('isLoggedIn')->willReturn(true); |
31 | $this->container->sessionManager->method('checkToken')->willReturn(true); | 34 | $this->container->sessionManager->method('checkToken')->willReturn(true); |
32 | } | 35 | } |
36 | |||
37 | |||
38 | /** | ||
39 | * Pass a reference of an array which will be populated by `sessionManager->setSessionParameter` | ||
40 | * calls during execution. | ||
41 | * | ||
42 | * @param mixed $variables Array reference to populate. | ||
43 | */ | ||
44 | protected function assignSessionVars(array &$variables): void | ||
45 | { | ||
46 | $this->container->sessionManager | ||
47 | ->expects(static::atLeastOnce()) | ||
48 | ->method('setSessionParameter') | ||
49 | ->willReturnCallback(function ($key, $value) use (&$variables) { | ||
50 | $variables[$key] = $value; | ||
51 | |||
52 | return $this->container->sessionManager; | ||
53 | }) | ||
54 | ; | ||
55 | } | ||
33 | } | 56 | } |