function EntityContentBaseTest::testOverwriteProperties

Same name in other branches
  1. 8.9.x core/modules/migrate_drupal/tests/src/Kernel/d6/EntityContentBaseTest.php \Drupal\Tests\migrate_drupal\Kernel\d6\EntityContentBaseTest::testOverwriteProperties()
  2. 10 core/modules/migrate_drupal/tests/src/Kernel/d6/EntityContentBaseTest.php \Drupal\Tests\migrate_drupal\Kernel\d6\EntityContentBaseTest::testOverwriteProperties()
  3. 11.x core/modules/migrate_drupal/tests/src/Kernel/d6/EntityContentBaseTest.php \Drupal\Tests\migrate_drupal\Kernel\d6\EntityContentBaseTest::testOverwriteProperties()

Tests overwriting selected properties in the destination entity.

The selected properties are specified in the destination configuration.

File

core/modules/migrate_drupal/tests/src/Kernel/d6/EntityContentBaseTest.php, line 78

Class

EntityContentBaseTest
@group migrate_drupal

Namespace

Drupal\Tests\migrate_drupal\Kernel\d6

Code

public function testOverwriteProperties() {
    // Execute the migration in migrate_overwrite_test, which documents how
    // property overwrites work.
    $this->executeMigration('users');
    
    /** @var \Drupal\user\UserInterface $account */
    $account = User::load(2);
    $this->assertSame('john.doe', $account->label());
    $this->assertSame('john.doe@example.com', $account->getEmail());
    $this->assertSame('The answer is 42.', $account->signature->value);
    // This value is not overwritten because it's not listed in
    // overwrite_properties.
    $this->assertSame('proto@zo.an', $account->getInitialEmail());
}

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