【发布时间】:2012-05-23 08:16:30
【问题描述】:
这是我正在为其编写测试套件的类的构造函数(它扩展了 mysqli):
function __construct(Config $c)
{
// store config file
$this->config = $c;
// do mysqli constructor
parent::__construct(
$this->config['db_host'],
$this->config['db_user'],
$this->config['db_pass'],
$this->config['db_dbname']
);
}
传递给构造函数的Config类实现了php内置的arrayaccess接口:
class Config implements arrayaccess{...}
如何模拟/存根Config 对象?我应该使用哪个?为什么?
提前致谢!
【问题讨论】:
标签: php phpunit arrayaccess