EntityAutocompleteWebformViewsTest.php in Webform Views Integration 8.5
File
tests/src/Kernel/relationship/EntityAutocompleteWebformViewsTest.php
View source
<?php
namespace Drupal\Tests\webform_views\Kernel\relationship;
class EntityAutocompleteWebformViewsTest extends WebformViewsRelationshipTestBase {
protected $target_entity_type = 'user';
protected $webform_submissions_data = [
[
'element' => 1,
],
];
public function setUp() {
parent::setUp();
$this->webform_elements = [
'element' => [
'#type' => 'entity_autocomplete',
'#title' => 'Entity Autocomplete',
'#target_type' => $this->target_entity_type,
],
];
$target_entity_type = $this->container
->get('entity_type.manager')
->getDefinition($this->target_entity_type);
$this->view_handlers = [
'relationship' => [
[
'id' => 'element',
'table' => 'webform_submission_field_webform_element',
'field' => 'webform_submission_value',
'options' => [],
],
],
'field' => [
[
'id' => 'entity_id',
'table' => $target_entity_type
->getDataTable(),
'field' => $target_entity_type
->getKey('id'),
'options' => [
'relationship' => 'element',
'alter' => [],
'empty' => '',
'hide_empty' => FALSE,
'empty_zero' => FALSE,
'hide_alter_empty' => TRUE,
],
],
],
];
}
}