예제 #1
0
            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);
}
예제 #2
0
 /**
  * @dataProvider applyConfigDataProvider
  * @param array $config
  * @param array $expectedDrivers
  */
 public function testApplyConfigWithDrivers(array $config, array $expectedDrivers)
 {
     Magento_Profiler::applyConfig($config);
     $this->assertAttributeEquals($expectedDrivers, '_drivers', 'Magento_Profiler');
 }
예제 #3
0
 public function testApplyConfig()
 {
     $mockDriver = $this->getMock('Magento_Profiler_DriverInterface');
     $driverConfig = array('type' => 'foo');
     $mockDriverFactory = $this->getMockBuilder('Magento_Profiler_Driver_Factory')->disableOriginalConstructor()->getMock();
     $config = array('drivers' => array($driverConfig), 'driverFactory' => $mockDriverFactory, 'tagFilters' => array('tagName' => 'tagValue'));
     $mockDriverFactory->expects($this->once())->method('create')->with($driverConfig)->will($this->returnValue($mockDriver));
     Magento_Profiler::applyConfig($config);
     $this->assertAttributeEquals(array($mockDriver), '_drivers', 'Magento_Profiler');
     $this->assertAttributeEquals(array('tagName' => array('tagValue')), '_tagFilters', 'Magento_Profiler');
     $this->assertAttributeEquals(true, '_enabled', 'Magento_Profiler');
 }