Jesús Amieiro

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.

Exit mobile version