2 declare(strict_types = 1);
19 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
32 'randomSessionId1' => [
34 'ses_id' =>
'e1ad65e4bad3c29e12c754c8e9f5927e',
37 'randomSessionId2' => [
39 'ses_id' =>
'72b1cf1fccc010ddb760c6db03f668db',
42 'randomSessionId3' => [
44 'ses_id' =>
'7ee0836849b95d884108486c4a8973f3',
52 protected function setUp()
55 $GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'encryptionKey'] =
'12345';
58 $frontendSessionBackend = $this->subject->getSessionBackend(
'FE');
59 foreach ($this->testSessionRecords as $sessionId => $testSessionRecord) {
60 $frontendSessionBackend->set($sessionId, $testSessionRecord);
62 $backendSessionBackend = $this->subject->getSessionBackend(
'BE');
63 foreach ($this->testSessionRecords as $sessionId => $testSessionRecord) {
64 $backendSessionBackend->set($sessionId, $testSessionRecord);
73 $backendSessionBackend = $this->subject->getSessionBackend(
'BE');
74 $allActiveSessions = $backendSessionBackend->getAll();
75 $this->assertCount(3, $allActiveSessions);
76 $this->subject->invalidateAllSessionsByUserId($backendSessionBackend, 1);
77 $allActiveSessions = $backendSessionBackend->getAll();
78 $this->assertCount(1, $allActiveSessions);
79 $this->assertSame($this->testSessionRecords[
'randomSessionId3'][
'ses_id'], $allActiveSessions[0][
'ses_id']);
80 $this->assertSame(2, (
int)$allActiveSessions[0][
'ses_userid']);
88 $frontendSessionBackend = $this->subject->getSessionBackend(
'FE');
89 $allActiveSessions = $frontendSessionBackend->getAll();
90 $this->assertCount(3, $allActiveSessions);
91 $this->subject->invalidateAllSessionsByUserId($frontendSessionBackend, 1);
92 $allActiveSessions = $frontendSessionBackend->getAll();
93 $this->assertCount(1, $allActiveSessions);
94 $this->assertSame($this->testSessionRecords[
'randomSessionId3'][
'ses_id'], $allActiveSessions[0][
'ses_id']);
95 $this->assertSame(2, (
int)$allActiveSessions[0][
'ses_userid']);