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


PHP Icinga::setApp方法代码示例

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


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

示例1: __construct

 /**
  * Constructor
  *
  * @param string $baseDir   Icinga Web 2 base directory
  * @param string $configDir Path to Icinga Web 2's configuration files
  */
 protected function __construct($baseDir = null, $configDir = null)
 {
     if ($baseDir === null) {
         $baseDir = dirname($this->getBootstrapDirectory());
     }
     $this->baseDir = $baseDir;
     $this->appDir = $baseDir . '/application';
     $this->vendorDir = $baseDir . '/library/vendor';
     $this->libDir = realpath(__DIR__ . '/../..');
     $this->setupAutoloader();
     if ($configDir === null) {
         $configDir = getenv('ICINGAWEB_CONFIGDIR');
         if ($configDir === false) {
             $configDir = Platform::isWindows() ? $baseDir . '/config' : '/etc/icingaweb2';
         }
     }
     $canonical = realpath($configDir);
     $this->configDir = $canonical ? $canonical : $configDir;
     set_include_path(implode(PATH_SEPARATOR, array($this->vendorDir, get_include_path())));
     Benchmark::measure('Bootstrap, autoloader registered');
     Icinga::setApp($this);
     require_once dirname(__FILE__) . '/functions.php';
 }
开发者ID:kobmaki,项目名称:icingaweb2,代码行数:29,代码来源:ApplicationBootstrap.php

示例2: setupIcingaMock

 /**
  * Setup mock object for the application's bootstrap
  *
  * @param   Zend_Controller_Request_Abstract    $request    The request to be returned by
  *                                                          Icinga::app()->getFrontController()->getRequest()
  */
 protected function setupIcingaMock(Zend_Controller_Request_Abstract $request)
 {
     $bootstrapMock = Mockery::mock('Icinga\\Application\\ApplicationBootstrap')->shouldDeferMissing();
     $bootstrapMock->shouldReceive('getFrontController->getRequest')->andReturnUsing(function () use($request) {
         return $request;
     })->shouldReceive('getApplicationDir')->andReturn(self::$appDir);
     Icinga::setApp($bootstrapMock, true);
 }
开发者ID:vbereza,项目名称:icinga2-migration,代码行数:14,代码来源:BaseTestCase.php

示例3: setupIcingaMock

 /**
  * Setup mock object for the application's bootstrap
  *
  * @return  Mockery\Mock
  */
 protected function setupIcingaMock()
 {
     $requestMock = Mockery::mock('Icinga\\Web\\Request')->shouldDeferMissing();
     $requestMock->shouldReceive('getPathInfo')->andReturn('')->byDefault()->shouldReceive('getBaseUrl')->andReturn('/')->byDefault()->shouldReceive('getQuery')->andReturn(array())->byDefault()->shouldReceive('getParam')->with(Mockery::type('string'), Mockery::type('string'))->andReturnUsing(function ($name, $default) {
         return $default;
     })->byDefault();
     $responseMock = Mockery::mock('Icinga\\Web\\Response')->shouldDeferMissing();
     // Can't express this as demeter chains. See: https://github.com/padraic/mockery/issues/59
     $bootstrapMock = Mockery::mock('Icinga\\Application\\ApplicationBootstrap')->shouldDeferMissing();
     $libDir = dirname(self::$libDir);
     $bootstrapMock->shouldReceive('getFrontController')->andReturn($bootstrapMock)->shouldReceive('getApplicationDir')->andReturn(self::$appDir)->shouldReceive('getLibraryDir')->andReturnUsing(function ($subdir = null) use($libDir) {
         if ($subdir !== null) {
             $libDir .= '/' . ltrim($subdir, '/');
         }
         return $libDir;
     })->shouldReceive('getRequest')->andReturn($requestMock)->shouldReceive('getResponse')->andReturn($responseMock);
     Icinga::setApp($bootstrapMock, true);
     return $bootstrapMock;
 }
开发者ID:hsanjuan,项目名称:icingaweb2,代码行数:24,代码来源:BaseTestCase.php

示例4: __construct

 /**
  * Constructor
  */
 protected function __construct($configDir = null)
 {
     $this->libDir = realpath(__DIR__ . '/../..');
     if (!defined('ICINGA_LIBDIR')) {
         define('ICINGA_LIBDIR', $this->libDir);
     }
     if (defined('ICINGAWEB_APPDIR')) {
         $this->appDir = ICINGAWEB_APPDIR;
     } elseif (array_key_exists('ICINGAWEB_APPDIR', $_SERVER)) {
         $this->appDir = $_SERVER['ICINGAWEB_APPDIR'];
     } else {
         $this->appDir = realpath($this->libDir . '/../application');
     }
     if (!defined('ICINGAWEB_APPDIR')) {
         define('ICINGAWEB_APPDIR', $this->appDir);
     }
     if ($configDir === null) {
         if (array_key_exists('ICINGAWEB_CONFIGDIR', $_SERVER)) {
             $configDir = $_SERVER['ICINGAWEB_CONFIGDIR'];
         } else {
             $configDir = '/etc/icingaweb';
         }
     }
     $this->configDir = realpath($configDir);
     $this->setupAutoloader();
     $this->setupZendAutoloader();
     Benchmark::measure('Bootstrap, autoloader registered');
     Icinga::setApp($this);
     require_once dirname(__FILE__) . '/functions.php';
 }
开发者ID:vbereza,项目名称:icinga2-migration,代码行数:33,代码来源:ApplicationBootstrap.php


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