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


PHP Console::overrideIsConsole方法代码示例

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


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

示例1: _initialize

 public function _initialize()
 {
     require Configuration::projectDir() . 'init_autoloader.php';
     $this->applicationConfig = (require Configuration::projectDir() . $this->config['config']);
     if (isset($applicationConfig['module_listener_options']['config_cache_enabled'])) {
         $applicationConfig['module_listener_options']['config_cache_enabled'] = false;
     }
     Console::overrideIsConsole(false);
 }
开发者ID:jpmanne,项目名称:twm-funcTests,代码行数:9,代码来源:ZF2.php

示例2: it_aborts_bootstrap_on_console

 public function it_aborts_bootstrap_on_console(MvcEvent $event, Application $application, ServiceLocatorInterface $serviceLocator, AccessListener $listener, EventManager $eventManager)
 {
     Console::overrideIsConsole(true);
     $application->getEventManager()->willReturn($eventManager);
     $serviceLocator->get(AccessListener::class)->willReturn($listener);
     $application->getServiceManager()->willReturn($serviceLocator);
     $event->getApplication()->willReturn($application);
     $listener->attach($eventManager)->shouldNotBeCalled();
     $this->onBootstrap($event);
 }
开发者ID:saeven,项目名称:zf3-circlical-user,代码行数:10,代码来源:ModuleSpec.php

示例3: testCanForceInstance

 public function testCanForceInstance()
 {
     $console = Console::getInstance('Posix');
     $this->assertTrue($console instanceof Adapter\AdapterInterface);
     $this->assertTrue($console instanceof Adapter\Posix);
     Console::overrideIsConsole(null);
     Console::resetInstance();
     $console = Console::getInstance('Windows');
     $this->assertTrue($console instanceof Adapter\AdapterInterface);
     $this->assertTrue($console instanceof Adapter\Windows);
 }
开发者ID:rajanlamic,项目名称:IntTest,代码行数:11,代码来源:ConsoleTest.php

示例4: testUrlHelperUnderConsoleParadigmShouldReturnHttpRoutes

 public function testUrlHelperUnderConsoleParadigmShouldReturnHttpRoutes()
 {
     Console::overrideIsConsole(true);
     $this->serviceManager->get('Application')->bootstrap();
     $request = $this->serviceManager->get('Request');
     $this->assertInstanceOf('Zend\\Console\\Request', $request);
     $viewHelpers = $this->serviceManager->get('ViewHelperManager');
     $urlHelper = $viewHelpers->get('url');
     $test = $urlHelper('test');
     $this->assertEquals('/test', $test);
 }
开发者ID:nieldm,项目名称:zf2,代码行数:11,代码来源:UrlIntegrationTest.php

示例5: getApplication

 /**
  * @return \Zend\Mvc\Application
  */
 public function getApplication()
 {
     if ($this->spiffyApplication) {
         return $this->spiffyApplication;
     }
     Console::overrideIsConsole($this->getUseConsoleRequest());
     $this->spiffyApplication = SpiffyTest::getInstance()->getApplication();
     $events = $this->spiffyApplication->getEventManager();
     $events->detach($this->spiffyApplication->getServiceManager()->get('SendResponseListener'));
     return $this->spiffyApplication;
 }
开发者ID:svenanders,项目名称:saruser,代码行数:14,代码来源:AbstractHttpControllerTestCase.php

示例6: bootstrap

 public function bootstrap()
 {
     // mark the MVC doesn't use console
     Console::overrideIsConsole(false);
     // bootstrap application
     $application = $this->getServiceManager()->get('Application')->bootstrap();
     // set service manager
     self::$serviceManager = $application->getServiceManager();
     self::$documentManager = $this->getServiceManager()->get('doctrine.odm.documentmanager.default');
     self::$dbName = $this->getServiceManager()->get('config')['doctrine']['odm']['connection']['default']['dbname'];
 }
开发者ID:dollyaswin,项目名称:pyro,代码行数:11,代码来源:AbstractTest.php

示例7: _initialize

 public function _initialize()
 {
     require Configuration::projectDir() . 'init_autoloader.php';
     $this->applicationConfig = (require Configuration::projectDir() . $this->config['config']);
     if (isset($this->applicationConfig['module_listener_options']['config_cache_enabled'])) {
         $this->applicationConfig['module_listener_options']['config_cache_enabled'] = false;
     }
     Console::overrideIsConsole(false);
     //grabServiceFromContainer may need client in beforeClass hooks of modules or helpers
     $this->client = new ZF2Connector();
     $this->client->setApplicationConfig($this->applicationConfig);
 }
开发者ID:solutionDrive,项目名称:Codeception,代码行数:12,代码来源:ZF2.php

示例8: _before

 public function _before(\Codeception\TestCase $test)
 {
     $applicationConfig = (require \Codeception\Configuration::projectDir() . $this->config['config']);
     if (isset($applicationConfig['module_listener_options']['config_cache_enabled'])) {
         $applicationConfig['module_listener_options']['config_cache_enabled'] = false;
     }
     Console::overrideIsConsole(false);
     $this->application = Application::init($applicationConfig);
     $events = $this->application->getEventManager();
     $events->detach($this->application->getServiceManager()->get('SendResponseListener'));
     $this->client->setApplication($this->application);
 }
开发者ID:lenninsanchez,项目名称:donadores,代码行数:12,代码来源:ZF2.php

示例9: testOnBootstrap

 public function testOnBootstrap()
 {
     $event = new MvcEvent();
     $application = new Application([], Bootstrap::getServiceManager());
     $em = new EventManager();
     $application->setEventManager($em);
     $event->setApplication($application);
     $isConsole = Console::isConsole();
     Console::overrideIsConsole(false);
     $this->module->onBootstrap($event);
     Console::overrideIsConsole($isConsole);
     $this->assertCount(1, $em->getListeners(MvcEvent::EVENT_DISPATCH));
     $this->assertCount(1, $em->getListeners(MvcEvent::EVENT_RENDER));
 }
