Commit 44f309be authored by Ivan Chepurnyi's avatar Ivan Chepurnyi

Merge pull request #102 from cmuench/patch-2

Fix for autoloader problems with Varien_Autoload and PHPUnit extension
parents deb7b7ad c7141393
...@@ -22,3 +22,14 @@ $_SERVER['SCRIPT_FILENAME'] = $_baseDir . DS . 'index.php'; ...@@ -22,3 +22,14 @@ $_SERVER['SCRIPT_FILENAME'] = $_baseDir . DS . 'index.php';
Mage::app('admin'); Mage::app('admin');
Mage::getConfig()->init(); Mage::getConfig()->init();
spl_autoload_unregister(array(\Varien_Autoload::instance(), 'autoload'));
spl_autoload_register(function ($classname) {
$classname = ltrim($classname, "\\");
preg_match('/^(.+)?([^\\\\]+)$/U', $classname, $match);
$classname = str_replace("\\", "/", $match[1])
. str_replace(array("\\", "_"), "/", $match[2])
. ".php";
@include_once $classname;
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment