当前位置: 首页>>代码示例>>PHP>>正文


PHP SessionInterface::expects方法代码示例

本文整理汇总了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());
 }
开发者ID:adam-paterson,项目名称:orocommerce,代码行数:7,代码来源:FrontendPriceListRequestHandlerTest.php

示例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;
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:11,代码来源:CsrfListenerTest.php

示例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);
 }
开发者ID:parenthesislab,项目名称:ParenthesisWPBundle,代码行数:12,代码来源:UserHookListenerTest.php

示例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');
  }
开发者ID:Greg-Boggs,项目名称:electric-dev,代码行数:21,代码来源:SessionCacheContextTest.php

示例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);
 }
开发者ID:xtrasmal,项目名称:iinano,代码行数:14,代码来源:AccessDeniedListenerTest.php

示例6: sessionHasNotBeenStarted

 private function sessionHasNotBeenStarted()
 {
     $this->session->expects($this->once())->method('isStarted')->will($this->returnValue(false));
 }
开发者ID:kchhainarong,项目名称:chantuchP,代码行数:4,代码来源:TestSessionListenerTest.php

示例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());
 }
开发者ID:pramoddas,项目名称:elcodi,代码行数:10,代码来源:ReferrerProviderTest.php

示例8: testOffsetUnset

 public function testOffsetUnset()
 {
     $this->session->expects($this->once())->method('remove')->with($this->identicalTo($offset = 'foo'));
     unset($this->sessionStorage[$offset]);
 }
开发者ID:blazarecki,项目名称:lug,代码行数:5,代码来源:SessionStorageTest.php

示例9: testRemove

 public function testRemove()
 {
     $this->session->expects($this->once())->method('remove')->with(ProductDataStorage::PRODUCT_DATA_KEY);
     $this->storage->remove();
 }
开发者ID:adam-paterson,项目名称:orocommerce,代码行数:5,代码来源:ProductDataStorageTest.php

示例10: testRedirectAndForget

 public function testRedirectAndForget()
 {
     $this->sessionStorage->expects($this->once())->method('forget');
     $this->testInstance->redirectAndForget(uniqid());
 }
开发者ID:laravel-commode,项目名称:navigation-bag,代码行数:5,代码来源:NavigationBagTest.php


注:本文中的Symfony\Component\HttpFoundation\Session\SessionInterface::expects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。