Exemplo n.º 1
0
 public function testJsonSerialize()
 {
     $this->wrappedSessionWillBeLoaded();
     $this->wrappedSession->expects($this->at(0))->method('jsonSerialize')->willReturn('foo');
     $this->wrappedSession->expects($this->at(1))->method('jsonSerialize')->willReturn('bar');
     self::assertSame('foo', $this->lazySession->jsonSerialize());
     self::assertSame('bar', $this->lazySession->jsonSerialize());
 }
Exemplo n.º 2
0
 /**
  * @param SessionInterface $sessionContainer
  * @param Response         $response
  * @param Token            $token
  *
  * @return Response
  *
  * @throws \InvalidArgumentException
  */
 private function appendToken(SessionInterface $sessionContainer, Response $response, Token $token = null) : Response
 {
     $sessionContainerChanged = $sessionContainer->hasChanged();
     if ($sessionContainerChanged && $sessionContainer->isEmpty()) {
         return FigResponseCookies::set($response, $this->getExpirationCookie());
     }
     if ($sessionContainerChanged || $this->shouldTokenBeRefreshed($token) && !$sessionContainer->isEmpty()) {
         return FigResponseCookies::set($response, $this->getTokenCookie($sessionContainer));
     }
     return $response;
 }