function ViewExecutableTest::testAddHandlerWithEntityField
Same name in other branches
- 9 core/modules/views/tests/src/Unit/ViewExecutableTest.php \Drupal\Tests\views\Unit\ViewExecutableTest::testAddHandlerWithEntityField()
- 8.9.x core/modules/views/tests/src/Unit/ViewExecutableTest.php \Drupal\Tests\views\Unit\ViewExecutableTest::testAddHandlerWithEntityField()
- 11.x core/modules/views/tests/src/Unit/ViewExecutableTest.php \Drupal\Tests\views\Unit\ViewExecutableTest::testAddHandlerWithEntityField()
@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 415
Class
- ViewExecutableTest
- @coversDefaultClass \Drupal\views\ViewExecutable @group views
Namespace
Drupal\Tests\views\UnitCode
public function testAddHandlerWithEntityField($option, $handler_type) : void {
/** @var \Drupal\views\ViewExecutable|\PHPUnit\Framework\MockObject\MockObject $view */
/** @var \Drupal\views\Plugin\views\display\DisplayPluginBase|\PHPUnit\Framework\MockObject\MockObject $display */
[
$view,
$display,
] = $this->setupBaseViewAndDisplay();
$views_data = [];
$views_data['table']['entity type'] = 'test_entity_type';
$views_data['test_field'] = [
'entity field' => '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',
'entity_type' => 'test_entity_type',
'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.