+ /**
+ * @requires function \Symfony\Component\HttpFoundation\Session\Session::isEmpty
+ */
+ public function testEmptySessionDoesNotSendCookie()
+ {
+ $this->sessionHasBeenStarted();
+ $this->sessionIsEmpty();
+
+ $response = $this->filterResponse(new Request(), HttpKernelInterface::MASTER_REQUEST);
+
+ $this->assertSame(array(), $response->headers->getCookies());
+ }
+
+ public function testEmptySessionWithNewSessionIdDoesSendCookie()
+ {
+ $this->sessionHasBeenStarted();
+ $this->sessionIsEmpty();
+ $this->fixSessionId('456');
+
+ $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
+ $request = Request::create('/', 'GET', array(), array('MOCKSESSID' => '123'));
+ $event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST);
+ $this->listener->onKernelRequest($event);
+
+ $response = $this->filterResponse(new Request(), HttpKernelInterface::MASTER_REQUEST);
+
+ $this->assertNotEmpty($response->headers->getCookies());
+ }
+