本文整理匯總了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();
}
示例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);
}
示例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()));
}
示例4: testDetachDoesNothing
public function testDetachDoesNothing()
{
$this->events->expects(self::never())->method(self::anything());
$this->sut->detach($this->events);
}
示例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));
}