mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR Added test for ErrorPage
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@67327 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
90fb060b58
commit
3d0f3a6486
31
tests/ErrorPageTest.php
Normal file
31
tests/ErrorPageTest.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?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');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
5
tests/ErrorPageTest.yml
Normal file
5
tests/ErrorPageTest.yml
Normal file
@ -0,0 +1,5 @@
|
||||
ErrorPage:
|
||||
404:
|
||||
Title: Page Not Found
|
||||
URLSegment: page-not-found
|
||||
ErrorCode: 404
|
Loading…
Reference in New Issue
Block a user