Open agereteam opened 7 years ago
@agereteam is it similar to this issue ? https://github.com/digitalpianism/testframework/pull/6 not sure if we can do shell commands with composer
@digitalpianism this is like but not the same. I really need links in my composer.json. I develop modules and copy/past changed files every time is horrible.
@agereteam can you try to edit the following file: https://github.com/digitalpianism/testframework/blob/master/lib/DigitalPianism/TestFramework/Helper/Magento.php
And replace:
require_once __DIR__.'/../../../../app/Mage.php';
With:
$dirName = dirname(__FILE__, 7);
if (preg_match('/vendor/', $dirName)) {
$dirName = dirname(__FILE__, 8);
} else {
$dirName = dirname(__FILE__, 5);
}
require_once($dirName . '/app/Mage.php');
And let me know if that works. I haven't fully tested that it's hacky but in theory it should work
No, this didn't help. I got this variables in xDebug https://www.screencast.com/t/jnB9zo0I3K Test is running with next commands. Both give the same result
$ phpunit -c vendor/popov/magento-magmi-import/app/code/local/Popov/Magmi/Test/phpunit.xml
// or
$ phpunit -c htdocs/app/code/local/Popov/Magmi/Test/phpunit.xml
I have another idea. Script can take over all siblings directories of vendor
and search file app/Mage.php
. In which directory this file will be find, then this is root project directory.
@agereteam maybe this PR might help you: https://github.com/digitalpianism/testframework/pull/9
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 errorMy
bootstrap.php
look like thisProblem is that code in
vendor/digitalpianism/testframework/lib/DigitalPianism/TestFramework/Helper/Magento.php
use path relative to original Magento directorylib/
but in my case this is path relative to Composer directoryvendor/
. As possible solution can to use package https://github.com/joshdifabio/composed for getting variablemagento-root-dir
fromcomposer.json
and based on this variable get path toapp/Mage.php
. But I didn't do that, maybe you have better solution.