You are here

public function RowTest::testMultipleDestination in Drupal 8

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

Tests setting/getting multiple destination IDs.

File

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

Class

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

Namespace

Drupal\Tests\migrate\Unit

Code

public function testMultipleDestination() {
  $row = new Row($this->testValues, $this->testSourceIds);

  // Set some deep nested values.
  $row
    ->setDestinationProperty('image/alt', 'alt text');
  $row
    ->setDestinationProperty('image/fid', 3);
  $this
    ->assertTrue($row
    ->hasDestinationProperty('image'));
  $this
    ->assertFalse($row
    ->hasDestinationProperty('alt'));
  $this
    ->assertFalse($row
    ->hasDestinationProperty('fid'));
  $destination = $row
    ->getDestination();
  $this
    ->assertEquals('alt text', $destination['image']['alt']);
  $this
    ->assertEquals(3, $destination['image']['fid']);
  $this
    ->assertEquals('alt text', $row
    ->getDestinationProperty('image/alt'));
  $this
    ->assertEquals(3, $row
    ->getDestinationProperty('image/fid'));
}