17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1177 Views |
-
HTTPResponse object

17 August 2007 at 2:20pm
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?
-
Re: HTTPResponse object

17 August 2007 at 3:17pm
This has been implemented here: http://open.silverstripe.com/changeset/40392
-
Re: HTTPResponse object

18 August 2007 at 2:55am
The introduction of the HTTPResponse object broke some of my and the forum's code. I fixed it already (r40437 and r40439).
There was also a bug in the Director class: Director::redirectBack() didn't work because it stopped the script before outputting the headers.
| 1177 Views | ||
|
Page:
1
|
Go to Top |


