예제 #1
0
 * 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) 2012 Magento 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';
define('TESTS_TEMP_DIR', dirname(__DIR__) . DIRECTORY_SEPARATOR . 'tmp');
$includePaths = array("./framework", './testsuite', '../../../app/', '../../../app/code/core', '../../../lib', get_include_path());
set_include_path(implode(PATH_SEPARATOR, $includePaths));
spl_autoload_register('magentoAutoloadForUnitTests');
function magentoAutoloadForUnitTests($class)
{
    $file = str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';
    foreach (explode(PATH_SEPARATOR, get_include_path()) as $path) {
        $fileName = $path . DIRECTORY_SEPARATOR . $file;
        if (file_exists($fileName)) {
            include $file;
            if (class_exists($class, false) || interface_exists($class, false)) {
                return true;
            }
        }
    }
    return false;
}
$tmpDir = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'tmp';
$instance = new Magento_Test_Environment($tmpDir);
Magento_Test_Environment::setInstance($instance);
$instance->cleanTmpDir()->cleanTmpDirOnShutdown();
예제 #2
0
 /**
  * @depends testGetInstance
  */
 public function testSetGetInstance()
 {
     Magento_Test_Environment::setInstance($this->_environment);
     $this->assertSame($this->_environment, Magento_Test_Environment::getInstance());
 }