-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: phpunit coverage report causes Cannot declare class Config\App, because the name is already in use
#4114
Comments
I cannot replicate this. I used your reproduction steps.
|
@paulbalandan Do you have generated coverage report? If you generate coverage report, the output would be like this:
|
…name is already in use` codeigniter4/CodeIgniter4#4114
Yes. With code coverage. And same output with yours. |
it should already fixed in latest develop #3772 |
@kenjis I just re-tried, and I can reproduce in PHP 7.4: ➜ ci4app vendor/bin/phpunit
PHPUnit 8.5.14 by Sebastian Bergmann and contributors.
PHP Fatal error: Cannot declare class Config\App, because the name is already in use in /Users/samsonasik/www/ci4app/app/Config/App.php on line 5
Fatal error: Cannot declare class Config\App, because the name is already in use in /Users/samsonasik/www/ci4app/app/Config/App.php on line 5 |
I still cannot replicate this on Windows even using the latest develop.
|
set |
I don't know it matters or not. I use Xdebug 3.0.
|
…n running vendor/bin/phpunit
Yes, I used Xdebug 3 as well, and set processUncoveredFilesFromWhitelist="false" in phpunit.xml somehow fix the issue |
…nning vendor/bin/phpunit
…n running vendor/bin/phpunit
@samsonasik Setting
So I think work around excluding |
Ok, that seems that setting not a solution. |
somehow, change testsuite to tests fix it:
|
…or on running PHPUnit
…n running PHPUnit
[Develop] Fixes #4114 Cannot declare class Config\App error on running PHPUnit
[4.1] Fixes #4114 Cannot declare class Config\App error on running PHPUnit
bro this worked for me too !! thanks !! |
@rsampat-consultant the solution is change test suit name see #4158 |
Thank you ! |
Sharing my I found the problem to the same issue. I was using Mockery in the test, and the same class was later crashing the phpunit code coverage report generator. |
@thevikas i had the same problem due to a mock. |
Describe the bug
PHPUnit coverage reporting causes:
CodeIgniter 4 version
develop
branchAffected module(s)
Which package or class is the bug in, if known.
Expected behavior, and steps to reproduce if appropriate
No errors.
Context
The text was updated successfully, but these errors were encountered: