function ViewExecutableTest::testBuildThemeFunctions
Same name in other branches
- 9 core/modules/views/tests/src/Unit/ViewExecutableTest.php \Drupal\Tests\views\Unit\ViewExecutableTest::testBuildThemeFunctions()
- 10 core/modules/views/tests/src/Unit/ViewExecutableTest.php \Drupal\Tests\views\Unit\ViewExecutableTest::testBuildThemeFunctions()
- 11.x core/modules/views/tests/src/Unit/ViewExecutableTest.php \Drupal\Tests\views\Unit\ViewExecutableTest::testBuildThemeFunctions()
@covers ::buildThemeFunctions
File
-
core/
modules/ views/ tests/ src/ Unit/ ViewExecutableTest.php, line 290
Class
- ViewExecutableTest
- @coversDefaultClass \Drupal\views\ViewExecutable @group views
Namespace
Drupal\Tests\views\UnitCode
public function testBuildThemeFunctions() {
/** @var \Drupal\views\ViewExecutable|\PHPUnit\Framework\MockObject\MockObject $view */
/** @var \Drupal\views\Plugin\views\display\DisplayPluginBase|\PHPUnit\Framework\MockObject\MockObject $display */
list($view, $display) = $this->setupBaseViewAndDisplay();
unset($view->display_handler);
$expected = [
'test_hook__test_view',
'test_hook',
];
$this->assertEquals($expected, $view->buildThemeFunctions('test_hook'));
$view->display_handler = $display;
$expected = [
'test_hook__test_view__default',
'test_hook__default',
'test_hook__one',
'test_hook__two',
'test_hook__and_three',
'test_hook__test_view',
'test_hook',
];
$this->assertEquals($expected, $view->buildThemeFunctions('test_hook'));
// Change the name of the display plugin and make sure that is in the array.
$view->display_handler->display['display_plugin'] = 'default2';
$expected = [
'test_hook__test_view__default',
'test_hook__default',
'test_hook__one',
'test_hook__two',
'test_hook__and_three',
'test_hook__test_view__default2',
'test_hook__default2',
'test_hook__test_view',
'test_hook',
];
$this->assertEquals($expected, $view->buildThemeFunctions('test_hook'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.