1

I have setup phpunit using composer to do some testing in Magento.

And after the setup I see the following lines added to my Mage.php file.

/** AUTOLOADER PATCH **/
if (file_exists($autoloaderPath = BP . DS . 'vendor/autoload.php') ||
    file_exists($autoloaderPath = BP . DS . '../vendor/autoload.php')
) {
    require $autoloaderPath;
}
/** AUTOLOADER PATCH **/

What I want to know is what is the purpose of this patch, and can we do anything without changing our Mage.php file.

My composer.json, which I used for installing phpunit is as follows :

{
"name": "company)name/api",
"type": "project",
"require": {
    "magento-hackathon/magento-composer-installer": "*"
},
"require-dev": {
    "phpunit/phpunit": "^7.5",
    "phpunit/php-invoker": "^2.0"
},
"extra": {
    "magento-root-dir": "/var/www/html/parent_project_dir"
},
"config": {
    "platform": {
        "ext-pcntl": "7.2",
        "ext-posix": "7.2"
    }
}    

}

PS : I am using Magento 1.9.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.