function 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/');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.