Yii 1.x support broken with 2.x.x release, worked in 1.x.x
Closed this issue · 3 comments
Just upgraded from AspectMock 1.0.0 to 2.0.0 and my phpunit tests are not running anymore. The tests exit with the following error, which just occurs right after $kernel->loadFile('YourAutoloader.php');
(as described in https://github.com/Codeception/AspectMock#with-custom-autoloader)
PHP Fatal error: Uncaught InvalidArgumentException: Class YiiBase was not found by locator in /vagrant/tests/vendor/goaop/parser-reflection/src/ReflectionEngine.php:89
Stack trace:
# 0 /vagrant/tests/vendor/goaop/parser-reflection/src/ReflectionEngine.php(104): Go\ParserReflection\ReflectionEngine::locateClassFile('YiiBase')
# 1 /vagrant/tests/vendor/goaop/parser-reflection/src/ReflectionClass.php(45): Go\ParserReflection\ReflectionEngine::parseClass('YiiBase')
# 2 /vagrant/tests/vendor/goaop/parser-reflection/src/Traits/ReflectionClassLikeTrait.php(448): Go\ParserReflection\ReflectionClass->__construct('YiiBase')
# 3 /vagrant/tests/vendor/goaop/parser-reflection/src/Traits/ReflectionClassLikeTrait.php(917): Go\ParserReflection\ReflectionClass->getParentClass()
# 4 /vagrant/tests/vendor/goaop/parser-reflection/src/Traits/ReflectionClassLikeTrait.php(320): Go\ParserReflection\ReflectionClass->recursiveCollect(Object(Closure))
# 5 /vagrant/tests/vendor/goaop/parser-reflection/src/Traits/ReflectionClassLikeTrait.php(306): Go\ParserRef in /vagrant/tests/vendor/goaop/parser-reflection/src/ReflectionEngine.php on line 89
Downgrading to AspectMock 1.0.0 solves the issue. Are there any additional configurations needed for the new reflection parser in 2.0.0?
Environment:
- PHP 7.0.9
- PHPUnit 5.5.0
- Yii 1.1.17
i believe there are some issues with custom autoloaders
i had to switch to composer autoloader, in Yii2 it was simple adding PSR-0 rules to composer.json and not using Yii way of overwriting classes like
Yii::$classMap[\yii\helpers\Html::class] = __DIR__ . '/../../common/yii/Html.php';
i dont know if it will help you with yii1
hi, do your issue has been solved? the same problem happens to me. any idea is good to me,thks
@DavertMik Why is this issue closed? It still doesn't work with the 3.x release created today.