phpunitHow to log with PHPUnit?
PHPUnit is a unit testing framework for the PHP language. It can be used to log the results of tests.
To log with PHPUnit, you can use the log
method of the PHPUnit_Framework_TestCase
class. This method takes two parameters: the log message and the optional log type.
<?php
$this->log('This is a log message', \PHPUnit_Framework_TestCase::LOG_INFO);
The output of the above code will be:
INFO This is a log message
The log type can be one of the following constants:
LOG_INFO
LOG_WARNING
LOG_ERROR
LOG_RISK
LOG_EXCEPTION
For more information, please refer to the PHPUnit documentation.
More of Phpunit
- How to skip a PHPUnit test?
- How to run tests in parallel with PHPUnit?
- How to use hooks in PHPUnit?
- What are PHPUnit required extensions
- How to use the PHPUnit Framework TestCase?
- How to run PHPUnit in quiet mode?
- How to show warnings in PHPUnit?
- How to load fixtures with PHPUnit?
- How to use a listener with PHPUnit?
- How to stop PHPUnit on failure?
See more codes...