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


PHP Application::bootstrap方法代码示例

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


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

示例1: getApplication

 protected function getApplication()
 {
     if (null === $this->application) {
         $this->application = $this->getServiceManager()->get('Application');
         $this->application->bootstrap();
     }
     return $this->application;
 }
开发者ID:outeredge,项目名称:edge-zf2,代码行数:8,代码来源:AbstractTestCase.php

示例2: setupPathController

 public function setupPathController()
 {
     $request = $this->serviceManager->get('Request');
     $uri = UriFactory::factory('http://example.local/path');
     $request->setUri($uri);
     $router = $this->serviceManager->get('HttpRouter');
     $route = Router\Http\Literal::factory(array('route' => '/path', 'defaults' => array('controller' => 'path')));
     $router->addRoute('path', $route);
     $this->application->bootstrap();
 }
开发者ID:pnaq57,项目名称:zf2demo,代码行数:10,代码来源:DispatchListenerTest.php

示例3: testCanRecoverFromApplicationError

 public function testCanRecoverFromApplicationError()
 {
     $this->application->bootstrap();
     $response = $this->getMock('Zend\\Stdlib\\ResponseInterface');
     $errorMock = $this->getMock('stdClass', array('__invoke'));
     $finishMock = $this->getMock('stdClass', array('__invoke'));
     $routeMock = $this->getMock('stdClass', array('__invoke'));
     $dispatchMock = $this->getMock('stdClass', array('__invoke'));
     $errorMock->expects($this->once())->method('__invoke')->will($this->returnCallback(function (MvcEvent $event) {
         $event->stopPropagation(true);
         $event->setRouteMatch(new Router\RouteMatch(array()));
         $event->setError('');
     }));
     $routeMock->expects($this->once())->method('__invoke')->will($this->returnCallback(function (MvcEvent $event) {
         $event->stopPropagation(true);
         $event->setError(Application::ERROR_ROUTER_NO_MATCH);
         return $event->getApplication()->getEventManager()->trigger(MvcEvent::EVENT_DISPATCH_ERROR, $event)->last();
     }));
     $dispatchMock->expects($this->once())->method('__invoke')->will($this->returnValue($response));
     $finishMock->expects($this->once())->method('__invoke')->will($this->returnCallback(function (MvcEvent $event) {
         $event->stopPropagation(true);
     }));
     $this->application->getEventManager()->attach(MvcEvent::EVENT_DISPATCH_ERROR, $errorMock, 100);
     $this->application->getEventManager()->attach(MvcEvent::EVENT_ROUTE, $routeMock, 100);
     $this->application->getEventManager()->attach(MvcEvent::EVENT_DISPATCH, $dispatchMock, 100);
     $this->application->getEventManager()->attach(MvcEvent::EVENT_FINISH, $finishMock, 100);
     $this->application->run();
     $this->assertSame($response, $this->application->getMvcEvent()->getResponse());
 }
开发者ID:pnaq57,项目名称:zf2demo,代码行数:29,代码来源:ApplicationTest.php

示例4: setUp

 public function setUp()
 {
     $config = ['modules' => ['Zff\\Html2Pdf'], 'module_listener_options' => []];
     $serviceManager = new ServiceManager((new ServiceManagerConfig())->toArray());
     $serviceManager->setService('ApplicationConfig', $config);
     $serviceManager->get('ModuleManager')->loadModules();
     $application = new Application($config, $serviceManager);
     $application->bootstrap();
     $this->serviceManager = $serviceManager;
 }
开发者ID:wizzvet,项目名称:ZffHtml2pdf,代码行数:10,代码来源:ViewHtml2PdfStrategyFactoryTest.php

示例5: testCompleteRequestShouldReturnApplicationInstance

 public function testCompleteRequestShouldReturnApplicationInstance()
 {
     $r = new ReflectionObject($this->application);
     $method = $r->getMethod('completeRequest');
     $method->setAccessible(true);
     $this->application->bootstrap();
     $event = $this->application->getMvcEvent();
     $result = $method->invoke($this->application, $event);
     $this->assertSame($this->application, $result);
 }
开发者ID:razvansividra,项目名称:pnlzf2-1,代码行数:10,代码来源:ApplicationTest.php

示例6: testCustomListener

 public function testCustomListener()
 {
     $this->application->bootstrap(array('BootstrapListener'));
     // must contains custom bootstrap listeners
     $bootstrapListener = $this->serviceManager->get('BootstrapListener');
     $listeners = $this->application->getEventManager()->getListeners(MvcEvent::EVENT_BOOTSTRAP);
     $bootstrapListeners = $bootstrapListener->getListeners();
     $this->assertTrue($listeners->contains($bootstrapListeners[0]));
     // must contains default listeners
     $listeners = $this->application->getEventManager()->getListeners(MvcEvent::EVENT_DISPATCH);
     $this->assertEquals(1, count($listeners));
     $listeners = $this->application->getEventManager()->getListeners(MvcEvent::EVENT_ROUTE);
     $this->assertEquals(1, count($listeners));
     $listeners = $this->application->getEventManager()->getListeners(MvcEvent::EVENT_FINISH);
     $this->assertEquals(1, count($listeners));
 }
开发者ID:rajanlamic,项目名称:IntTest,代码行数:16,代码来源:ApplicationTest.php


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