1 redirect.test RedirectFunctionalTest::test404Interface()

Tests the links added to 404 pages for creating redirects.

File

core/modules/redirect/tests/redirect.test, line 154
Unit tests for the redirect module.

Class

RedirectFunctionalTest

Code

function test404Interface() {
  // Check that 404 pages do get "Add URL redirect" links for admin users.
  $this->backdropGet('invalid-path1');
  $this->backdropGet('invalid-path2');
  $this->assertLink('Add a URL redirect from this page to another location');

  // Check that 403 pages do not get the "Add URL redirect" link at all.
  $this->backdropGet('admin/config/system/actions');
  $this->assertNoLink('Add a URL redirect from this page to another location');

  $this->backdropGet('admin/reports/page-not-found');
  $this->clickLink('Fix 404 pages with URL redirects');

  // Check that normal users do not see the "Add URL redirect" link on 404
  // pages.
  $this->backdropLogout();
  $this->backdropGet('invalid-path3');
  $this->assertNoLink('Add a URL redirect from this page to another location');
}