function PageNotFoundTest::testPageNotFound

File

drupal/core/modules/system/lib/Drupal/system/Tests/System/PageNotFoundTest.php, line 33
Definition of Drupal\system\Tests\System\PageNotFoundTest.

Class

PageNotFoundTest

Namespace

Drupal\system\Tests\System

Code

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

  // Use a custom 404 page.
  $edit = array(
    'site_404' => 'user/' . $this->admin_user->uid,
  );
  $this
    ->drupalPost('admin/config/system/site-information', $edit, t('Save configuration'));
  $this
    ->drupalGet($this
    ->randomName(10));
  $this
    ->assertText($this->admin_user->name, 'Found the custom 404 page');
}