MyShaarli/tests/front/controller/admin/FrontAdminControllerMockHelper.php
ArthurHoaro 2899ebb5b5 Initialize admin Slim controllers
- Reorganize visitor controllers
  - Fix redirection with Slim's requests base path
  - Fix daily links
2020-07-23 21:19:21 +02:00

34 lines
893 B
PHP

<?php
declare(strict_types=1);
namespace Shaarli\Front\Controller\Admin;
use Shaarli\Container\ShaarliTestContainer;
use Shaarli\Front\Controller\Visitor\FrontControllerMockHelper;
use Shaarli\Security\LoginManager;
/**
* 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 = $this->createMock(LoginManager::class);
$this->container->loginManager->method('isLoggedIn')->willReturn(true);
}
}