function ModuleTest::formatViewOptions
Same name in other branches
- 9 core/modules/views/tests/src/Kernel/ModuleTest.php \Drupal\Tests\views\Kernel\ModuleTest::formatViewOptions()
- 10 core/modules/views/tests/src/Kernel/ModuleTest.php \Drupal\Tests\views\Kernel\ModuleTest::formatViewOptions()
- 11.x 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\KernelCode
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.