public function DisplayTest::randomView

A helper method which creates a random view.

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

File

drupal/core/modules/views/lib/Drupal/views/Tests/UI/DisplayTest.php, line 33
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;
}