Displaying information in PHPUnit tests

Sometimes, when you are debugging a PHPUnit test, you need to display some variable or another information in the console.

To do it, you can use this trick:

fwrite(STDERR, print_r($myOddVariable, TRUE));

This will show you the $myOddVariable in the console when you exeucte the test.

Remember, this is a temporary trick, and you should not use this in the final test.

Seen at Stack Overflow.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.