Commit acc11d7b authored by Ivan Chepurnyi's avatar Ivan Chepurnyi

! Fix Varien_Autoloader problem

parent cd16c12f
......@@ -9,17 +9,18 @@ env:
before_script:
# Fixing Magento hackathon installer
- mkdir -p tests/magento
# Installing required composer packages
- composer update --dev
- mkdir bin/ && wget -O bin/mage-ci -q https://raw.github.com/EcomDev/MageCI/master/bin/mage-ci --no-check-certificate
- chmod +x bin/mage-ci
# Installing magento version with prepared DB dump
- vendor/bin/mage-ci install tests/magento $MAGE magento -c -t -r http://mage-ci.ecomdev.org
- bin/mage-ci install tests/magento $MAGE magento -c -t -r http://mage-ci.ecomdev.org
# Installing EcomDev_PHPUnit module
- vendor/bin/mage-ci install-module tests/magento $(pwd)
- bin/mage-ci install-module tests/magento $(pwd)
# Configuring EcomDev_PHPUnit module
- CURRENT_DIR=$(pwd)
- cd tests/magento/shell
- php ecomdev-phpunit.php -a magento-config --db-name magento --same-db 1 --base_url http://test.magento.com/
- php ecomdev-phpunit.php -a change-status --enable
- php ecomdev-phpunit.php -a fix-autoloader
- cd $CURRENT_DIR
script:
- vendor/bin/mage-ci phpunit tests/magento --colors --coverage-text
......@@ -8,19 +8,9 @@
"magento-hackathon/magento-composer-installer": "*",
"phpunit/phpunit": "3.7.*"
},
"require-dev": {
"ecomdev/mage-ci": "dev-master"
},
"repositories": [{
"type": "composer",
"url": "http://packages.firegento.com"
}],
"authors":[
{
"name":"Ivan Chepurnyi"
}
],
"extra": {
"magento-root-dir": "tests/magento"
}
]
}
......@@ -114,6 +114,8 @@ Defined actions:
change-status Changes status of EcomDev_PHPUnitTest module, that contains built in supplied tests
--enable Used to determine the status of it. If not specified, it will be disabled
fix-autoloader Patches Varien_Autoload class to suppress include warning, that breaks class_exists().
USAGE;
}
......@@ -156,6 +158,9 @@ USAGE;
$this->_cleanCache();
echo "EcomDev_PHPUnitTest module status was changed\n";
break;
case 'fix-autoloader':
$this->_fixAutoloader();
break;
default:
$this->_showHelp();
break;
......@@ -299,7 +304,27 @@ USAGE;
printf("Saved updated configuration at %s\n", $localXml);
}
}
/**
* Fixes Varien_Autoloader problem on phpunit test cases
*
*
*/
protected function _fixAutoloader()
{
$autoloaderFile = $this->getArg('project') . DIRECTORY_SEPARATOR . 'lib/Varien/Autoloader.php';
file_put_contents(
$autoloaderFile,
str_replace(
'return include $classFile;',
'return @include $classFile;',
file_get_contents($autoloaderFile)
)
);
echo "Varien_Autoloader was patched\n";
}
}
$shell = new EcomDev_PHPUnit_Install();
$shell->run();
\ No newline at end of file
$shell->run();
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