protected function R4032LoginSubscriberTest::setUp in Redirect 403 to User Login 8
Same name and namespace in other branches
- 2.x tests/src/Unit/R4032LoginSubscriberTest.php \Drupal\Tests\r4032login\Unit\R4032LoginSubscriberTest::setUp()
Overrides UnitTestCase::setUp
File
- tests/
src/ Unit/ R4032LoginSubscriberTest.php, line 82
Class
- R4032LoginSubscriberTest
- @coversDefaultClass \Drupal\r4032login\EventSubscriber\R4032LoginSubscriber @group r4032login
Namespace
Drupal\Tests\r4032login\UnitCode
protected function setUp() {
$this->kernel = $this
->getMock('Symfony\\Component\\HttpKernel\\HttpKernelInterface');
$this->configFactory = $this
->getConfigFactoryStub([
'r4032login.settings' => [
'display_denied_message' => TRUE,
'access_denied_message' => 'Access denied. You must log in to view this page.',
'access_denied_message_type' => 'error',
'redirect_authenticated_users_to' => '',
'user_login_path' => '/user/login',
'default_redirect_code' => 302,
'match_noredirect_pages' => '',
],
]);
$this->currentUser = $this
->getMock('Drupal\\Core\\Session\\AccountInterface');
$this->requestStack = new RequestStack();
$this->requestStack
->push(new Request());
$this->pathMatcher = $this
->getMock('\\Drupal\\Core\\Path\\PathMatcherInterface');
$this->eventDispatcher = $this
->getMock('\\Symfony\\Component\\EventDispatcher\\EventDispatcherInterface');
$this->urlAssembler = $this
->getMock('Drupal\\Core\\Utility\\UnroutedUrlAssemblerInterface');
$this->urlAssembler
->expects($this
->any())
->method('assemble')
->will($this
->returnArgument(0));
$this->router = $this
->getMock('Drupal\\Tests\\Core\\Routing\\TestRouterInterface');
$container = new ContainerBuilder();
$container
->set('path.validator', $this
->getMock('Drupal\\Core\\Path\\PathValidatorInterface'));
$container
->set('router.no_access_checks', $this->router);
$container
->set('unrouted_url_assembler', $this->urlAssembler);
\Drupal::setContainer($container);
}