英文:
PHPUnit and Xdebug coverage for abstract classes are always 0%
问题
以下是翻译好的内容:
"Repository for this concrete issue: goph-R/dynart-coverage-test"
"The issue is as in the subject: for abstract classes I always get 0% coverage whatever I do."
"I created a TheAbstractClass
and a related TheAbstractClassTest
"
"In the test I had to instantiate the abstract class, so I created a TheTestableClass
for it and it extends the TheAbstractClass
. I tried this with the PHPUnit's createMockForAbstractClass()
the same issue happens."
"After I run the tests, everything will PASS, but the coverage report for TheAbstractClass
is 0%, but for TheConcreteClass
it is 100%."
"What I do wrong, how could I have coverage for my abstract classes?"
"My configuration:"
- Windows 10
- PHP 7.4.3
- Xdebug 2.8.1
- PHPUnit 9.6.6
英文:
Repository for this concrete issue: goph-R/dynart-coverage-test
The issue is as in the subject: for abstract classes I always get 0% coverage whatever I do.
- I created a
TheAbstractClass
and a relatedTheAbstractClassTest
- In the test I had to instantiate the abstract class, so I created a
TheTestableClass
for it and it extends theTheAbstractClass
. I tried this with the PHPUnit'screateMockForAbstractClass()
the same issue happens.
After I run the tests, everything will PASS, but the coverage report for TheAbstractClass
is 0%, but for TheConcreteClass
it is 100%.
What I do wrong, how could I have coverage for my abstract classes?
My configuration:
-
Windows 10
-
PHP 7.4.3
-
Xdebug 2.8.1
-
PHPUnit 9.6.6
答案1
得分: 0
"-dauto_prepend_file=xdebug_filter.php"
请移除此部分,因为phpunit.xml.dist
文件已经提供了代码覆盖率目录。
英文:
The command line test invocation includes this argument:
-dauto_prepend_file=xdebug_filter.php
Remove this, you don't need it, as the code coverage directory is already being provided by the phpunit.xml.dist
file.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论