public function DisplayExtenderTest::testDisplayExtenders in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Tests/Plugin/DisplayExtenderTest.php \Drupal\views\Tests\Plugin\DisplayExtenderTest::testDisplayExtenders()
Test display extenders.
File
- core/
modules/ views/ src/ Tests/ Plugin/ DisplayExtenderTest.php, line 36 - Contains \Drupal\views\Tests\Plugin\DisplayExtenderTest.
Class
- DisplayExtenderTest
- Tests the display extender plugins.
Namespace
Drupal\views\Tests\PluginCode
public function testDisplayExtenders() {
$this
->config('views.settings')
->set('display_extenders', array(
'display_extender_test',
))
->save();
$this
->assertEqual(count(Views::getEnabledDisplayExtenders()), 1, 'Make sure that there is only one enabled display extender.');
$view = Views::getView('test_view');
$view
->initDisplay();
$this
->assertEqual(count($view->display_handler
->getExtenders()), 1, 'Make sure that only one extender is initialized.');
$display_extender = $view->display_handler
->getExtenders()['display_extender_test'];
$this
->assertTrue($display_extender instanceof \Drupal\views_test_data\Plugin\views\display_extender\DisplayExtenderTest, 'Make sure the right class got initialized.');
$view
->preExecute();
$this
->assertTrue($display_extender->testState['preExecute'], 'Make sure the display extender was able to react on preExecute.');
$view
->execute();
$this
->assertTrue($display_extender->testState['query'], 'Make sure the display extender was able to react on query.');
}