public function DisplayKernelTest::testDefaultOptions in Drupal 8
Same name and namespace in other branches
- 9 core/modules/views/tests/src/Kernel/Plugin/DisplayKernelTest.php \Drupal\Tests\views\Kernel\Plugin\DisplayKernelTest::testDefaultOptions()
Tests the default display options.
File
- core/
modules/ views/ tests/ src/ Kernel/ Plugin/ DisplayKernelTest.php, line 64
Class
- DisplayKernelTest
- Drupal unit tests for the DisplayPluginBase class.
Namespace
Drupal\Tests\views\Kernel\PluginCode
public function testDefaultOptions() {
// Save the view.
$view = Views::getView('test_display_defaults');
$view
->mergeDefaults();
$view
->save();
// Reload to get saved storage values.
$view = Views::getView('test_display_defaults');
$view
->initDisplay();
$display_data = $view->storage
->get('display');
foreach ($view->displayHandlers as $id => $display) {
// Test the view plugin options against the storage.
foreach ($this->pluginTypes as $type) {
$options = $display
->getOption($type);
$this
->assertIdentical($display_data[$id]['display_options'][$type]['options'], $options['options']);
}
// Test the view handler options against the storage.
foreach ($this->handlerTypes as $type) {
$options = $display
->getOption($type);
$this
->assertIdentical($display_data[$id]['display_options'][$type], $options);
}
}
}