Skip to content

Can't find app/Mage.php when package is installed through Composer #7

Description

@agereteam

I add "digitalpianism/testframework": "dev-master" to my composer.json and do all instructions in README, but when I try to run my test from console I get error

$ phpunit -c vendor/popov/magento-magmi-import/app/code/local/Popov/Magmi/Test/phpunit.xml

Warning: require_once(D:\WebServer\git\art-market\vendor\digitalpianism\testframework\lib\DigitalPianism\TestFramework\Helper/../../../../app/Mage.php): failed to open stream: No such file or directory in D:\WebServer\git\art-market\vendor\digitalpianism\testfr
amework\lib\DigitalPianism\TestFramework\Helper\Magento.php on line 39

Fatal error: require_once(): Failed opening required 'D:\WebServer\git\art-market\vendor\digitalpianism\testframework\lib\DigitalPianism\TestFramework\Helper/../../../../app/Mage.php' (include_path='.;d:/openserver/modules/php/PHP-7-x64;d:/openserver/modules/ph
p/PHP-7-x64/PEAR/pear') in D:\WebServer\git\art-market\vendor\digitalpianism\testframework\lib\DigitalPianism\TestFramework\Helper\Magento.php on line 39

My bootstrap.php look like this

require __DIR__ . '/../../../../../../../../../htdocs/lib/DigitalPianism/TestFramework/Helper/Magento.php';
DigitalPianism_TestFramework_Helper_Magento::bootstrap();

Problem is that code in vendor/digitalpianism/testframework/lib/DigitalPianism/TestFramework/Helper/Magento.php use path relative to original Magento directory lib/ but in my case this is path relative to Composer directory vendor/.
As possible solution can to use package https://github.com/joshdifabio/composed for getting variable magento-root-dir from composer.json and based on this variable get path to app/Mage.php. But I didn't do that, maybe you have better solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions