开发者

Any other alternative similar to @covers to mark that a particular method of a class is covered in a unit test

Please note that I am not instantiating my code in my unit test rather I am using curl to test a web service operation and then asserting the actual result against expected value. I have no issues with my testing. I just want a way to show that the class is covered in the 开发者_如何学Python'CodeCoverage' of PHPUnderControl. I tried @covers- it just puts up the class in the Code Coverage list of classes but gives the code coverage as 0 pulling down my overall coverage. I wonder if there is a way to indicate explicitly that a unit test should cover few methods in a class.


Marking a test with @covers tells PHPUnit to use xdebug to track the code coverage in that area during that test. It does not state that the code is covered. I assume that the code under test is running under a separate PHP process invoked via httpd, Apache, or some other HTTP method.

If you can find a way to bypass curl from within your test and call the code directly, the coverage would get tracked. That would leave only the request layer uncovered which gets you closer. Or you need to find a way to simulate the same calls that come in to your web service.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