I am new to Phpunit, and by coincidence (as of Sept, 2012) I have installed the brand-new phpunit 3.7.0 (actually it's displayed as 3.7.1 because my phpunit installation is a git checkout)
What I want is an test-aware "echo" keyword or printf Function that does the same in a phpunit test class as does the diag()
function or the note()
function from perl's Test::More module.
diag
diag(@diagnostic_message);
Prints a diagnostic message which is guaranteed not to interfere with test output. Like print @diagnostic_message is simply concatenated together.
note
note(@diagnostic_message);
Like diag(), except the message will not be seen when the test is run in a harness. It will only be visible in the verbose TAP stream.
Handy for putting in notes which might be useful for debugging, but don't indicate a problem.
I haven't yet discovered the way PHPUnit does this.
Please note that PHPUnit swallows all output that is emitted during the execution of a test.
In strict mode, a test that emits output will fail.
There are workarounds.