This post originated from an RSS feed registered with PHP Buzz
by Sebastian Bergmann.
Original Post: Testing Output with PHPUnit
Feed Title: Sebastian Bergmann
Feed URL: http://sebastian-bergmann.de/
Feed Description: Geek by nature, PHP by choice.
I just listened to this Pro PHP Podcastinterview with Greg Beaver. In his interview, Greg mentions one thing that he thinks is missing from PHPUnit: the ability to test output.
It took me about five minutes to add this functionality to PHPUnit 3.0 and now you can write the following:
PHPUnit 3.0.0 by Sebastian Bergmann.
.F
Time: 00:00
There was 1 failure:
1) testExpectFooActualBar(OutputTest)
failed asserting that <'bar'> is equal to <string:'foo'>
expected string <foo>
difference <xxx>
got string <bar>
FAILURES!
Tests: 2, Failures: 1.