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

sessionOnlyReusesTheSessionIdFromIncomingCookies() public method

This test asserts that the session cookie sent in the response doesn't just copy the data from the received session cookie (that is, domain, httponly etc) but creates a fresh Cookie object using the parameters derived from the settings.
    public function sessionOnlyReusesTheSessionIdFromIncomingCookies()
    {
        $metaDataCache = $this->createCache('Meta');
        $storageCache = $this->createCache('Storage');
        $session = new Session();
        $this->inject($session, 'bootstrap', $this->mockBootstrap);
        $this->inject($session, 'objectManager', $this->mockObjectManager);
        $this->inject($session, 'settings', $this->settings);
        $this->inject($session, 'metaDataCache', $metaDataCache);
        $this->inject($session, 'storageCache', $storageCache);
        $session->initializeObject();
        $session->start();
        $session->putData('foo', 'bar');
        $sessionIdentifier = $session->getId();
        $session->close();
        $requestCookie = new Http\Cookie($this->settings['session']['name'], $sessionIdentifier, 0, 100, 'other', '/');
        $this->httpRequest->setCookie($requestCookie);
        $session = new Session();
        $this->inject($session, 'bootstrap', $this->mockBootstrap);
        $this->inject($session, 'objectManager', $this->mockObjectManager);
        $this->inject($session, 'settings', $this->settings);
        $this->inject($session, 'metaDataCache', $metaDataCache);
        $this->inject($session, 'storageCache', $storageCache);
        $session->initializeObject();
        $session->resume();
        $responseCookie = $this->httpResponse->getCookie($this->settings['session']['name']);
        $this->assertNotEquals($requestCookie, $responseCookie);
        $this->assertEquals($requestCookie->getValue(), $responseCookie->getValue());
    }
SessionTest