automatix
automatix

Reputation: 14552

PHPUnit report marks untested methods as tested

I wrote two simple model classes in my Zend Framework 2 application: Catalog\Model\City Catalog\Model\CityTyble. For none of these any unit tests have been written yet. But when I create a report (user@machine:/path/to/project/module/Catalog/test# phpunit --coverage-html ./report), one of the classes is shown as tested:

enter image description here

...and the methods:

enter image description here

There are no test method for this class, not even the a class exists.

What is here wrong? Why is this untested classe / are these untested methods shown as tested?

Upvotes: 1

Views: 343

Answers (1)

Jose Armesto
Jose Armesto

Reputation: 13799

This report does not exactly mean that the code is being tested. The report only says that those lines are being executed. So if you have tests that execute certain lines, you assume that they are being tested. To get this information, PHPUnit uses PHP_CodeCoverage

Do you have any code that could be being executed by PHPUnit? As said in the report, you have code somewhere that PHPUnit is executing, that is creating an instance of CityTable and calling the method fetchAll()

If you are using a configuration file, check if you are telling PHPUnit to execute the right files.

Upvotes: 2

Related Questions