[SOLVED]Testing without a return value?
Posted: Mon Feb 19, 2007 6:07 am
Sorry if this is old topic; searching proved uneventful.
I have this method:
Which, if not obvious, is part of my Front Controller (inspired by Zend..)
How would one test that with SimpleTest?
I've got a mock (actor) object for the router, as that's not yet implemented, with the below spec:
Should I mock the FrontController::execute() method to include a return value or even an assert/expect?
(p.s. the calls you see in my examples and text are not static, merely demonstrated as such for illustrative purposes)
I have this method:
Code: Select all
public function execute ($route = null)
{
do
{
$route = $this->getRouter()->execute($route);
} while (!is_null($route));
}How would one test that with SimpleTest?
I've got a mock (actor) object for the router, as that's not yet implemented, with the below spec:
Code: Select all
Mock::generate('Router');
$router = new MockRouter;
$router->setReturnValueAt(0, 'execute', $router);
$router->setReturnValueAt(1, 'execute', null);
FrontController::setRouter($route);(p.s. the calls you see in my examples and text are not static, merely demonstrated as such for illustrative purposes)