function EntityReverseJoinTest::testJoinThroughRelationship
Tests that the EntityReverse plugin loads the correct join plugin.
File
-
core/
modules/ views/ tests/ src/ Kernel/ Plugin/ EntityReverseJoinTest.php, line 26
Class
- EntityReverseJoinTest
- Tests the EntityReverse join plugin.
Namespace
Drupal\Tests\views\Kernel\PluginCode
public function testJoinThroughRelationship() : void {
$relationship_manager = $this->container
->get('plugin.manager.views.relationship');
// Setup a simple join and test the result sql.
$view = Views::getView('test_view');
$view->initDisplay();
$view->initQuery();
$configuration = [
'id' => 'entity_reverse',
'base' => 'users_field_data',
'table' => 'users_field_data',
'field table' => 'users_field_data',
'field field' => 'uid',
'base field' => 'uid',
'field_name' => 'uid',
'join_id' => 'join_test',
];
$relationship = $relationship_manager->createInstance('entity_reverse', $configuration);
$relationship->tableAlias = 'users_field_data';
$relationship->table = 'users_field_data';
$relationship->query = $view->getQuery();
$relationship->query();
$this->assertInstanceOf(JoinTest::class, $relationship->query
->getTableQueue()[$relationship->alias]['join']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.