News Feed
Jobs Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Volker Dusch's Blog:
An introduction to PHPUnits @covers annotation
November 04, 2011 @ 09:55:32

PHPUnit is one of the most widely used unit testing tools for PHP applications. It comes packed with features, some that are commonly used and some not so much. In a new post to his blog today Volker Dusch looks at one specific feature - the "@covers" annotation you can use in your tests' comments to specify which functionality you're actually testing.

One of the goals of your test suite and the coverage report is to make you trust in your code base and to remove the fear of changing something that needs to be changed. [...] You shouldn't think "Well yes that a 100% but a lot of that just comes from that big integration test and I don't know if the class is really tested!". [...] Thankfully PHPUnit offers a way to drastically increase your confidence in what you actually have tested.

Using the "@covers" annotation on your test method docblocks gives you one more level of confidence in what's being tested and can help make for clearer updating down the road. He also mentions using them to provide extra insight into protected methods in your code and where the test coverage for them really lies.

0 comments voice your opinion now!
phpunit covers annotation protected methods codecoverge


blog comments powered by Disqus

Similar Posts

Michael Kimsal's Blog: PHP, Groovy and language evolution

UncleCode.com: Install PHPUnit Manually without Pear for a Single Project

Sebastian Bergmann's Blog: ANSI Colors in PHPUnit Output

NetTuts.com: Reflection in PHP

Community News: The Grumpy Programmer's PHPUnit Cookbook Released


Community Events











Don't see your event here?
Let us know!


symfony2 hhvm security package unittest language opinion composer facebook framework podcast component example overview install code application release hack introduction

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework