/**
  * @test
  */
 public function resumeSetsSessionCookieInTheResponse()
 {
     $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', $this->createCache('Meta'));
     $this->inject($session, 'storageCache', $this->createCache('Storage'));
     $session->initializeObject();
     $session->start();
     $sessionIdentifier = $session->getId();
     $session->close();
     $session->resume();
     $this->assertTrue($this->httpResponse->hasCookie('TYPO3_Flow_Session'));
     $this->assertEquals($sessionIdentifier, $this->httpResponse->getCookie('TYPO3_Flow_Session')->getValue());
 }
 /**
  * Explicitly destroys all session data
  *
  * @param string $reason A reason for destroying the session – used by the LoggingAspect
  * @return void
  * @throws Exception\SessionNotStartedException
  * @api
  */
 public function destroy($reason = null)
 {
     if ($this->started !== true) {
         throw new Exception\SessionNotStartedException('Tried to destroy a session which has not been started yet.', 1351162668);
     }
     if ($this->remote !== true) {
         if (!$this->response->hasCookie($this->sessionCookieName)) {
             $this->response->setCookie($this->sessionCookie);
         }
         $this->sessionCookie->expire();
     }
     $this->removeSessionMetaDataCacheEntry($this->sessionIdentifier);
     $this->storageCache->flushByTag($this->storageIdentifier);
     $this->started = false;
     $this->sessionIdentifier = null;
     $this->storageIdentifier = null;
     $this->tags = [];
     $this->request = null;
 }