AnalyzeTest.php

Same filename in other branches
  1. 9 core/modules/views_ui/tests/src/Functional/AnalyzeTest.php
  2. 10 core/modules/views_ui/tests/src/Functional/AnalyzeTest.php
  3. 11.x core/modules/views_ui/tests/src/Functional/AnalyzeTest.php

Namespace

Drupal\Tests\views_ui\Functional

File

core/modules/views_ui/tests/src/Functional/AnalyzeTest.php

View source
<?php

namespace Drupal\Tests\views_ui\Functional;


/**
 * Tests the views analyze system.
 *
 * @group views_ui
 */
class AnalyzeTest extends UITestBase {
    
    /**
     * Modules to enable.
     *
     * @var array
     */
    public static $modules = [
        'views_ui',
    ];
    
    /**
     * {@inheritdoc}
     */
    protected $defaultTheme = 'stark';
    
    /**
     * Views used by this test.
     *
     * @var array
     */
    public static $testViews = [
        'test_view',
    ];
    
    /**
     * Tests that analyze works in general.
     */
    public function testAnalyzeBasic() {
        $this->drupalLogin($this->adminUser);
        $this->drupalGet('admin/structure/views/view/test_view/edit');
        $this->assertSession()
            ->linkExists(t('Analyze view'));
        // This redirects the user to the analyze form.
        $this->clickLink(t('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->drupalPostForm(NULL, [], t('Ok'));
    }

}

Classes

Title Deprecated Summary
AnalyzeTest Tests the views analyze system.

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