You are here

protected function PagerTest::createViewAtPath in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/Functional/Wizard/PagerTest.php \Drupal\Tests\views\Functional\Wizard\PagerTest::createViewAtPath()
  2. 9 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 54

Class

PagerTest
Tests the ability of the views wizard to create views without a pager.

Namespace

Drupal\Tests\views\Functional\Wizard

Code

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');
}