PageNotFoundTestCase::testPageNotFound

7 system.test PageNotFoundTestCase::testPageNotFound()
8 system.test PageNotFoundTestCase::testPageNotFound()

File

modules/system/system.test, line 995
Tests for system.module.

Code

function testPageNotFound() {
  $this->drupalGet($this->randomName(10));
  $this->assertText(t('Page not found'), t('Found the default 404 page'));

  $edit = array(
    'title' => $this->randomName(10), 
    'body' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(100)))),
  );
  $node = $this->drupalCreateNode($edit);

  // Use a custom 404 page.
  $this->drupalPost('admin/config/system/site-information', array('site_404' => 'node/' . $node->nid), t('Save configuration'));

  $this->drupalGet($this->randomName(10));
  $this->assertText($node->title, t('Found the custom 404 page'));
}
Login or register to post comments