1 system.test PageNotFoundTestCase::test404PathOnSystemForm()

File

core/modules/system/tests/system.test, line 987
Tests for system.module.

Class

PageNotFoundTestCase

Code

function test404PathOnSystemForm() {
  $this->backdropLogin($this->admin_user);
  $edit = array(
    'title' => $this->randomName(10),
    'body' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(100)))),
    'path' => array(
      'alias' => $this->randomName(8),
    ),
  );
  $node = $this->backdropCreateNode($edit);
  // Use a custom 404 page.
  $this->backdropPost('admin/config/system/site-information', array('site_404' => $node->path['alias']), t('Save configuration'));
  $this->backdropGet('admin/config/system/site-information');
  $this->assertRaw($node->path['alias'], t("Found the alias for the custom 404 page path."));

  // Now set a new alias on the node and make sure the new alias is on the 404 field.
  $node->title = $this->randomName(7);
  node_save($node);
  $this->backdropGet('admin/config/system/site-information');
  $this->assertRaw($node->path['alias'], t("Found the alias for the custom 404 page path after it has been changed."));
}