protected function ModuleTest::formatViewOptions

Helper to return an expected views option array.

Parameters

array $views: An array of Drupal\views\Plugin\Core\Entity\View objects for which to create an options array.

Return value

array A formatted options array that matches the expected output.

1 call to ModuleTest::formatViewOptions()
ModuleTest::testLoadFunctions in drupal/core/modules/views/lib/Drupal/views/Tests/ModuleTest.php
Tests the load wrapper/helper functions.

File

drupal/core/modules/views/lib/Drupal/views/Tests/ModuleTest.php, line 270
Definition of Drupal\views\Tests\ModuleTest.

Class

ModuleTest

Namespace

Drupal\views\Tests

Code

protected function formatViewOptions(array $views = array()) {
  $expected_options = array();
  foreach ($views as $id => $view) {
    foreach ($view
      ->get('display') as $display_id => $display) {
      $expected_options[$view
        ->id() . ':' . $display['id']] = t('View: @view - Display: @display', array(
        '@view' => $view
          ->id(),
        '@display' => $display['id'],
      ));
    }
  }
  return $expected_options;
}