public function testLastController()
{
$this->specify("Dispatcher doesn't store the last controller", function () {
$di = new Di();
$dispatcher = new Dispatcher();
$dispatcher->setDI($di);
$di->set("dispatcher", $dispatcher);
$dispatcher->setControllerName("failure");
$dispatcher->setActionName("exception");
$dispatcher->setParams([]);
try {
$dispatcher->dispatch();
expect(false)->true();
} catch (\Exception $e) {
expect($e->getMessage())->equals("failure by exception");
expect($dispatcher->getLastController())->isInstanceOf("FailureController");
}
});
}