You are here

public function FrontPageTest::testAdminFrontPage in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/node/tests/src/Functional/Views/FrontPageTest.php \Drupal\Tests\node\Functional\Views\FrontPageTest::testAdminFrontPage()

Tests the frontpage when logged in as admin.

File

core/modules/node/tests/src/Functional/Views/FrontPageTest.php, line 180

Class

FrontPageTest
Tests the default frontpage provided by views.

Namespace

Drupal\Tests\node\Functional\Views

Code

public function testAdminFrontPage() {

  // When a user with sufficient permissions is logged in, views_ui adds
  // contextual links to the homepage view. This verifies there are no errors.
  \Drupal::service('module_installer')
    ->install([
    'views_ui',
  ]);

  // Log in root user with sufficient permissions.
  $this
    ->drupalLogin($this->rootUser);

  // Test frontpage view.
  $this
    ->drupalGet('node');
  $this
    ->assertSession()
    ->statusCodeEquals(200);

  // Check that the frontpage view was rendered.
  $this
    ->assertPattern('/class=".+view-frontpage/');
}