相关疑难解决方法(0)

如何PHPUnit测试一个没有返回值的方法?

我正在尝试从我编写的以下类中测试方法(函数比显示的更多,基本上,每个函数都是_*()方法):

class Validate {
  private static $initialized = false;

  /**
  * Construct won't be called inside this class and is uncallable from the outside. This prevents
  * instantiating this class. This is by purpose, because we want a static class.
  */
  private function __construct() {}

  /**
  * If needed, allows the class to initialize itself
  */
  private static function initialize()
  {
    if(self::$initialized) {
      return;
    } else {
      self::$initialized = true;
      //Set any other class static variables here
    }
  }

  ... …
Run Code Online (Sandbox Code Playgroud)

php phpunit unit-testing

13
推荐指数
3
解决办法
1万
查看次数

标签 统计

php ×1

phpunit ×1

unit-testing ×1