function UITestBase::randomView
Same name in this branch
- 8.9.x core/modules/views_ui/tests/src/Functional/UITestBase.php \Drupal\Tests\views_ui\Functional\UITestBase::randomView()
Same name in other branches
- 9 core/modules/views_ui/tests/src/Functional/UITestBase.php \Drupal\Tests\views_ui\Functional\UITestBase::randomView()
- 10 core/modules/views_ui/tests/src/Functional/UITestBase.php \Drupal\Tests\views_ui\Functional\UITestBase::randomView()
- 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.
File
-
core/
modules/ views_ui/ src/ Tests/ UITestBase.php, line 65
Class
- UITestBase
- Provides a base class for testing the Views UI.
Namespace
Drupal\views_ui\TestsCode
public function randomView(array $view = []) {
// Create a new view in the UI.
$default = [];
$default['label'] = $this->randomMachineName(16);
$default['id'] = strtolower($this->randomMachineName(16));
$default['description'] = $this->randomMachineName(16);
$default['page[create]'] = TRUE;
$default['page[path]'] = $default['id'];
$view += $default;
$this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
return $default;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.