-
- Notifications
You must be signed in to change notification settings - Fork 436
Open
Description
Problem
When creating a controller with make:controller
or a crud with make:crud
or a registration form with make:registration-form
or a password reset system with make:reset-password
or a form login system with make:security:form-login
, at the following question:
Do you want to generate PHPUnit tests? [Experimental] (yes/no) [no]:
If we don't have PHPUnit installed, we get the following error:
In KernelTestCase.php line 25: Attempted to load class "TestCase" from namespace "PHPUnit\Framework". Did you forget a "use" statement for another namespace?
→ It throws an error and creates neither the controller nor the tests.
Steps to reproduce
-
Do not have PHPUnit installed
-
Create a controller with the maker bundle:
php bin/console make:controller
-
Answer “yes” to the following question:
Do you want to generate PHPUnit tests? [Experimental] (yes/no) [no]: > yes
-
Get the following error:
In KernelTestCase.php line 25: Attempted to load class "TestCase" from namespace "PHPUnit\Framework". Did you forget a "use" statement for another namespace?
Screenshots
Versions
Symfony 7.3.1
Symfony MakerBundle 1.64.0
composer.json
:
{ "type": "project", "license": "proprietary", "minimum-stability": "stable", "prefer-stable": true, "require": { "php": ">=8.2", "ext-ctype": "*", "ext-iconv": "*", "symfony/console": "7.3.*", "symfony/dotenv": "7.3.*", "symfony/flex": "^2", "symfony/framework-bundle": "7.3.*", "symfony/runtime": "7.3.*", "symfony/yaml": "7.3.*" }, "require-dev": { "symfony/maker-bundle": "^1.64" }, "config": { "allow-plugins": { "php-http/discovery": true, "symfony/flex": true, "symfony/runtime": true }, "bump-after-update": true, "sort-packages": true }, "autoload": { "psr-4": { "App\\": "src/" } }, "autoload-dev": { "psr-4": { "App\\Tests\\": "tests/" } }, "replace": { "symfony/polyfill-ctype": "*", "symfony/polyfill-iconv": "*", "symfony/polyfill-php72": "*", "symfony/polyfill-php73": "*", "symfony/polyfill-php74": "*", "symfony/polyfill-php80": "*", "symfony/polyfill-php81": "*", "symfony/polyfill-php82": "*" }, "scripts": { "auto-scripts": { "cache:clear": "symfony-cmd", "assets:install %PUBLIC_DIR%": "symfony-cmd" }, "post-install-cmd": [ "@auto-scripts" ], "post-update-cmd": [ "@auto-scripts" ] }, "conflict": { "symfony/symfony": "*" }, "extra": { "symfony": { "allow-contrib": false, "require": "7.3.*" } } }
composer show symfony/maker-bundle
:
name : symfony/maker-bundle descrip. : Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code. keywords : code generator, dev, generator, scaffold, scaffolding versions : * v1.64.0 released : 2025-06-23, 2 weeks ago type : symfony-bundle license : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText homepage : https://symfony.com/doc/current/bundles/SymfonyMakerBundle/index.html source : [git] https://github.com/symfony/maker-bundle.git c86da84640b0586e92aee2b276ee3638ef2f425a dist : [zip] https://api.github.com/repos/symfony/maker-bundle/zipball/c86da84640b0586e92aee2b276ee3638ef2f425a c86da84640b0586e92aee2b276ee3638ef2f425a names : symfony/maker-bundle support issues : https://github.com/symfony/maker-bundle/issues source : https://github.com/symfony/maker-bundle/tree/v1.64.0 autoload psr-4 Symfony\Bundle\MakerBundle\ => src/ requires doctrine/inflector ^2.0 nikic/php-parser ^5.0 php >=8.1 symfony/config ^6.4|^7.0 symfony/console ^6.4|^7.0 symfony/dependency-injection ^6.4|^7.0 symfony/deprecation-contracts ^2.2|^3 symfony/filesystem ^6.4|^7.0 symfony/finder ^6.4|^7.0 symfony/framework-bundle ^6.4|^7.0 symfony/http-kernel ^6.4|^7.0 symfony/process ^6.4|^7.0 requires (dev) composer/semver ^3.0 doctrine/doctrine-bundle ^2.5.0 doctrine/orm ^2.15|^3 symfony/http-client ^6.4|^7.0 symfony/phpunit-bridge ^6.4.1|^7.0 symfony/security-core ^6.4|^7.0 symfony/security-http ^6.4|^7.0 symfony/yaml ^6.4|^7.0 twig/twig ^3.0|^4.x-dev conflicts doctrine/doctrine-bundle <2.10 doctrine/orm <2.15
composer/lock
:
{ "name": "symfony/maker-bundle", "version": "v1.64.0", }
Related versions / commits / PRs
Metadata
Metadata
Assignees
Labels
No labels