function AnalyzeTest::testAnalyzeBasic

Same name in other branches
  1. 8.9.x core/modules/views_ui/tests/src/Functional/AnalyzeTest.php \Drupal\Tests\views_ui\Functional\AnalyzeTest::testAnalyzeBasic()
  2. 10 core/modules/views_ui/tests/src/Functional/AnalyzeTest.php \Drupal\Tests\views_ui\Functional\AnalyzeTest::testAnalyzeBasic()
  3. 11.x core/modules/views_ui/tests/src/Functional/AnalyzeTest.php \Drupal\Tests\views_ui\Functional\AnalyzeTest::testAnalyzeBasic()

Tests that analyze works in general.

File

core/modules/views_ui/tests/src/Functional/AnalyzeTest.php, line 34

Class

AnalyzeTest
Tests the views analyze system.

Namespace

Drupal\Tests\views_ui\Functional

Code

public function testAnalyzeBasic() {
    $this->drupalLogin($this->adminUser);
    $this->drupalGet('admin/structure/views/view/test_view/edit');
    $this->assertSession()
        ->linkExists('Analyze view');
    // This redirects the user to the analyze form.
    $this->clickLink('Analyze view');
    $this->assertSession()
        ->titleEquals('View analysis | Drupal');
    foreach ([
        'ok',
        'warning',
        'error',
    ] as $type) {
        // Check that analyse messages with the expected type found.
        $this->assertSession()
            ->elementExists('css', 'div.' . $type);
    }
    // This redirects the user back to the main views edit page.
    $this->submitForm([], 'Ok');
}

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