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


PHP MvcEvent::expects方法代码示例

本文整理汇总了PHP中Zend\Mvc\MvcEvent::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP MvcEvent::expects方法的具体用法?PHP MvcEvent::expects怎么用?PHP MvcEvent::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Mvc\MvcEvent的用法示例。


在下文中一共展示了MvcEvent::expects方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 public function setUp()
 {
     $this->consoleLogger = $this->getMock('Magento\\Setup\\Model\\ConsoleLogger', [], [], '', false);
     $installerFactory = $this->getMock('Magento\\Setup\\Model\\InstallerFactory', [], [], '', false);
     $this->installer = $this->getMock('Magento\\Setup\\Model\\Installer', [], [], '', false);
     $installerFactory->expects($this->once())->method('create')->with($this->consoleLogger)->willReturn($this->installer);
     $this->options = $this->getMock('Magento\\Setup\\Model\\Lists', [], [], '', false);
     $this->maintenanceMode = $this->getMock('Magento\\Framework\\App\\MaintenanceMode', [], [], '', false);
     $this->request = $this->getMock('Zend\\Console\\Request', [], [], '', false);
     $response = $this->getMock('Zend\\Console\\Response', [], [], '', false);
     $routeMatch = $this->getMock('Zend\\Mvc\\Router\\RouteMatch', [], [], '', false);
     $this->parameters = $this->getMock('Zend\\Stdlib\\Parameters', [], [], '', false);
     $this->request->expects($this->any())->method('getParams')->willReturn($this->parameters);
     $this->mvcEvent = $this->getMock('Zend\\Mvc\\MvcEvent', [], [], '', false);
     $this->mvcEvent->expects($this->once())->method('setRequest')->with($this->request)->willReturn($this->mvcEvent);
     $this->mvcEvent->expects($this->once())->method('getRequest')->willReturn($this->request);
     $this->mvcEvent->expects($this->once())->method('setResponse')->with($response)->willReturn($this->mvcEvent);
     $routeMatch->expects($this->any())->method('getParam')->willReturn('not-found');
     $this->mvcEvent->expects($this->any())->method('getRouteMatch')->willReturn($routeMatch);
     $this->objectManager = $this->getMockForAbstractClass('Magento\\Framework\\ObjectManagerInterface');
     $objectManagerProvider = $this->getMock('Magento\\Setup\\Model\\ObjectManagerProvider', [], [], '', false);
     $objectManagerProvider->expects($this->any())->method('get')->willReturn($this->objectManager);
     $this->controller = new ConsoleController($this->consoleLogger, $this->options, $installerFactory, $this->maintenanceMode, $objectManagerProvider);
     $this->controller->setEvent($this->mvcEvent);
     $this->controller->dispatch($this->request, $response);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:26,代码来源:ConsoleControllerTest.php

示例2: setUp

 public function setUp()
 {
     $this->application = $this->getMock('Zend\\Mvc\\Application', array(), array(), '', false);
     $this->event = $this->getMock('Zend\\Mvc\\MvcEvent');
     $this->serviceManager = $this->getMock('Zend\\ServiceManager\\ServiceManager');
     $this->cli = $this->getMock('Symfony\\Component\\Console\\Application', array('run'));
     $this->serviceManager->expects($this->any())->method('get')->with('doctrine.cli')->will($this->returnValue($this->cli));
     $this->application->expects($this->any())->method('getServiceManager')->will($this->returnValue($this->serviceManager));
     $this->event->expects($this->any())->method('getTarget')->will($this->returnValue($this->application));
 }
开发者ID:shitikovkirill,项目名称:zend-shop.com,代码行数:10,代码来源:ModuleTest.php

示例3: setUp

 public function setUp()
 {
     $this->request = $this->getMock('\\Zend\\Http\\PhpEnvironment\\Request', [], [], '', false);
     $this->response = $this->getMock('\\Zend\\Http\\PhpEnvironment\\Response', [], [], '', false);
     $routeMatch = $this->getMock('\\Zend\\Mvc\\Router\\RouteMatch', [], [], '', false);
     $this->uninstallCollector = $this->getMock('Magento\\Setup\\Model\\UninstallCollector', [], [], '', false);
     $this->controller = new DataOption($this->uninstallCollector);
     $this->mvcEvent = $this->getMock('\\Zend\\Mvc\\MvcEvent', [], [], '', false);
     $this->mvcEvent->expects($this->any())->method('setRequest')->with($this->request)->willReturn($this->mvcEvent);
     $this->mvcEvent->expects($this->any())->method('setResponse')->with($this->response)->willReturn($this->mvcEvent);
     $this->mvcEvent->expects($this->any())->method('setTarget')->with($this->controller)->willReturn($this->mvcEvent);
     $this->mvcEvent->expects($this->any())->method('getRouteMatch')->willReturn($routeMatch);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:13,代码来源:DataOptionTest.php

示例4: setUp

 public function setUp()
 {
     $this->payloadValidator = $this->getMock('Magento\\Setup\\Model\\PayloadValidator', [], [], '', false);
     $this->updaterTaskCreator = $this->getMock('Magento\\Setup\\Model\\UpdaterTaskCreator', [], [], '', false);
     $this->controller = new StartUpdater($this->updaterTaskCreator, $this->payloadValidator);
     $this->request = $this->getMock('\\Zend\\Http\\PhpEnvironment\\Request', [], [], '', false);
     $this->response = $this->getMock('\\Zend\\Http\\PhpEnvironment\\Response', [], [], '', false);
     $routeMatch = $this->getMock('\\Zend\\Mvc\\Router\\RouteMatch', [], [], '', false);
     $this->mvcEvent = $this->getMock('\\Zend\\Mvc\\MvcEvent', [], [], '', false);
     $this->mvcEvent->expects($this->any())->method('setRequest')->with($this->request)->willReturn($this->mvcEvent);
     $this->mvcEvent->expects($this->any())->method('setResponse')->with($this->response)->willReturn($this->mvcEvent);
     $this->mvcEvent->expects($this->any())->method('setTarget')->with($this->controller)->willReturn($this->mvcEvent);
     $this->mvcEvent->expects($this->any())->method('getRouteMatch')->willReturn($routeMatch);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:14,代码来源:StartUpdaterTest.php

示例5: setUp

 public function setUp()
 {
     $this->updater = $this->getMock('Magento\\Setup\\Model\\Updater', [], [], '', false);
     $this->fullModuleList = $this->getMock('Magento\\Framework\\Module\\FullModuleList', [], [], '', false);
     $this->filesystem = $this->getMock('Magento\\Framework\\Filesystem', [], [], '', false);
     $this->navigation = $this->getMock('Magento\\Setup\\Model\\Navigation', [], [], '', false);
     $this->controller = new StartUpdater($this->filesystem, $this->navigation, $this->updater, $this->fullModuleList);
     $this->navigation->expects($this->any())->method('getMenuItems')->willReturn([['title' => 'A', 'type' => 'update'], ['title' => 'B', 'type' => 'upgrade'], ['title' => 'C', 'type' => 'enable'], ['title' => 'D', 'type' => 'disable']]);
     $this->request = $this->getMock('\\Zend\\Http\\PhpEnvironment\\Request', [], [], '', false);
     $this->response = $this->getMock('\\Zend\\Http\\PhpEnvironment\\Response', [], [], '', false);
     $routeMatch = $this->getMock('\\Zend\\Mvc\\Router\\RouteMatch', [], [], '', false);
     $this->mvcEvent = $this->getMock('\\Zend\\Mvc\\MvcEvent', [], [], '', false);
     $this->mvcEvent->expects($this->any())->method('setRequest')->with($this->request)->willReturn($this->mvcEvent);
     $this->mvcEvent->expects($this->any())->method('setResponse')->with($this->response)->willReturn($this->mvcEvent);
     $this->mvcEvent->expects($this->any())->method('setTarget')->with($this->controller)->willReturn($this->mvcEvent);
     $this->mvcEvent->expects($this->any())->method('getRouteMatch')->willReturn($routeMatch);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:17,代码来源:StartUpdaterTest.php

示例6: testPrepareExceptionViewModel

 /**
  * @dataProvider dataForPrepareExceptionViewModel
  */
 public function testPrepareExceptionViewModel($error, $result, $exception, $hasIdentity, $isActive, $expectedSetResultCalled)
 {
     $this->event->expects($this->any())->method('getError')->willReturn($error);
     $this->event->expects($this->any())->method('getResult')->willReturn($result);
     $this->event->expects($this->any())->method('getParam')->with($this->equalTo('exception'))->willReturn($exception);
     $this->auth->expects($this->any())->method('hasIdentity')->willReturn($hasIdentity);
     $this->user->expects($this->any())->method('isActive')->willReturn($isActive);
     $this->event->expects($this->exactly($expectedSetResultCalled))->method('setResult');
     $this->listener->prepareExceptionViewModel($this->event);
 }
开发者ID:cross-solution,项目名称:yawik,代码行数:13,代码来源:DeactivatedUserListenerTest.php

示例7: setUpApplication

 private function setUpApplication()
 {
     $this->request = $this->getMockBuilder('Zend\\Http\\PhpEnvironment\\Request')->disableOriginalConstructor()->getMock();
     $this->response = $this->getMockBuilder('Zend\\Http\\PhpEnvironment\\Response')->disableOriginalConstructor()->getMock();
     $this->routeMatch = $this->getMockBuilder('Zend\\Mvc\\Router\\RouteMatch')->disableOriginalConstructor()->getMock();
     $this->mvcEvent = $this->getMockBuilder('Zend\\Mvc\\MvcEvent')->disableOriginalConstructor()->getMock();
     $this->mvcEvent->expects($this->any())->method('getRouteMatch')->will($this->returnValue($this->routeMatch));
     $this->application->expects($this->any())->method('getMvcEvent')->will($this->returnValue($this->mvcEvent));
     $this->application->expects($this->any())->method('getRequest')->will($this->returnValue($this->request));
     $this->application->expects($this->any())->method('getResponse')->will($this->returnValue($this->response));
 }
开发者ID:lafaiDev,项目名称:suive_com,代码行数:11,代码来源:RedirectCallbackTest.php


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