Here is the code I'm trying to unit test:
public function getDao () {
$dao = '';
if (isset($this->_dao)) {
$dao = $this->_dao;
} else {
$dao = new $this->_daoClassName;
}
return $dao;
}
The class is an abstract class, and $_daoClassName is a protected variable. Each concrete class sets a value for $_daoClassName
How can I unit test this code? I'm trying to use PHPUnit's $this->getMockForAbstractClass() but I don't think I can override the protected method. Alternatively, is there a better pattern I should be using on this getDao() method?
_daoClassNamewith an expected value.