function HandlerBaseTest::testGetEntityTypeForFieldWithRelationship
Same name and namespace in other branches
- 9 core/modules/views/tests/src/Unit/Plugin/HandlerBaseTest.php \Drupal\Tests\views\Unit\Plugin\HandlerBaseTest::testGetEntityTypeForFieldWithRelationship()
- 8.9.x core/modules/views/tests/src/Unit/Plugin/HandlerBaseTest.php \Drupal\Tests\views\Unit\Plugin\HandlerBaseTest::testGetEntityTypeForFieldWithRelationship()
- 10 core/modules/views/tests/src/Unit/Plugin/HandlerBaseTest.php \Drupal\Tests\views\Unit\Plugin\HandlerBaseTest::testGetEntityTypeForFieldWithRelationship()
@covers ::getEntityType
File
-
core/
modules/ views/ tests/ src/ Unit/ Plugin/ HandlerBaseTest.php, line 54
Class
- HandlerBaseTest
- @coversDefaultClass <a href="/api/drupal/core%21modules%21views%21src%21Plugin%21views%21HandlerBase.php/class/HandlerBase/11.x" title="Base class for Views handler plugins." class="local">\Drupal\views\Plugin\views\HandlerBase</a> @group Views
Namespace
Drupal\Tests\views\Unit\PluginCode
public function testGetEntityTypeForFieldWithRelationship() : void {
$handler = new TestHandler([], 'test_handler', []);
$options = [
'relationship' => 'test_relationship',
];
$handler->init($this->executable, $this->display, $options);
$this->display
->expects($this->atLeastOnce())
->method('getOption')
->with('relationships')
->willReturn([
'test_relationship' => [
'table' => 'test_entity_type_table',
'id' => 'test_relationship',
'field' => 'test_relationship',
],
]);
$this->view
->expects($this->any())
->method('get')
->with('base_table')
->willReturn('test_entity_type_table');
$this->viewsData
->expects($this->any())
->method('get')
->willReturnMap([
[
'test_entity_type_table',
[
'table' => [
'entity type' => 'test_entity_type',
],
'test_relationship' => [
'relationship' => [
'base' => 'test_other_entity_type_table',
'base field' => 'id',
],
],
],
],
[
'test_other_entity_type_table',
[
'table' => [
'entity type' => 'test_other_entity_type',
],
],
],
]);
$handler->setViewsData($this->viewsData);
$this->assertEquals('test_other_entity_type', $handler->getEntityType());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.