本文整理汇总了PHP中Mage::setRoot方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage::setRoot方法的具体用法?PHP Mage::setRoot怎么用?PHP Mage::setRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage
的用法示例。
在下文中一共展示了Mage::setRoot方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testReset
/**
* @magentoAppIsolation enabled
*/
public function testReset()
{
Mage::setRoot(dirname(__FILE__));
$this->assertNotNull(Mage::getRoot());
Mage::reset();
$this->assertNull(Mage::getRoot());
}
示例2: app
/**
* Initialize and retrieve application
*
* @param string $code
* @param string $type
* @param string|array $options
* @return Mage_Core_Model_App
*/
public static function app($code = '', $type = 'store', $options = array())
{
if (null === self::$_app) {
Varien_Profiler::start('mage::app::construct');
self::$_app = new Mage_Core_Model_App();
Varien_Profiler::stop('mage::app::construct');
Mage::setRoot();
Mage::register('events', new Varien_Event_Collection());
Varien_Profiler::start('mage::app::register_config');
Mage::register('config', new Mage_Core_Model_Config());
Varien_Profiler::stop('mage::app::register_config');
Varien_Profiler::start('mage::app::init');
self::$_app->init($code, $type, $options);
Varien_Profiler::stop('mage::app::init');
self::$_app->loadAreaPart(Mage_Core_Model_App_Area::AREA_GLOBAL, Mage_Core_Model_App_Area::PART_EVENTS);
}
return self::$_app;
}
示例3: define
* @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
/**
* Constants definition
*/
define('DS', DIRECTORY_SEPARATOR);
define('BP', realpath(__DIR__ . '/../../..'));
/**
* Require necessary files
*/
require_once BP . '/app/code/core/Mage/Core/functions.php';
require_once BP . '/app/Mage.php';
require __DIR__ . '/../../../app/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'));
Mage::setRoot();
$definitions = array();
class ArrayDefinitionCompiler
{
/**#@+
* Abstract classes
*/
const ABSTRACT_MODEL = 'Mage_Core_Model_Abstract';
const ABSTRACT_BLOCK = 'Mage_Core_Block_Abstract';
/**#@-*/
/**
* Main config
*
* @var Mage_Core_Model_Config
*/
protected $_config;
示例4: iniMage
public static function iniMage()
{
chdir(self::getProjectDir());
require self::getProjectDir() . '/app/Mage.php';
Mage::setRoot(self::getProjectDir() . '/app');
Mage::app('admin')->setUseSessionInUrl(false);
Mage::setIsDeveloperMode(true);
umask(0);
}
示例5: RuntimeException
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category tests
* @package selenium2
* @subpackage runner
* @author Magento Core Team <core@magentocommerce.com>
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
if (!defined('INTEGRATION_TEST_FLAG')) {
if (version_compare(PHPUnit_Runner_Version::id(), '3.6.0', '<')) {
throw new RuntimeException('PHPUnit 3.6.0 (or later) is required.');
}
}
$rootDir = dirname(dirname(dirname(__FILE__)));
define('TBP', $rootDir . DIRECTORY_SEPARATOR . 'tests');
require_once $rootDir . DIRECTORY_SEPARATOR . 'tests/framework/Mage.php';
if (!defined('INTEGRATION_TEST_FLAG')) {
require_once $rootDir . DIRECTORY_SEPARATOR . 'tests/framework/Xcom_TestCase_Abstract.php';
require_once $rootDir . DIRECTORY_SEPARATOR . 'tests/framework/Xcom_TestCase.php';
require_once $rootDir . DIRECTORY_SEPARATOR . 'tests/framework/Xcom_Database_TestCase.php';
require_once $rootDir . DIRECTORY_SEPARATOR . 'tests/framework/Xcom_Collection_TestCase.php';
require_once $rootDir . DIRECTORY_SEPARATOR . 'tests/framework/Xcom_Integration_TestCase.php';
require_once $rootDir . DIRECTORY_SEPARATOR . 'tests/framework/Xcom_Fabric_TestCase.php';
require_once $rootDir . DIRECTORY_SEPARATOR . 'tests/framework/Xcom_Messaging_TestCase.php';
}
Mage::setRoot($rootDir . DIRECTORY_SEPARATOR . 'app');
if (!defined('INTEGRATION_TEST_FLAG')) {
Mage::app();
}
示例6: app
/**
* Initialize and retrieve application
*
* @param string $code
* @param string $type
* @param string $etcDir
* @return Mage_Core_Model_App
*/
public static function app($code = '', $type = 'store', $etcDir = null)
{
if (is_null(self::$_app)) {
Varien_Profiler::start('app/init');
self::$_app = new Mage_Core_Model_App();
Mage::setRoot();
Mage::register('events', new Varien_Event_Collection());
Mage::register('config', new Mage_Core_Model_Config());
self::$_app->init($code, $type, $etcDir);
self::$_app->loadAreaPart(Mage_Core_Model_App_Area::AREA_GLOBAL, Mage_Core_Model_App_Area::PART_EVENTS);
}
return self::$_app;
}