aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/front/controller/admin/FrontAdminControllerMockHelper.php
blob: bd40c0c7ccf67981a7e4513886f71fa99d5369b8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php

declare(strict_types=1);

namespace Shaarli\Front\Controller\Admin;

use Shaarli\Container\ShaarliTestContainer;
use Shaarli\Front\Controller\Visitor\FrontControllerMockHelper;

/**
 * Trait FrontControllerMockHelper
 *
 * Helper trait used to initialize the ShaarliContainer and mock its services for admin controller tests.
 *
 * @property ShaarliTestContainer $container
 */
trait FrontAdminControllerMockHelper
{
    use FrontControllerMockHelper {
        FrontControllerMockHelper::createContainer as parentCreateContainer;
    }

    /**
     * Mock the container instance
     */
    protected function createContainer(): void
    {
        $this->parentCreateContainer();

        $this->container->loginManager->method('isLoggedIn')->willReturn(true);
        $this->container->sessionManager->method('checkToken')->willReturn(true);
    }
}