function UITestBase::randomView

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

A helper method which creates a random view.

13 calls to UITestBase::randomView()
AreaEntityUITest::testUI in core/modules/views_ui/tests/src/Functional/AreaEntityUITest.php
DisplayAttachmentTest::testAttachmentOnAttachedMachineNameChange in core/modules/views_ui/tests/src/Functional/DisplayAttachmentTest.php
Tests the attachment after changing machine name.
DisplayAttachmentTest::testRemoveAttachedDisplay in core/modules/views_ui/tests/src/Functional/DisplayAttachmentTest.php
Tests the attachment working after the attached page was deleted.
DisplayCRUDTest::testAddDisplay in core/modules/views_ui/tests/src/Functional/DisplayCRUDTest.php
Tests adding a display.
DisplayCRUDTest::testDuplicateDisplay in core/modules/views_ui/tests/src/Functional/DisplayCRUDTest.php
Tests the duplicating of a display.

... See full list

File

core/modules/views_ui/tests/src/Functional/UITestBase.php, line 56

Class

UITestBase
Provides a base class for testing the Views UI.

Namespace

Drupal\Tests\views_ui\Functional

Code

public function randomView(array $view = []) {
    // Create a new view in the UI.
    $default = [];
    $default['label'] = $this->randomMachineName(16);
    $default['id'] = $this->randomMachineName(16);
    $default['description'] = $this->randomMachineName(16);
    $default['page[create]'] = TRUE;
    $default['page[path]'] = $default['id'];
    $view += $default;
    $this->drupalGet('admin/structure/views/add');
    $this->submitForm($view, 'Save and edit');
    return $default;
}

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