I trying to make stub by Stub::make() method
But i get error: Class "PHPUnit\Framework\MockObject\Generator" not found
Console output:
[Error] Class "PHPUnit\Framework\MockObject\Generator" not found
/var/www/html/app/vendor/codeception/stub/src/Stub.php:436
/var/www/html/app/vendor/codeception/stub/src/Stub.php:417
/var/www/html/app/vendor/codeception/stub/src/Stub.php:90
/var/www/html/app/tests/functional/CurrencyRateServiceCest.php:45
/var/www/html/app/tests/functional/CurrencyRateServiceCest.php:26
/var/www/html/app/vendor/codeception/codeception/src/Codeception/Lib/Di.php:130
/var/www/html/app/vendor/codeception/codeception/src/Codeception/Test/Cest.php:184
/var/www/html/app/vendor/codeception/codeception/src/Codeception/Test/Cest.php:200
/var/www/html/app/vendor/codeception/codeception/src/Codeception/Test/Cest.php:129
/var/www/html/app/vendor/codeception/codeception/src/Codeception/Test/Test.php:168
/var/www/html/app/vendor/codeception/codeception/src/Codeception/Suite.php:130
/var/www/html/app/vendor/codeception/codeception/src/Codeception/SuiteManager.php:148
/var/www/html/app/vendor/codeception/codeception/src/Codeception/Codecept.php:260
/var/www/html/app/vendor/codeception/codeception/src/Codeception/Codecept.php:216
/var/www/html/app/vendor/codeception/codeception/src/Codeception/Command/Run.php:435
/var/www/html/app/vendor/symfony/console/Command/Command.php:326
/var/www/html/app/vendor/symfony/console/Application.php:1075
/var/www/html/app/vendor/symfony/console/Application.php:324
/var/www/html/app/vendor/symfony/console/Application.php:175
/var/www/html/app/vendor/codeception/codeception/src/Codeception/Application.php:112
/var/www/html/app/vendor/codeception/codeception/app.php:45
/var/www/html/app/vendor/codeception/codeception/app.php:46
/var/www/html/app/vendor/codeception/codeception/codecept:7
/var/www/html/app/vendor/bin/codecept:119
/var/www/html/app/codecept:4
This is because you have "phpunit/phpunit": "^9.5.20 || ^10.0" in your composer.json. Because of this, when i install codeception, the 10th version of phpunit is installed. But in this version of phpunit PHPUnit\Framework\MockObject\Generator has been moved to PHPUnit\Framework\MockObject\Generator\Generator. If I specificaly add to my composer.json "phpunit/phpunit": "^9.5.20" to force the use of the 9th one, then everything starts working properly.
Details
- Codeception version: 5.0.x-dev
- PHP Version: 8.1
- Operating System: php:8.1-apache docker image
- Installation type: Composer
- List of installed packages:
Non-working variant:
{
"require-dev": {
"yiisoft/yii2-debug": "dev-master",
"yiisoft/yii2-gii": "dev-master",
"jetbrains/phpstorm-attributes": "dev-master",
"squizlabs/php_codesniffer": "*",
"codeception/codeception": "5.0.x-dev",
"codeception/module-phpbrowser": "*",
"codeception/module-asserts": "*",
"codeception/module-yii2": "dev-master",
"codeception/module-filesystem": "dev-master",
"codeception/module-db": "dev-master",
"vlucas/phpdotenv": "^5.5@dev",
"codeception/module-datafactory": "dev-master",
"league/factory-muffin": "^3.3",
"league/factory-muffin-faker": "^2.3"
},
}
Working variant:
{
"require-dev": {
"yiisoft/yii2-debug": "dev-master",
"yiisoft/yii2-gii": "dev-master",
"jetbrains/phpstorm-attributes": "dev-master",
"squizlabs/php_codesniffer": "*",
"codeception/codeception": "5.0.x-dev",
"codeception/module-phpbrowser": "*",
"codeception/module-asserts": "*",
"codeception/module-yii2": "dev-master",
"codeception/module-filesystem": "dev-master",
"codeception/module-db": "dev-master",
"vlucas/phpdotenv": "^5.5@dev",
"codeception/module-datafactory": "dev-master",
"league/factory-muffin": "^3.3",
"league/factory-muffin-faker": "^2.3",
"phpunit/phpunit": "^9.5.20"
},
}
actor: FunctionalTester
modules:
enabled:
- Asserts
- Yii2:
part: [orm, email, fixtures]
- Db
- DataFactory
extensions:
enabled: [app\tests\support\DumpExtension]
I trying to make stub by Stub::make() method
But i get error: Class "PHPUnit\Framework\MockObject\Generator" not found
Console output:
[Error] Class "PHPUnit\Framework\MockObject\Generator" not found /var/www/html/app/vendor/codeception/stub/src/Stub.php:436 /var/www/html/app/vendor/codeception/stub/src/Stub.php:417 /var/www/html/app/vendor/codeception/stub/src/Stub.php:90 /var/www/html/app/tests/functional/CurrencyRateServiceCest.php:45 /var/www/html/app/tests/functional/CurrencyRateServiceCest.php:26 /var/www/html/app/vendor/codeception/codeception/src/Codeception/Lib/Di.php:130 /var/www/html/app/vendor/codeception/codeception/src/Codeception/Test/Cest.php:184 /var/www/html/app/vendor/codeception/codeception/src/Codeception/Test/Cest.php:200 /var/www/html/app/vendor/codeception/codeception/src/Codeception/Test/Cest.php:129 /var/www/html/app/vendor/codeception/codeception/src/Codeception/Test/Test.php:168 /var/www/html/app/vendor/codeception/codeception/src/Codeception/Suite.php:130 /var/www/html/app/vendor/codeception/codeception/src/Codeception/SuiteManager.php:148 /var/www/html/app/vendor/codeception/codeception/src/Codeception/Codecept.php:260 /var/www/html/app/vendor/codeception/codeception/src/Codeception/Codecept.php:216 /var/www/html/app/vendor/codeception/codeception/src/Codeception/Command/Run.php:435 /var/www/html/app/vendor/symfony/console/Command/Command.php:326 /var/www/html/app/vendor/symfony/console/Application.php:1075 /var/www/html/app/vendor/symfony/console/Application.php:324 /var/www/html/app/vendor/symfony/console/Application.php:175 /var/www/html/app/vendor/codeception/codeception/src/Codeception/Application.php:112 /var/www/html/app/vendor/codeception/codeception/app.php:45 /var/www/html/app/vendor/codeception/codeception/app.php:46 /var/www/html/app/vendor/codeception/codeception/codecept:7 /var/www/html/app/vendor/bin/codecept:119 /var/www/html/app/codecept:4This is because you have
"phpunit/phpunit": "^9.5.20 || ^10.0"in your composer.json. Because of this, when i install codeception, the 10th version of phpunit is installed. But in this version of phpunitPHPUnit\Framework\MockObject\Generatorhas been moved toPHPUnit\Framework\MockObject\Generator\Generator. If I specificaly add to my composer.json"phpunit/phpunit": "^9.5.20"to force the use of the 9th one, then everything starts working properly.Details
{ "require-dev": { "yiisoft/yii2-debug": "dev-master", "yiisoft/yii2-gii": "dev-master", "jetbrains/phpstorm-attributes": "dev-master", "squizlabs/php_codesniffer": "*", "codeception/codeception": "5.0.x-dev", "codeception/module-phpbrowser": "*", "codeception/module-asserts": "*", "codeception/module-yii2": "dev-master", "codeception/module-filesystem": "dev-master", "codeception/module-db": "dev-master", "vlucas/phpdotenv": "^5.5@dev", "codeception/module-datafactory": "dev-master", "league/factory-muffin": "^3.3", "league/factory-muffin-faker": "^2.3" }, }{ "require-dev": { "yiisoft/yii2-debug": "dev-master", "yiisoft/yii2-gii": "dev-master", "jetbrains/phpstorm-attributes": "dev-master", "squizlabs/php_codesniffer": "*", "codeception/codeception": "5.0.x-dev", "codeception/module-phpbrowser": "*", "codeception/module-asserts": "*", "codeception/module-yii2": "dev-master", "codeception/module-filesystem": "dev-master", "codeception/module-db": "dev-master", "vlucas/phpdotenv": "^5.5@dev", "codeception/module-datafactory": "dev-master", "league/factory-muffin": "^3.3", "league/factory-muffin-faker": "^2.3", "phpunit/phpunit": "^9.5.20" }, }