function NewViewConfigSchemaTest::testNewViews

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

Tests creating brand new views.

File

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

Class

NewViewConfigSchemaTest
Tests configuration schema against new views.

Namespace

Drupal\Tests\views_ui\Functional

Code

public function testNewViews() : void {
    $this->drupalLogin($this->drupalCreateUser([
        'administer views',
    ]));
    // Create views with all core Views wizards.
    $wizards = [
        // Wizard with their own classes.
'node',
        'node_revision',
        'users',
        'comment',
        'file_managed',
        'taxonomy_term',
        'watchdog',
    ];
    foreach ($wizards as $wizard_key) {
        $edit = [];
        $edit['label'] = $this->randomString();
        $edit['id'] = $this->randomMachineName();
        $edit['show[wizard_key]'] = $wizard_key;
        $edit['description'] = $this->randomString();
        $this->drupalGet('admin/structure/views/add');
        $this->submitForm($edit, 'Save and edit');
    }
}

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