You are here

protected function SortRandomTest::getBasicRandomView in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Tests/Handler/SortRandomTest.php \Drupal\views\Tests\Handler\SortRandomTest::getBasicRandomView()

Return a basic view with random ordering.

2 calls to SortRandomTest::getBasicRandomView()
SortRandomTest::testRandomOrdering in core/modules/views/src/Tests/Handler/SortRandomTest.php
Tests random ordering of the result set.
SortRandomTest::testRandomOrderingWithRenderCaching in core/modules/views/src/Tests/Handler/SortRandomTest.php
Tests random ordering with tags based caching.

File

core/modules/views/src/Tests/Handler/SortRandomTest.php, line 56
Contains \Drupal\views\Tests\Handler\SortRandomTest.

Class

SortRandomTest
Tests for core Drupal\views\Plugin\views\sort\Random handler.

Namespace

Drupal\views\Tests\Handler

Code

protected function getBasicRandomView() {
  $view = Views::getView('test_view');
  $view
    ->setDisplay();

  // Add a random ordering.
  $view->displayHandlers
    ->get('default')
    ->overrideOption('sorts', array(
    'random' => array(
      'id' => 'random',
      'field' => 'random',
      'table' => 'views',
    ),
  ));
  return $view;
}