本文整理汇总了PHP中Symfony\Component\HttpFoundation\Session\SessionInterface::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionInterface::expects方法的具体用法?PHP SessionInterface::expects怎么用?PHP SessionInterface::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\HttpFoundation\Session\SessionInterface
的用法示例。
在下文中一共展示了SessionInterface::expects方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetShowTierPricesWithRequestAndSaveState
public function testGetShowTierPricesWithRequestAndSaveState()
{
$this->handler->setRequest($this->request);
$this->request->expects($this->exactly(3))->method('get')->willReturnMap([[FrontendPriceListRequestHandler::TIER_PRICES_KEY, null, false, '1'], [FrontendPriceListRequestHandler::SAVE_STATE_KEY, null, false, true]]);
$this->session->expects($this->once())->method('set')->with(FrontendPriceListRequestHandler::TIER_PRICES_KEY, true);
$this->assertEquals(true, $this->handler->getShowTierPrices());
}
示例2: getSessionMock
/**
* @return \Symfony\Component\HttpFoundation\Session\SessionInterface|PHPUnit_Framework_MockObject_MockObject
*/
protected function getSessionMock()
{
if (!isset($this->sessionMock)) {
$this->sessionMock = $this->getMock('Symfony\\Component\\HttpFoundation\\Session\\SessionInterface');
$this->sessionMock->expects($this->atLeastOnce())->method('isStarted')->will($this->returnValue($this->sessionIsStarted));
}
return $this->sessionMock;
}
示例3: testOnLogout
/**
* Tests onLogout() method.
*/
public function testOnLogout()
{
// Given
$event = $this->getMock('Parenthesis\\WPBundle\\Event\\WordpressEvent');
// When - Then
$this->session->expects($this->once())->method('clear');
$this->tokenStorage->expects($this->once())->method('setToken')->with(null);
$this->listener->onLogout($event);
}
示例4: testDifferentContextForDifferentSession
/**
* @covers ::getContext
*/
public function testDifferentContextForDifferentSession() {
$session1_id = 'pjH_8aSoofyCDQiuVYXJcbfyr-CPtkUY';
$this->session->expects($this->at(0))
->method('getId')
->will($this->returnValue($session1_id));
$session2_id = 'aSebeZ52bbM6SvADurQP89SFnEpxY6j8';
$this->session->expects($this->at(1))
->method('getId')
->will($this->returnValue($session2_id));
$context1 = $this->cacheContext->getContext();
$context2 = $this->cacheContext->getContext();
$this->assertNotEquals($context1, $context2);
$this->assertSame(FALSE, strpos($context1, $session1_id), 'Session ID not contained in cache context');
$this->assertSame(FALSE, strpos($context2, $session2_id), 'Session ID not contained in cache context');
}
示例5: testAuthenticatedWithInvalidNetizen
public function testAuthenticatedWithInvalidNetizen()
{
$token = new Token('secu', 'dummy', '123456');
$user = new Netizen(new Author('kirk'));
$token->setUser($user);
$event = $this->createEvent(new AccessDeniedHttpException());
$this->security->expects($this->once())->method('getToken')->willReturn($token);
$this->security->expects($this->once())->method('isGranted')->with(TicketVoter::SUPPORTED_ATTRIBUTE)->willReturn(false);
$bag = new \Symfony\Component\HttpFoundation\Session\Flash\FlashBag();
$this->session->expects($this->once())->method('getFlashBag')->willReturn($bag);
$this->sut->onKernelException($event);
$this->assertTrue($event->hasResponse());
$this->assertCount(1, $bag);
}
示例6: sessionHasNotBeenStarted
private function sessionHasNotBeenStarted()
{
$this->session->expects($this->once())->method('isStarted')->will($this->returnValue(false));
}
示例7: testReferrerIsSearchEngine
/**
* Test referrer is search engine.
*
* @dataProvider dataReferrerIsSearchEngine
*/
public function testReferrerIsSearchEngine($referrer, $isSearchEngine)
{
$this->session->expects($this->any())->method('get')->will($this->returnValue($referrer));
$this->assertEquals($isSearchEngine, $this->referrerProvider->referrerIsSearchEngine());
}
示例8: testOffsetUnset
public function testOffsetUnset()
{
$this->session->expects($this->once())->method('remove')->with($this->identicalTo($offset = 'foo'));
unset($this->sessionStorage[$offset]);
}
示例9: testRemove
public function testRemove()
{
$this->session->expects($this->once())->method('remove')->with(ProductDataStorage::PRODUCT_DATA_KEY);
$this->storage->remove();
}
示例10: testRedirectAndForget
public function testRedirectAndForget()
{
$this->sessionStorage->expects($this->once())->method('forget');
$this->testInstance->redirectAndForget(uniqid());
}