當前位置: 首頁>>代碼示例>>PHP>>正文


PHP EventManagerInterface::expects方法代碼示例

本文整理匯總了PHP中Zend\EventManager\EventManagerInterface::expects方法的典型用法代碼示例。如果您正苦於以下問題:PHP EventManagerInterface::expects方法的具體用法?PHP EventManagerInterface::expects怎麽用?PHP EventManagerInterface::expects使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend\EventManager\EventManagerInterface的用法示例。


在下文中一共展示了EventManagerInterface::expects方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testLogoutAdapters

 /**
  * Test the logoutAdapters method.
  *
  * @depends testGetEventWithEventSet
  * @covers ZfcUser\Authentication\Adapter\AdapterChain::logoutAdapters
  */
 public function testLogoutAdapters()
 {
     $event = new AdapterChainEvent();
     $this->eventManager->expects($this->once())->method('trigger')->with('logout', $event);
     $this->adapterChain->setEvent($event);
     $this->adapterChain->logoutAdapters();
 }
開發者ID:aapthi,項目名稱:video-collections,代碼行數:13,代碼來源:AdapterChainTest.php

示例2: testListenersAreRegistered

 public function testListenersAreRegistered()
 {
     $event = $this->getEvent();
     $options = new ModuleOptions(['register_http_method_override_listener' => true]);
     $this->serviceLocator->setService(ModuleOptions::class, $options);
     // --------------------------------------------------------------------------------
     // Test that HTTP exception listener is registered
     // --------------------------------------------------------------------------------
     $this->serviceLocator->setService(HttpExceptionListener::class, $this->getMock(HttpExceptionListener::class));
     $this->eventManager->expects($this->at(0))->method('attachAggregate')->with($this->isInstanceOf(HttpExceptionListener::class));
     // --------------------------------------------------------------------------------
     // Test that HTTP response listener is registered
     // --------------------------------------------------------------------------------
     $this->serviceLocator->setService(ResourceResponseListener::class, $this->getMock(ResourceResponseListener::class));
     $this->eventManager->expects($this->at(1))->method('attachAggregate')->with($this->isInstanceOf(ResourceResponseListener::class));
     // --------------------------------------------------------------------------------
     // Test the HTTP method override listener is registered
     // --------------------------------------------------------------------------------
     $this->serviceLocator->setService(HttpMethodOverrideListener::class, $this->getMock(HttpMethodOverrideListener::class));
     $this->eventManager->expects($this->at(2))->method('attachAggregate')->with($this->isInstanceOf(HttpMethodOverrideListener::class));
     $module = new Module();
     $module->onBootstrap($event);
 }
開發者ID:omusico,項目名稱:zfr-rest,代碼行數:23,代碼來源:ModuleTest.php

示例3: testCommitRevision

 public function testCommitRevision()
 {
     $repositoryConfig = $this->moduleConfig['permissions']['Athene2Test\\VersioningTest\\Asset\\RepositoryFake'];
     $permission = $repositoryConfig[ModuleOptions::KEY_PERMISSION_COMMIT];
     $data = ['foo' => 'bar'];
     $this->authorizationService->expects($this->any())->method('getIdentity')->will($this->returnValue($this->identity));
     $this->authorizationService->expects($this->once())->method('isGranted')->with($permission)->will($this->returnValue(true));
     $this->objectManager->expects($this->atLeastOnce())->method('persist');
     $this->eventManager->expects($this->once())->method('trigger')->with(VersioningEvent::COMMIT);
     $this->repositoryManager->setEventManager($this->eventManager);
     $revision = $this->repositoryManager->commitRevision($this->repository, $data);
     $this->assertSame($this->repository, $revision->getRepository());
     $this->assertSame($this->identity, $revision->getAuthor());
     $this->assertSame('bar', $revision->get('foo'));
     $this->assertEquals($revision, current($this->repository->getRevisions()));
 }
開發者ID:serlo-org,項目名稱:athene2-versioning,代碼行數:16,代碼來源:RepositoryManagerTest.php

示例4: testDetachDoesNothing

 public function testDetachDoesNothing()
 {
     $this->events->expects(self::never())->method(self::anything());
     $this->sut->detach($this->events);
 }
開發者ID:abacaphiliac,項目名稱:zend-eventmanager-pluginmanager,代碼行數:5,代碼來源:NullListenerAggregateTest.php

示例5: testExtract

 /**
  * @covers \Zend\Stdlib\Hydrator\Aggregate\AggregateHydrator::extract
  */
 public function testExtract()
 {
     $object = new stdClass();
     $this->eventManager->expects($this->once())->method('trigger')->with($this->isInstanceOf('Zend\\Stdlib\\Hydrator\\Aggregate\\ExtractEvent'));
     $this->assertSame(array(), $this->hydrator->extract($object));
 }
開發者ID:pnaq57,項目名稱:zf2demo,代碼行數:9,代碼來源:AggregateHydratorTest.php


注:本文中的Zend\EventManager\EventManagerInterface::expects方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。