protected function ModuleTest::formatViewOptions in Drupal 10
Same name and namespace in other branches
- 8 core/modules/views/tests/src/Kernel/ModuleTest.php \Drupal\Tests\views\Kernel\ModuleTest::formatViewOptions()
- 9 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.
File
- core/
modules/ views/ tests/ src/ Kernel/ ModuleTest.php, line 325
Class
- ModuleTest
- Tests basic functions from the Views module.
Namespace
Drupal\Tests\views\KernelCode
protected function formatViewOptions(array $views = []) {
$expected_options = [];
foreach ($views as $view) {
foreach ($view
->get('display') as $display) {
$expected_options[$view
->id() . ':' . $display['id']] = "View: {$view->id()} - Display: {$display['id']}";
}
}
return $expected_options;
}