You are here

protected function ModuleTest::formatViewOptions in Views (for Drupal 7) 8.3

Helper to return an expected views option array.

Parameters

array $views: An array of Drupal\views\ViewStorage objects to create an options array for.

Return value

array A formatted options array that matches the expected output.

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

File

lib/Drupal/views/Tests/ModuleTest.php, line 205
Definition of Drupal\views\Tests\ModuleTest.

Class

ModuleTest
Tests basic functions from the Views module.

Namespace

Drupal\views\Tests

Code

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