0

I have the directories: ProjectName/Module/Application and ProjectName/Module/MyApi

I used Laminas. And when I run in cmd:

./vendor/bin/phpunit.bat --coverage-html=test/reports --whitelist=module\Application\src\*

the response is:

PHPUnit 8.5.2-60-ga07c36460 by Sebastian Bergmann and contributors.

..................                                                18 / 18 (100%)

Time: 1.28 seconds, Memory: 10.00 MB

OK (18 tests, 94 assertions)

Generating code coverage report in HTML format ... done [136 ms]
PS C:\xampp\htdocs\ProjectName> ./vendor/bin/phpunit.bat --coverage-html=test/reports --whitelist=module\Application\src\*                                                        PHPUnit 8.5.2-60-ga07c36460 by Sebastian Bergmann and contributors.

..................                                                18 / 18 (100%)

Time: 1.55 seconds, Memory: 10.00 MB

OK (40 tests, 102 assertions)

Generating code coverage report in HTML format ... done [518 ms]

but if I run:

./vendor/bin/phpunit.bat --coverage-html=test/reports --whitelist=module\MyApi\src\*

the response is only:

PHPUnit 8.5.2-60-ga07c36460 by Sebastian Bergmann and contributors.

and nothing else.

I configured correctly phpdbg, phpunit.xml and bootstrap.php, in fact the code coverage is generated correctly in module Application, although it is 0%.

In composer.json also also added:

  "autoload-dev": {
    "psr-4": {
      "ApplicationTest\\": "module/Application/test/",
      "ProjectNameSpace\\Domain\\Tests\\": "module/MyApi/src/V1/Domain/test/"
    },

but I don't understand why this happens. thanks in advance.

  • Why do you use a development version of PHPUnit? – Sebastian Bergmann Mar 31 '20 at 05:18
  • I was able to solve the problem, it was a class in my project that contained an error, so this file could not be loaded in CodeCoverage :: initializeData(). Sebastian Bergmann, thanks for the comment about phpunit version, this is because for other reasons in my composer.json I have "minimum-stability": "dev", I will already correct that. – warlock_apprentice Mar 31 '20 at 17:20

0 Answers0