开发者ID:hummer2k,项目名称:convarnish,代码行数:14,代码来源:ModuleTest.php

示例10: testApplicationClassAndTestRestoredConsoleFlag

 public function testApplicationClassAndTestRestoredConsoleFlag()
 {
     $this->assertTrue(Console::isConsole(), '1. Console::isConsole returned false in initial test');
     $this->getApplication();
     $this->assertFalse(Console::isConsole(), '2. Console::isConsole returned true after retrieving application');
     $this->tearDown();
     $this->assertTrue(Console::isConsole(), '3. Console::isConsole returned false after tearDown');
     Console::overrideIsConsole(false);
     parent::setUp();
     $this->assertFalse(Console::isConsole(), '4. Console::isConsole returned true after parent::setUp');
     $this->getApplication();
     $this->assertFalse(Console::isConsole(), '5. Console::isConsole returned true after retrieving application');
     parent::tearDown();
     $this->assertFalse(Console::isConsole(), '6. Console.isConsole returned true after parent::tearDown');
 }
开发者ID:pnaq57,项目名称:zf2demo,代码行数:15,代码来源:AbstractControllerTestCaseTest.php

示例11: createServer

 public function createServer($name = 'default')
 {
     Console::overrideIsConsole(false);
     $configuration = $this->configuration;
     $smConfig = isset($configuration['service_manager']) ? $configuration['service_manager'] : array();
     $serviceManager = new ServiceManager(new ServiceManagerConfig($smConfig));
     $serviceManager->setService('ApplicationConfig', $configuration);
     $serviceManager->get('ModuleManager')->loadModules();
     $application = new Application($configuration, $serviceManager);
     $application->setServerOptions($this->options->getServer($name));
     $allow = $serviceManager->getAllowOverride();
     $serviceManager->setAllowOverride(true);
     $serviceManager->setService('application', $application);
     $serviceManager->setAllowOverride($allow);
     return $application->bootstrap();
 }
开发者ID:im286er,项目名称:ent,代码行数:16,代码来源:ApplicationManager.php

示例12: setUp

 public function setUp()
 {
     // Used by \KJSencha\Service\ApiFactory::createService
     \Zend\Console\Console::overrideIsConsole(false);
     $sl = ServiceManagerFactory::getServiceManager();
     /* @var $manager DirectManager */
     $manager = $sl->get('kjsencha.direct.manager');
     /* @var $apiFactory \KJSencha\Direct\Remoting\Api\Api */
     $api = $sl->get('kjsencha.api');
     $this->controller = new DirectController($manager, $api);
     $this->request = new Request();
     $this->routeMatch = new RouteMatch(array('controller' => 'kjsencha_direct'));
     $this->event = new MvcEvent();
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
 }
开发者ID:shraddhanegi,项目名称:KJSencha,代码行数:16,代码来源:DirectControllerTest.php

示例13: testClosureThisIsControllerInstance

 /**
  * @requires PHP 5.4
  */
 public function testClosureThisIsControllerInstance()
 {
     Console::overrideIsConsole(false);
     $app = App::init();
     $test = $this;
     $appRequest = new Request();
     $appRequest->setUri('http://localhost/test/blah');
     $app->getMvcEvent()->setRequest($appRequest);
     $app->route('/test/:param1', function () use($test) {
         $test->assertInstanceOf('ZeffMu\\ClosureController', $this);
         return 'test';
     });
     // overriding send response listener
     $app->getEventManager()->attach(MvcEvent::EVENT_FINISH, function (EventInterface $e) {
         $e->stopPropagation();
     }, 1000);
     $app->run();
 }
开发者ID:binarykitten,项目名称:zeffmu,代码行数:21,代码来源:AppFunctionalTest.php

示例14: testApplicationClassAndTestRestoredConsoleFlag

    public function testApplicationClassAndTestRestoredConsoleFlag()
    {
        $this->assertTrue(Console::isConsole());
        $this->getApplication();
        $this->assertFalse(Console::isConsole());
        $this->tearDown();
        $this->assertTrue(Console::isConsole());

        Console::overrideIsConsole(false);
        parent::setUp();

        $this->assertFalse(Console::isConsole());
        $this->getApplication();
        $this->assertFalse(Console::isConsole());

        parent::tearDown();

        $this->assertFalse(Console::isConsole());
    }
开发者ID:benivaldo,项目名称:zf2-na-pratica,代码行数:19,代码来源:AbstractControllerTestCaseTest.php

示例15: setUp

 public function setUp()
 {
     Console::overrideIsConsole(false);
     parent::setUp();
     $this->request = new Request();
     $this->request->setHeaders(new Headers());
     $this->routeMatch = new RouteMatch(array('controller' => $this->controllerName));
     $this->event = $this->getApplication()->getMvcEvent();
     $this->event->setRequest($this->request);
     $this->event->setRouteMatch($this->routeMatch);
     $this->event->getRouter()->setRequestUri(new HttpUri('http://localhost'));
     if (null === $this->controller) {
         if (null === $this->controllerName) {
             throw new PHPUnit_Framework_Exception('No controller name was specified in the test');
         }
         $this->controller = $this->getServiceManager()->get('ControllerLoader')->get($this->controllerName);
     }
     $this->controller->setEvent($this->event);
 }
开发者ID:outeredge,项目名称:edge-zf2,代码行数:19,代码来源:AbstractControllerTestCase.php


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