Is there a way to tell if --debug or --verbose was passed to PHPUnit in a test?

后端 未结 1 445
闹比i
闹比i 2021-01-18 00:03

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 scree

1条回答
  •  礼貌的吻别
    2021-01-18 00:16

    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

    0 讨论(0)
提交回复
热议问题