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


PHP Mage::initializeObjectManager方法代码示例

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


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

示例1: testLog

 /**
  * @param int|null $level
  * @param string $file
  * @param bool $forceLog
  * @param int $expectedLevel
  * @param string $expectedKey
  * @param bool $expectsAddLog
  * @dataProvider logDataProvider
  * @throws Exception
  */
 public function testLog($level, $file, $forceLog, $expectedLevel, $expectedKey, $expectsAddLog)
 {
     $message = uniqid();
     $objectManager = Mage::getObjectManager();
     /** @var $objectManager Magento_ObjectManager_Zend|PHPUnit_Framework_MockObject_MockObject */
     $mock = $this->getMock('Magento_ObjectManager_Zend', array('get'), array(), '', false);
     /** @var $logger Mage_Core_Model_Logger|PHPUnit_Framework_MockObject_MockObject */
     $logger = $this->getMock('Mage_Core_Model_Logger', array('log', 'addStreamLog'), array(), '', false);
     Mage::initializeObjectManager(null, $mock);
     try {
         $mock->expects($this->any())->method('get')->will($this->returnValue($logger));
         $logger->expects($this->once())->method('log')->with($message, $expectedLevel, $expectedKey);
         if ($expectsAddLog) {
             $logger->expects($this->once())->method('addStreamLog');
         }
         Mage::log($message, $level, $file, $forceLog);
         Mage::initializeObjectManager(null, $objectManager);
     } catch (Exception $e) {
         Mage::initializeObjectManager(null, $objectManager);
         throw $e;
     }
 }
开发者ID:natxetee,项目名称:magento2,代码行数:32,代码来源:MageTest.php

示例2: defined

    $moduleEtcFiles = "../../../app/etc/modules/*.xml";
}
$isCleanupEnabled = defined('TESTS_CLEANUP') && TESTS_CLEANUP == 'enabled';
$isDeveloperMode = defined('TESTS_MAGENTO_DEVELOPER_MODE') && TESTS_MAGENTO_DEVELOPER_MODE == 'enabled';
/* Enable profiler if necessary */
if (defined('TESTS_PROFILER_FILE') && TESTS_PROFILER_FILE) {
    $driver = new Magento_Profiler_Driver_Standard();
    $driver->registerOutput(new Magento_Profiler_Driver_Standard_Output_Csvfile(array('baseDir' => $testsBaseDir, 'filePath' => TESTS_PROFILER_FILE)));
    Magento_Profiler::add($driver);
}
/* Enable profiler with bamboo friendly output format */
if (defined('TESTS_BAMBOO_PROFILER_FILE') && defined('TESTS_BAMBOO_PROFILER_METRICS_FILE')) {
    $driver = new Magento_Profiler_Driver_Standard();
    $driver->registerOutput(new Magento_Test_Profiler_OutputBamboo(array('baseDir' => $testsBaseDir, 'filePath' => TESTS_BAMBOO_PROFILER_FILE, 'metrics' => require $testsBaseDir . DIRECTORY_SEPARATOR . TESTS_BAMBOO_PROFILER_METRICS_FILE)));
    Magento_Profiler::add($driver);
}
/*
 * Activate custom DocBlock annotations.
 * Note: order of registering (and applying) annotations is important.
 * To allow config fixtures to deal with fixture stores, data fixtures should be processed before config fixtures.
 */
$eventManager = new Magento_Test_EventManager(array(new Magento_Test_ClearProperties(), new Magento_Test_Annotation_AppIsolation(), new Magento_Test_Event_Transaction(new Magento_Test_EventManager(array(new Magento_Test_Annotation_DbIsolation(), new Magento_Test_Annotation_DataFixture("{$testsBaseDir}/testsuite")))), new Magento_Test_Annotation_ConfigFixture()));
Magento_Test_Event_PhpUnit::setDefaultEventManager($eventManager);
Magento_Test_Event_Magento::setDefaultEventManager($eventManager);
/* Initialize object manager instance */
Mage::initializeObjectManager(null, new Magento_Test_ObjectManager());
/* Bootstrap the application */
Magento_Test_Bootstrap::setInstance(new Magento_Test_Bootstrap($magentoBaseDir, $testsBaseDir, $localXmlFile, $globalEtcFiles, $moduleEtcFiles, 'etc/integration-tests-config.xml', $testsTmpDir, new Magento_Shell(), $isCleanupEnabled, $isDeveloperMode));
Utility_Files::init(new Utility_Files($magentoBaseDir));
/* Unset declared global variables to release PHPUnit from maintaining their values between tests */
unset($testsBaseDir, $testsTmpDir, $magentoBaseDir, $localXmlFile, $globalEtcFiles, $moduleEtcFiles, $eventManager);
开发者ID:natxetee,项目名称:magento2,代码行数:31,代码来源:bootstrap.php

示例3: array

            include_once BP . '/pub/errors/503.php';
        }
        exit;
    }
    if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
        Mage::setIsDeveloperMode(true);
    }
    if (!empty($_SERVER['MAGE_PROFILER'])) {
        $profilerConfigData = $_SERVER['MAGE_PROFILER'];
        $profilerConfig = array('baseDir' => dirname(__DIR__), 'tagFilters' => array());
        if (is_scalar($profilerConfigData)) {
            $profilerConfig['driver'] = array('output' => is_numeric($profilerConfigData) ? 'html' : $profilerConfigData);
        } elseif (is_array($profilerConfigData)) {
            $profilerConfig = array_merge($profilerConfig, $profilerConfigData);
        }
        Magento_Profiler::applyConfig($profilerConfig);
    }
}
require_once __DIR__ . '/autoload.php';
Magento_Autoload_IncludePath::addIncludePath(array(BP . DS . 'app' . DS . 'code' . DS . 'local', BP . DS . 'app' . DS . 'code' . DS . 'community', BP . DS . 'app' . DS . 'code' . DS . 'core', BP . DS . 'lib', BP . DS . 'var' . DS . 'generation'));
$classMapPath = BP . DS . 'var/classmap.ser';
if (file_exists($classMapPath)) {
    require_once BP . '/lib/Magento/Autoload/ClassMap.php';
    $classMap = new Magento_Autoload_ClassMap(BP);
    $classMap->addMap(unserialize(file_get_contents($classMapPath)));
    spl_autoload_register(array($classMap, 'load'));
}
$definitionsFile = BP . DS . 'var/di/definitions.php';
if (file_exists($definitionsFile)) {
    Mage::initializeObjectManager($definitionsFile);
}
开发者ID:natxetee,项目名称:magento2,代码行数:31,代码来源:bootstrap.php


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