I'm doing some overloading to PHPUnit's Selenium extension that uses the CaptureEntirePageScreenshotToString function, and I would like to only print the path to the screenshot as we go only when --verbose or --debug is passed in.
For instance,
phpunit --debug ./tests
Then somewhere in my code I have (this is psudo code)
if (--debug)
echo "Screenshot: /path/to/screenshot.png
Suggestions?
There is no PHPUnit internal API to do this. The configuration object is not accessible through the test cases directly.
You can't use PHPUnit_Util_Configuration::getInstance()
as thats only the wrapper for the xml config.
My suggestion would be to just use:
if(in_array('--debug', $_SERVER['argv'], true)) {
//Insert your debug code here.
}
Relevant classes:
Command Parser
Test Runner
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With