1 system.test AccessDeniedTestCase::test403PathOnSystemForm()

File

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

Class

AccessDeniedTestCase
Tests custom access denied functionality.

Code

function test403PathOnSystemForm() {
  $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 403 page.
  $this->backdropPost('admin/config/system/site-information', array('site_403' => $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 403 page path."));

  // Now set a new alias on the node and make sure the new alias is on the 403 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 403 page path after it has been changed."));
}