本文整理匯總了PHP中Contao\Environment::getInstance方法的典型用法代碼示例。如果您正苦於以下問題:PHP Environment::getInstance方法的具體用法?PHP Environment::getInstance怎麽用?PHP Environment::getInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Contao\Environment
的用法示例。
在下文中一共展示了Environment::getInstance方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testBootBackend
/**
* Test the booting in the frontend.
*
* @return void
*/
public function testBootBackend()
{
$dispatcher = $this->mockEventDispatcher(array(MetaModelsEvents::SUBSYSTEM_BOOT, MetaModelsEvents::SUBSYSTEM_BOOT_BACKEND));
$environment = \Contao\Environment::getInstance();
$container = new MetaModelsServiceContainer();
$container->setEventDispatcher($dispatcher);
$environment::set('script', 'contao/main.php');
$boot = $this->getMock('MetaModels\\Helper\\SubSystemBoot', array('getMode', 'metaModelsTablesPresent'));
$boot->expects($this->any())->method('getMode')->will($this->returnValue('BE'));
$boot->expects($this->any())->method('metaModelsTablesPresent')->will($this->returnValue(true));
$class = new \ReflectionClass($boot);
$getMode = $class->getMethod('getMode');
$getMode->setAccessible(true);
/** @var SubSystemBoot $boot */
$this->assertEquals('BE', $getMode->invoke($boot));
$boot->boot(new \Pimple(array('environment' => $environment, 'metamodels-service-container' => $container)));
}