function RowTest::testMultipleDestination

Same name and namespace in other branches
  1. 8.9.x 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()
  3. 11.x 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 <a href="/api/drupal/core%21modules%21migrate%21src%21Row.php/class/Row/9" title="Stores a row." class="local">\Drupal\migrate\Row</a> @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'));
}

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