예제 #1
0
/**
 * Require necessary files
 */
require_once BP . '/lib/Magento/Autoload.php';
require_once BP . '/app/code/core/Mage/Core/functions.php';
require_once BP . '/app/Mage.php';
if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
    Mage::setIsDeveloperMode(true);
}
Mage::register('original_include_path', get_include_path());
$paths[] = BP . DS . 'app' . DS . 'code' . DS . 'local';
$paths[] = BP . DS . 'app' . DS . 'code' . DS . 'community';
$paths[] = BP . DS . 'app' . DS . 'code' . DS . 'core';
$paths[] = BP . DS . 'lib';
Magento_Autoload::getInstance()->addIncludePath($paths);
$classMapPath = BP . DS . 'var/classmap.ser';
if (file_exists($classMapPath)) {
    Magento_Autoload::getInstance()->addFilesMap($classMapPath);
}
if (isset($_SERVER['MAGE_PROFILER'])) {
    switch ($_SERVER['MAGE_PROFILER']) {
        case 'firebug':
            Magento_Profiler::registerOutput(new Magento_Profiler_Output_Firebug());
            break;
        case 'csv':
            Magento_Profiler::registerOutput(new Magento_Profiler_Output_Csvfile(__DIR__ . '/../var/log/profiler.csv'));
            break;
        default:
            Magento_Profiler::registerOutput(new Magento_Profiler_Output_Html());
    }
}
예제 #2
0
 public function testDisplay()
 {
     $profilerOutputOne = $this->getMockForAbstractClass('Magento_Profiler_OutputAbstract');
     $profilerOutputOne->expects($this->exactly(2))->method('display');
     $profilerOutputTwo = $this->getMockForAbstractClass('Magento_Profiler_OutputAbstract');
     $profilerOutputTwo->expects($this->once())->method('display');
     Magento_Profiler::registerOutput($profilerOutputOne);
     Magento_Profiler::display();
     Magento_Profiler::disable();
     Magento_Profiler::registerOutput($profilerOutputTwo);
     Magento_Profiler::display();
 }
예제 #3
0
}
if (defined('TESTS_MODULE_CONFIG_FILES') && TESTS_MODULE_CONFIG_FILES) {
    $moduleEtcFiles = TESTS_MODULE_CONFIG_FILES;
} else {
    $moduleEtcFiles = "../../../app/etc/modules/*.xml";
}
$developerMode = false;
if (defined('TESTS_MAGENTO_DEVELOPER_MODE') && TESTS_MAGENTO_DEVELOPER_MODE == 'enabled') {
    $developerMode = true;
}
/* Enable profiler if necessary */
if (defined('TESTS_PROFILER_FILE') && TESTS_PROFILER_FILE) {
    Magento_Profiler::registerOutput(new Magento_Profiler_Output_Csvfile($testsBaseDir . DIRECTORY_SEPARATOR . TESTS_PROFILER_FILE));
}
/* Enable profiler with bamboo friendly output format */
if (defined('TESTS_BAMBOO_PROFILER_FILE') && defined('TESTS_BAMBOO_PROFILER_METRICS_FILE')) {
    Magento_Profiler::registerOutput(new Magento_Test_Profiler_OutputBamboo($testsBaseDir . DIRECTORY_SEPARATOR . TESTS_BAMBOO_PROFILER_FILE, require $testsBaseDir . DIRECTORY_SEPARATOR . TESTS_BAMBOO_PROFILER_METRICS_FILE));
}
/*
 * 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_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);
/* Bootstrap the application */
Magento_Test_Bootstrap::setInstance(new Magento_Test_Bootstrap($magentoBaseDir, $localXmlFile, $globalEtcFiles, $moduleEtcFiles, 'etc/integration-tests-config.xml', $testsTmpDir, $cleanupAction, $developerMode));
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);