News 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

Tobias Schlitt's Blog: PHP@FrOSCon - Timetable online!

Matthew Weir O'Phinney's Blog: Getting XDebug working with PHPUnit for code coverage reports

Evert Pot's Blog: PHPUnit3 : first impressions

Christian Weiske: PHP: Cannot access property started with '\\o'

Michelangelo van Dam's Blog: Quality Assurance on PHP projects - PHPUnit part 1


Community Events





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


framework refactor community language introduction testing series release podcast opinion threedevsandamaybe laravel unittest install wordpress experience code list interview developer

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