function ViewExecutableTest::testAddHandler
Same name in other branches
- 9 core/modules/views/tests/src/Unit/ViewExecutableTest.php \Drupal\Tests\views\Unit\ViewExecutableTest::testAddHandler()
- 10 core/modules/views/tests/src/Unit/ViewExecutableTest.php \Drupal\Tests\views\Unit\ViewExecutableTest::testAddHandler()
- 11.x core/modules/views/tests/src/Unit/ViewExecutableTest.php \Drupal\Tests\views\Unit\ViewExecutableTest::testAddHandler()
@covers ::addHandler
@dataProvider addHandlerProvider
Parameters
string $option: The option to set on the View.
$handler_type: The handler type to set.
File
-
core/
modules/ views/ tests/ src/ Unit/ ViewExecutableTest.php, line 351
Class
- ViewExecutableTest
- @coversDefaultClass \Drupal\views\ViewExecutable @group views
Namespace
Drupal\Tests\views\UnitCode
public function testAddHandler($option, $handler_type) {
/** @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();
$views_data = [];
$views_data['test_field'] = [
'field' => [
'id' => 'standard',
],
'filter' => [
'id' => 'standard',
],
'argument' => [
'id' => 'standard',
],
'sort' => [
'id' => 'standard',
],
];
$this->viewsData
->expects($this->atLeastOnce())
->method('get')
->with('test_entity')
->willReturn($views_data);
$display->expects($this->atLeastOnce())
->method('setOption')
->with($option, [
'test_field' => [
'id' => 'test_field',
'table' => 'test_entity',
'field' => 'test_field',
'plugin_id' => 'standard',
],
]);
$view->addHandler('default', $handler_type, 'test_entity', 'test_field');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.