에 arrayaccess를 구현하는 클래스의 객체를 스텁은 (는 mysqli 확장) 나는에 대한 테스트 스위트를 작성하고있는 클래스의 생성자입니다 :비웃음/phpunit을 여기
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
클래스는 생성자에 전달
class Config implements arrayaccess{...}
가 어떻게/스터브 Config
객체 조롱 않습니다 : PHP에 내장 된 arrayaccess
인터페이스를 구현? 어떤 것을 사용해야하며 그 이유는 무엇입니까?
미리 감사드립니다.
위대한 답변, 감사합니다! – AndyPerlitch
당신은 심지어 그것을 할 수 있지만, 배열을 사용하여 :-) –