當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。