You are here

protected function ModuleTest::formatViewOptions in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/Kernel/ModuleTest.php \Drupal\Tests\views\Kernel\ModuleTest::formatViewOptions()

Helper to return an expected views option array.

Parameters

array $views: An array of Drupal\views\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 core/modules/views/tests/src/Kernel/ModuleTest.php
Tests the load wrapper/helper functions.

File

core/modules/views/tests/src/Kernel/ModuleTest.php, line 324

Class

ModuleTest
Tests basic functions from the Views module.

Namespace

Drupal\Tests\views\Kernel

Code

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