[eluser]Unknown[/eluser]
I'm attempting to use PHPUnit as a testing framework for my code igniter project, and have been able to successfully bootstrap a working code igniter (minus the router function) running in phpunit.
I've gotten helpers working properly, however libraries are a new issue. It seems that the first time loading a library works fine (as it should), however subsequent calls to loading that library (even on a new controller) fail. I know this is desired behavior, as it's made explicit in the code for Loader::_ci_load_class()
I attempted to rectify this by providing a 'unload library' function
Code:
public function unload_library($lib) {
if ($this->_ci_classes[$lib] != null)
{
$ci_inst =& get_instance();
unset($this->_ci_classes[$lib]);
unset($ci_inst->$lib);
}
}
After using this function, I can see that my class gets re-initialized, however the current controller doesn't have a member to access it ($this->mylibrary->method() results in 'call to a method on a non-object')
So my guess is that for whatever reason, the instance for CI is not having the library member properly set.
Any ideas on why this might be the case?