In order to support testability of controller objects with PHPUnit, I am changing the way that Controller handles redirections.
$controller->run() will now return an HTTPResponse object, which will store headers (including redirection headers) as well as the HTTP body.
Director now calls the output() method on HTTPRepsonse, which will output all the headers and the body.
$output = $controller->run(...);
$output->output();
However, if other applications, such as PHPUnit, can instead interrogate the HTTPReponse object to see if a redirection was triggered, for example:
$output = $controller->run(...);
$this->assertEqual($output->getStatusCode(), 302);
Thoughts?