public function ViewExecutableTest::testAddHandlerWithEntityField in Drupal 8
Same name and namespace in other branches
- 9 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 393
Class
- ViewExecutableTest
- @coversDefaultClass \Drupal\views\ViewExecutable @group views
Namespace
Drupal\Tests\views\UnitCode
public function testAddHandlerWithEntityField($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['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');
}