$this->requestStack->
push($this->request
);
$this->session =
$this->
getMockBuilder('\Symfony\Component\HttpFoundation\Session\SessionInterface'
) ->
getMock();
} /**
* @covers ::getContext
*/
public function testSameContextForSameSession() { $this->request->
setSession($this->session
);
$cache_context =
new SessionCacheContext($this->requestStack
);
$session_id = 'aSebeZ52bbM6SvADurQP89SFnEpxY6j8';
$this->session->
expects($this->
exactly(2
)) ->
method('getId'
) ->
willReturn($session_id);
$context1 =
$cache_context->
getContext();
$context2 =
$cache_context->
getContext();
$this->
assertSame($context1,
$context2);
$this->
assertStringNotContainsString($session_id,
$context1, 'Session ID not contained in cache context'
);
}