开发者

using phpunit command line arguments in my tests/bootstrap/setup/etc

开发者 https://www.devze.com 2023-02-09 05:20 出处:网络
I want to be able to print some 开发者_开发百科config data to stdout from my tests only when I use the \'--verbose\' phpunit command line argument.

I want to be able to print some 开发者_开发百科config data to stdout from my tests only when I use the '--verbose' phpunit command line argument.

How can I accomplish this?


Probably this is not really intended by the authors of PHPUnit, but you can do it like this:

<?php

require_once 'PHPUnit/Framework/TestCase.php';

class EnvironmentTest extends PHPUnit_Framework_TestCase
{
    public function testHasParam()
    {
      if (in_array('--verbose', $_SERVER['argv']))
         echo "lots of info";
      else
         echo "no info";
    }
}
?>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号