function RowTest::testMultipleSourceIdValues

Same name in other branches
  1. 9 core/modules/migrate/tests/src/Unit/RowTest.php \Drupal\Tests\migrate\Unit\RowTest::testMultipleSourceIdValues()
  2. 10 core/modules/migrate/tests/src/Unit/RowTest.php \Drupal\Tests\migrate\Unit\RowTest::testMultipleSourceIdValues()
  3. 11.x 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()));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.