You are here

protected function FieldOrLanguageJoinTest::buildJoin in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/Kernel/Plugin/FieldOrLanguageJoinTest.php \Drupal\Tests\views\Kernel\Plugin\FieldOrLanguageJoinTest::buildJoin()
  2. 10 core/modules/views/tests/src/Kernel/Plugin/FieldOrLanguageJoinTest.php \Drupal\Tests\views\Kernel\Plugin\FieldOrLanguageJoinTest::buildJoin()

Builds a join using the given configuration.

Parameters

\Drupal\views\ViewExecutable $view: The view used in this test.

$configuration: The join plugin configuration.

$table_alias: The table alias to use for the join.

Return value

array The join information for the joined table. See \Drupal\Core\Database\Query\Select::$tables for more information on the structure of the array.

2 calls to FieldOrLanguageJoinTest::buildJoin()
FieldOrLanguageJoinTest::testBase in core/modules/views/tests/src/Kernel/Plugin/FieldOrLanguageJoinTest.php
Tests base join functionality.
FieldOrLanguageJoinTest::testLanguageBundleConditions in core/modules/views/tests/src/Kernel/Plugin/FieldOrLanguageJoinTest.php
Tests the adding of conditions by the join plugin.

File

core/modules/views/tests/src/Kernel/Plugin/FieldOrLanguageJoinTest.php, line 195

Class

FieldOrLanguageJoinTest
Tests the "field OR language" join plugin.

Namespace

Drupal\Tests\views\Kernel\Plugin

Code

protected function buildJoin(ViewExecutable $view, $configuration, $table_alias) {

  // Build the actual join values and read them back from the query object.
  $query = \Drupal::database()
    ->select('node');
  $join = $this->manager
    ->createInstance('field_or_language_join', $configuration);
  $this
    ->assertInstanceOf(FieldOrLanguageJoin::class, $join);
  $table = [
    'alias' => $table_alias,
  ];
  $join
    ->buildJoin($query, $table, $view->query);
  $tables = $query
    ->getTables();
  $join_info = $tables[$table['alias']];
  return $join_info;
}