MINOR Fixing "No current controller available" error when TestSession::__destruct() is called

This commit is contained in:
Sean Harvey 2012-05-24 16:41:29 +12:00
parent 9074f524cc
commit b325fea709

View File

@ -32,9 +32,9 @@ class TestSession {
function __destruct() {
// Shift off anything else that's on the stack. This can happen if something throws
// an exception that causes a premature TestSession::__destruct() call
while(Controller::curr() != $this->controller) Controller::curr()->popCurrent();
while(Controller::has_curr() && Controller::curr() !== $this->controller) Controller::curr()->popCurrent();
$this->controller->popCurrent();
if(Controller::has_curr()) $this->controller->popCurrent();
}
/**