‪TYPO3CMS  9.5
RedisSessionBackendTest.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
20 
24 class ‪RedisSessionBackendTest extends UnitTestCase
25 {
26  protected function ‪setUp()
27  {
28  if (!class_exists(\Redis::class)) {
29  $this->markTestSkipped('Redis class needs to be available to test RedisSessionBackend');
30  }
31  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = '12345';
32  }
33 
38  {
39  $this->expectException(\InvalidArgumentException::class);
40  $this->expectExceptionCode(1481270871);
41  $subject = new ‪RedisSessionBackend();
42  $subject->initialize(
43  'default',
44  [
45  'database' => 'numberZero'
46  ]
47  );
48  $subject->validateConfiguration();
49  }
50 
55  {
56  $subject = new ‪RedisSessionBackend();
57  $subject->initialize(
58  'default',
59  [
60  'database' => -1
61  ]
62  );
63 
64  $this->expectException(\InvalidArgumentException::class);
65  $this->expectExceptionCode(1481270923);
66  $subject->validateConfiguration();
67  }
68 }
‪TYPO3\CMS\Core\Tests\Unit\Session\Backend\RedisSessionBackendTest
Definition: RedisSessionBackendTest.php:25
‪TYPO3\CMS\Core\Tests\Unit\Session\Backend
Definition: DatabaseSessionBackendTest.php:3
‪TYPO3\CMS\Core\Tests\Unit\Session\Backend\RedisSessionBackendTest\databaseConfigurationMustBeZeroOrGreater
‪databaseConfigurationMustBeZeroOrGreater()
Definition: RedisSessionBackendTest.php:54
‪TYPO3\CMS\Core\Tests\Unit\Session\Backend\RedisSessionBackendTest\setUp
‪setUp()
Definition: RedisSessionBackendTest.php:26
‪TYPO3\CMS\Core\Session\Backend\RedisSessionBackend
Definition: RedisSessionBackend.php:31
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Tests\Unit\Session\Backend\RedisSessionBackendTest\databaseConfigurationMustBeInteger
‪databaseConfigurationMustBeInteger()
Definition: RedisSessionBackendTest.php:37