function PagerTest::createViewAtPath
Same name in other branches
- 8.9.x core/modules/views/tests/src/Functional/Wizard/PagerTest.php \Drupal\Tests\views\Functional\Wizard\PagerTest::createViewAtPath()
- 10 core/modules/views/tests/src/Functional/Wizard/PagerTest.php \Drupal\Tests\views\Functional\Wizard\PagerTest::createViewAtPath()
- 11.x core/modules/views/tests/src/Functional/Wizard/PagerTest.php \Drupal\Tests\views\Functional\Wizard\PagerTest::createViewAtPath()
Create a simple View of nodes at a given path.
Parameters
string $path: The path at which the View should be created.
bool $pager: A boolean for whether the View created should use a pager.
1 call to PagerTest::createViewAtPath()
- PagerTest::testPager in core/
modules/ views/ tests/ src/ Functional/ Wizard/ PagerTest.php - Tests the pager option.
File
-
core/
modules/ views/ tests/ src/ Functional/ Wizard/ PagerTest.php, line 52
Class
- PagerTest
- Tests the ability of the views wizard to create views without a pager.
Namespace
Drupal\Tests\views\Functional\WizardCode
protected function createViewAtPath($path, $pager = TRUE) {
$view = [];
$view['label'] = $this->randomMachineName(16);
$view['id'] = strtolower($this->randomMachineName(16));
$view['show[sort]'] = 'node_field_data-created:ASC';
$view['page[create]'] = 1;
$view['page[title]'] = $this->randomMachineName(16);
$view['page[path]'] = $path;
$view['page[pager]'] = $pager;
$this->drupalGet('admin/structure/views/add');
$this->submitForm($view, 'Save and edit');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.