public function CustomErrorTestCase::testPageNotFoundMessage in Customerror 7
Tests 404 pages.
File
- ./
customerror.test, line 30 - Tests for the CustomError module.
Class
- CustomErrorTestCase
- @file Tests for the CustomError module.
Code
public function testPageNotFoundMessage() {
// Set title and description of error message.
$title = $this
->randomName(10);
$description = $this
->randomName(80);
variable_set('site_404', 'customerror/404');
variable_set('customerror_404_title', $title);
variable_set('customerror_404', $description);
// Access error page directly, check for response code, title
// and description of error message.
$this
->drupalGet('customerror/404');
$this
->assertResponse(404, 'Response code on 404 error page set when accessed directly.');
$this
->assertText($title, 'Title on 404 error page set when accessed directly.');
$this
->assertText($description, 'Description on 404 error page set when accessed directly.');
// Access a non-existing page, check for response code, title
// and description of error message.
$this
->drupalGet('foo/dontexist');
$this
->assertResponse(404, 'Response code on 404 error page set when accessed at non-existent URL.');
$this
->assertText($title, 'Title on 404 error page set when accessed at non-existent URL.');
$this
->assertText($description, 'Description on 404 error page set when accessed at non-existent URL.');
}