silverstripe-framework/tests/ErrorPageTest.php
Ingo Schommer d26f08b481 MINOR merged branches/2.3 into trunk
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@67465 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-12-04 22:38:32 +00:00

31 lines
948 B
PHP

<?php
class ErrorPageTest extends SapphireTest {
static $fixture_file = 'sapphire/tests/ErrorPageTest.yml';
function test404ErrorPage() {
$errorPage = DataObject::get_one('ErrorPage', "ErrorCode = '404'");
/* We have an ErrorPage object to use */
$this->assertTrue($errorPage instanceof ErrorPage);
/* Test the URL of the error page out to get a response */
$response = Director::test(Director::makeRelative($errorPage->Link()));
/* We have an HTTPResponse object for the error page */
$this->assertTrue($response instanceof HTTPResponse);
/* We have body text from the error page */
$this->assertTrue($response->getBody() != null);
/* Status code of the HTTPResponse for error page is "404" */
$this->assertTrue($response->getStatusCode() == '404');
/* Status message of the HTTPResponse for error page is "Not Found" */
$this->assertTrue($response->getStatusDescription() == 'Not Found');
}
}
?>