protected function setUp() { $this->_generationDirectory = rtrim(self::GENERATION_DIRECTORY, self::DIRECTORY_SEPARATOR) . self::DIRECTORY_SEPARATOR; $this->_ioObjectMock = $this->getMock('Varien_Io_File', array('dirsep', 'isWriteable', 'mkdir', 'fileExists', 'write')); $this->_ioObjectMock->expects($this->any())->method('dirsep')->will($this->returnValue(self::DIRECTORY_SEPARATOR)); $this->_autoLoaderMock = $this->getMock('Magento_Autoload_IncludePath', array('getFilePath'), array(), '', false); $this->_autoLoaderMock->staticExpects($this->any())->method('getFilePath')->with(self::CLASS_NAME)->will($this->returnValue(self::CLASS_FILE_NAME)); $this->_object = new Magento_Di_Generator_Io($this->_ioObjectMock, $this->_autoLoaderMock, self::GENERATION_DIRECTORY); }
/** * @expectedException Magento_Exception */ public function testGenerateClassWithError() { $this->_autoloader->staticExpects($this->once())->method('getFile')->will($this->returnValue(false)); $this->_generator->expects($this->once())->method('generate')->will($this->returnValue(false)); $this->_model = new Magento_Di_Generator($this->_generator, $this->_autoloader); $expectedEntities = array_values($this->_expectedEntities); $resultClassName = self::SOURCE_CLASS . ucfirst(array_shift($expectedEntities)); $this->_model->generateClass($resultClassName); }
protected function setUp() { $this->_includePath = get_include_path(); /** @var $config Mage_Core_Model_Config */ $config = Mage::getObjectManager()->get('Mage_Core_Model_Config'); $generationDirectory = $config->getVarDir() . '/generation'; Magento_Autoload_IncludePath::addIncludePath($generationDirectory); $ioObject = new Magento_Di_Generator_Io(new Varien_Io_File(), new Magento_Autoload_IncludePath(), $generationDirectory); $this->_generator = Mage::getObjectManager()->get('Magento_Di_Generator', array('ioObject' => $ioObject)); }
/** * @param string $class * @param string|bool $expectedValue * @dataProvider getFileDataProvider */ public function testLoad($class, $expectedValue) { Magento_Autoload_IncludePath::addIncludePath(__DIR__ . '/_files'); $this->assertFalse(class_exists($class, false)); Magento_Autoload_IncludePath::load($class); if ($expectedValue) { $this->assertTrue(class_exists($class, false)); } else { $this->assertFalse(class_exists($class, false)); } }
* obtain it through the world-wide-web, please send an email * to license@magentocommerce.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * * @category build * @package sanity * @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) */ require __DIR__ . '/../../../../app/autoload.php'; Magento_Autoload_IncludePath::addIncludePath(array(__DIR__, realpath(__DIR__ . '/../../../tests/static/framework'))); define('USAGE', <<<USAGE php -f sanity.php -c <config_file> [-w <dir>] [-v] -c <config_file> path to configuration file with rules and white list [-w <dir>] use specified working dir instead of current [-v] verbose mode USAGE ); $shortOpts = 'c:w:v'; $options = getopt($shortOpts); if (!isset($options['c'])) { print USAGE; exit(1); } $configFile = $options['c']; $workingDir = __DIR__;
* @package DI * @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 */
* to license@magentocommerce.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade Magento to newer * 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 js * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ define('RELATIVE_APP_ROOT', '../../..'); require __DIR__ . '/../../../app/autoload.php'; Magento_Autoload_IncludePath::addIncludePath(realpath(RELATIVE_APP_ROOT . '/lib')); $userConfig = normalize('jsTestDriver.php'); $defaultConfig = normalize('jsTestDriver.php.dist'); $configFile = file_exists($userConfig) ? $userConfig : $defaultConfig; $config = (require $configFile); if (isset($config['JsTestDriver'])) { $jsTestDriver = $config['JsTestDriver']; } else { echo "Value for the 'JsTestDriver' configuration parameter is not specified." . PHP_EOL; showUsage(); } if (!file_exists($jsTestDriver)) { reportError('JsTestDriver jar file does not exist: ' . $jsTestDriver); } if (isset($config['Browser'])) { $browser = $config['Browser'];
* to license@magentocommerce.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * * @category Tools * @package system_configuration * @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) */ $rootDir = realpath(__DIR__ . '../../../..'); require __DIR__ . '/../../../app/autoload.php'; Magento_Autoload_IncludePath::addIncludePath(array($rootDir . '/lib', $rootDir . '/dev')); $defaultReportFile = 'report.log'; try { $options = new Zend_Console_Getopt(array('mode|w' => "Application mode. Preview mode is default. If set to 'write' - file system is updated", 'output|f-w' => "Report output type. Report is flushed to console by default." . "If set to 'file', report is written to file /log/report.log")); $writerFactory = new Tools_Migration_System_Writer_Factory(); $fileManager = new Tools_Migration_System_FileManager(new Tools_Migration_System_FileReader(), $writerFactory->getWriter($options->getOption('mode'))); $loggerFactory = new Tools_Migration_System_Configuration_Logger_Factory(); $logger = $loggerFactory->getLogger($options->getOption('output'), $defaultReportFile, $fileManager); $generator = new Tools_Migration_System_Configuration_Generator(new Tools_Migration_System_Configuration_Formatter(), $fileManager, $logger); $fieldMapper = new Tools_Migration_System_Configuration_Mapper_Field(); $groupMapper = new Tools_Migration_System_Configuration_Mapper_Group($fieldMapper); $sectionMapper = new Tools_Migration_System_Configuration_Mapper_Section($groupMapper); $tabMapper = new Tools_Migration_System_Configuration_Mapper_Tab(); $mapper = new Tools_Migration_System_Configuration_Mapper($tabMapper, $sectionMapper); $parser = new Tools_Migration_System_Configuration_Parser(); $reader = new Tools_Migration_System_Configuration_Reader($fileManager, $parser, $mapper);
<?php /** * Magento * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@magentocommerce.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento * @package Magento * @subpackage static_tests * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ require __DIR__ . '/../../../../app/autoload.php'; Magento_Autoload_IncludePath::addIncludePath(array(__DIR__, dirname(__DIR__) . '/testsuite')); Utility_Files::init(new Utility_Files(realpath(__DIR__ . '/../../../..')));
<?php /** * Magento * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@magentocommerce.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento * @package Magento * @subpackage unit_tests * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $rootDir = realpath(__DIR__ . '/../../../../../../..'); require __DIR__ . '/../../../../../../../app/autoload.php'; Magento_Autoload_IncludePath::addIncludePath(array($rootDir . '/lib/', $rootDir . '/dev/tests/unit/framework/', $rootDir . '/app/code/core/'));
* Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento * @package Magento * @subpackage integration_tests * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ require_once __DIR__ . '/../../../../app/bootstrap.php'; require_once __DIR__ . '/../../static/testsuite/Utility/Classes.php'; $testsBaseDir = dirname(__DIR__); $testsTmpDir = "{$testsBaseDir}/tmp"; $magentoBaseDir = realpath("{$testsBaseDir}/../../../"); Magento_Autoload_IncludePath::addIncludePath(array("{$testsBaseDir}/framework", "{$testsBaseDir}/testsuite")); if (defined('TESTS_LOCAL_CONFIG_FILE') && TESTS_LOCAL_CONFIG_FILE) { $localXmlFile = "{$testsBaseDir}/" . TESTS_LOCAL_CONFIG_FILE; if (!is_file($localXmlFile) && substr($localXmlFile, -5) != '.dist') { $localXmlFile .= '.dist'; } } else { $localXmlFile = "{$testsBaseDir}/etc/local-mysql.xml"; } if (defined('TESTS_GLOBAL_CONFIG_FILES') && TESTS_GLOBAL_CONFIG_FILES) { $globalEtcFiles = TESTS_GLOBAL_CONFIG_FILES; } else { $globalEtcFiles = "../../../app/etc/*.xml"; } if (defined('TESTS_MODULE_CONFIG_FILES') && TESTS_MODULE_CONFIG_FILES) { $moduleEtcFiles = TESTS_MODULE_CONFIG_FILES;
* * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@magentocommerce.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento * @package unit_tests * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ require __DIR__ . '/../../../../app/code/core/Mage/Core/functions.php'; require __DIR__ . '/../../../../app/autoload.php'; Magento_Autoload_IncludePath::addIncludePath(array(__DIR__, realpath(__DIR__ . '/../testsuite'), realpath(__DIR__ . '/../../../../app'), realpath(__DIR__ . '/../../../../app/code/core'), realpath(__DIR__ . '/../../../../lib'))); define('TESTS_TEMP_DIR', dirname(__DIR__) . DIRECTORY_SEPARATOR . 'tmp'); if (is_dir(TESTS_TEMP_DIR)) { Varien_Io_File::rmdirRecursive(TESTS_TEMP_DIR); } mkdir(TESTS_TEMP_DIR); Mage::setIsSerializable(false);
<?php /** * Magento * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@magentocommerce.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento * @package Magento * @subpackage integration_tests * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $rootDir = realpath(__DIR__ . '/../../../../../../../'); require_once $rootDir . '/app/bootstrap.php'; Magento_Autoload_IncludePath::addIncludePath($rootDir . '/dev/tests/integration/framework'); Mage::initializeObjectManager(null, new Magento_Test_ObjectManager());
* * Magento * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@magentocommerce.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento * @package performance_tests * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $testsBaseDir = realpath(__DIR__ . '/..'); $magentoBaseDir = realpath($testsBaseDir . '/../../../'); require_once "{$magentoBaseDir}/app/bootstrap.php"; Magento_Autoload_IncludePath::addIncludePath("{$testsBaseDir}/framework"); $bootstrap = new Magento_Performance_Bootstrap($testsBaseDir, $magentoBaseDir); $bootstrap->cleanupReports(); return $bootstrap->getConfig();
<?php /** * Magento * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@magentocommerce.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento * @package performance_tests * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $magentoBaseDir = realpath(__DIR__ . '/../../../../../../../'); require_once "{$magentoBaseDir}/app/bootstrap.php"; Magento_Autoload_IncludePath::addIncludePath("{$magentoBaseDir}/dev/tests/performance/framework");