2008-12-03 22:50:03 +01:00
|
|
|
<?php
|
2009-04-25 04:20:18 +02:00
|
|
|
/**
|
|
|
|
* @package sapphire
|
|
|
|
* @subpackage tests
|
|
|
|
*/
|
|
|
|
class ErrorPageTest extends FunctionalTest {
|
2008-12-03 22:50:03 +01:00
|
|
|
|
|
|
|
static $fixture_file = 'sapphire/tests/ErrorPageTest.yml';
|
|
|
|
|
|
|
|
function test404ErrorPage() {
|
2009-04-25 04:20:18 +02:00
|
|
|
$errorPage = $this->objFromFixture('ErrorPage', '404');
|
|
|
|
|
2008-12-03 22:50:03 +01:00
|
|
|
/* We have an ErrorPage object to use */
|
|
|
|
$this->assertTrue($errorPage instanceof ErrorPage);
|
|
|
|
|
|
|
|
/* Test the URL of the error page out to get a response */
|
2009-04-25 04:20:18 +02:00
|
|
|
$response = $this->get($errorPage->URLSegment);
|
2008-12-03 22:50:03 +01:00
|
|
|
|
|
|
|
/* We have an HTTPResponse object for the error page */
|
|
|
|
$this->assertTrue($response instanceof HTTPResponse);
|
|
|
|
|
|
|
|
/* We have body text from the error page */
|
2009-04-25 04:20:18 +02:00
|
|
|
$this->assertNotNull($response->getBody(), 'We have body text from the error page');
|
2008-12-03 22:50:03 +01:00
|
|
|
|
|
|
|
/* Status code of the HTTPResponse for error page is "404" */
|
2009-04-25 04:20:18 +02:00
|
|
|
$this->assertEquals($response->getStatusCode(), '404', 'Status cod eof the HTTPResponse for error page is "404"');
|
2008-12-03 22:50:03 +01:00
|
|
|
|
|
|
|
/* Status message of the HTTPResponse for error page is "Not Found" */
|
2009-04-25 04:20:18 +02:00
|
|
|
$this->assertEquals($response->getStatusDescription(), 'Not Found', 'Status message of the HTTResponse for error page is "Not found"');
|
2008-12-03 22:50:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
?>
|