You are here

public function RowTest::testMultipleSourceIdValues in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/migrate/tests/src/Unit/RowTest.php \Drupal\Tests\migrate\Unit\RowTest::testMultipleSourceIdValues()

Tests the multiple source IDs.

File

core/modules/migrate/tests/src/Unit/RowTest.php, line 236

Class

RowTest
@coversDefaultClass \Drupal\migrate\Row @group migrate

Namespace

Drupal\Tests\migrate\Unit

Code

public function testMultipleSourceIdValues() {

  // Set values in same order as ids.
  $multi_source_ids = $this->testSourceIds + [
    'vid' => 'Node revision',
    'type' => 'Node type',
    'langcode' => 'Node language',
  ];
  $multi_source_ids_values = $this->testValues + [
    'vid' => 1,
    'type' => 'page',
    'langcode' => 'en',
  ];
  $row = new Row($multi_source_ids_values, $multi_source_ids);
  $this
    ->assertSame(array_keys($multi_source_ids), array_keys($row
    ->getSourceIdValues()));

  // Set values in different order.
  $multi_source_ids = $this->testSourceIds + [
    'vid' => 'Node revision',
    'type' => 'Node type',
    'langcode' => 'Node language',
  ];
  $multi_source_ids_values = $this->testValues + [
    'langcode' => 'en',
    'type' => 'page',
    'vid' => 1,
  ];
  $row = new Row($multi_source_ids_values, $multi_source_ids);
  $this
    ->assertSame(array_keys($multi_source_ids), array_keys($row
    ->getSourceIdValues()));
}