You are here

public function DisplayTest::randomView in Views (for Drupal 7) 8.3

A helper method which creates a random view.

5 calls to DisplayTest::randomView()
DisplayTest::testAddDisplay in lib/Drupal/views/Tests/UI/DisplayTest.php
Tests adding a display.
DisplayTest::testCloneDisplay in lib/Drupal/views/Tests/UI/DisplayTest.php
Tests the cloning of a display.
DisplayTest::testDisableDisplay in lib/Drupal/views/Tests/UI/DisplayTest.php
Tests disabling of a display.
DisplayTest::testRemoveDisplay in lib/Drupal/views/Tests/UI/DisplayTest.php
Tests removing a display.
DisplayTest::testReorderDisplay in lib/Drupal/views/Tests/UI/DisplayTest.php
Tests reordering of displays.

File

lib/Drupal/views/Tests/UI/DisplayTest.php, line 26
Definition of Drupal\views\Tests\UI\DisplayTest.

Class

DisplayTest
Tests the handling of displays in the UI, adding removing etc.

Namespace

Drupal\views\Tests\UI

Code

public function randomView(array $view = array()) {

  // Create a new view in the UI.
  $default = array();
  $default['human_name'] = $this
    ->randomName(16);
  $default['name'] = strtolower($this
    ->randomName(16));
  $default['description'] = $this
    ->randomName(16);
  $default['page[create]'] = TRUE;
  $default['page[path]'] = $default['name'];
  $view += $default;
  $this
    ->drupalPost('admin/structure/views/add', $view, t('Continue & edit'));
  return $default;
}