Neos\Flow\Tests\Unit\Session\SessionTest::autoExpireRemovesAllSessionDataOfTheExpiredSession PHP Method

autoExpireRemovesAllSessionDataOfTheExpiredSession() public method

    public function autoExpireRemovesAllSessionDataOfTheExpiredSession()
    {
        /** @var Session $session */
        $session = $this->getAccessibleMock(Session::class, ['dummy']);
        $this->inject($session, 'bootstrap', $this->mockBootstrap);
        $this->inject($session, 'objectManager', $this->mockObjectManager);
        $this->inject($session, 'settings', $this->settings);
        $metaDataCache = $this->createCache('Meta');
        $storageCache = $this->createCache('Storage');
        $this->inject($session, 'metaDataCache', $metaDataCache);
        $this->inject($session, 'storageCache', $storageCache);
        $session->initializeObject();
        $session->start();
        $sessionIdentifier = $session->getId();
        $storageIdentifier = $session->_get('storageIdentifier');
        $session->putData('session 1 key 1', 'some value');
        $session->putData('session 1 key 2', 'some other value');
        $this->assertTrue($storageCache->has($storageIdentifier . md5('session 1 key 1')));
        $this->assertTrue($storageCache->has($storageIdentifier . md5('session 1 key 2')));
        $session->close();
        $sessionInfo = $metaDataCache->get($sessionIdentifier);
        $sessionInfo['lastActivityTimestamp'] = time() - 4000;
        $metaDataCache->set($sessionIdentifier, $sessionInfo, [$storageIdentifier, 'session'], 0);
        // canBeResumed implicitly calls autoExpire():
        $this->assertFalse($session->canBeResumed(), 'canBeResumed');
        $this->assertFalse($storageCache->has($storageIdentifier . md5('session 1 key 1')));
        $this->assertFalse($storageCache->has($storageIdentifier . md5('session 1 key 2')));
    }
SessionTest