You are here

public function MigrationTest::testSetInvalidation in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/migrate/src/Tests/MigrationTest.php \Drupal\migrate\Tests\MigrationTest::testSetInvalidation()

Tests Migration::set()

@covers ::set()

File

core/modules/migrate/src/Tests/MigrationTest.php, line 33
Contains \Drupal\migrate\Tests\MigrationTest.

Class

MigrationTest
Tests the migration entity.

Namespace

Drupal\migrate\Tests

Code

public function testSetInvalidation() {
  $migration = Migration::create([
    'source' => [
      'plugin' => 'empty',
    ],
    'destination' => [
      'plugin' => 'entity:entity_view_mode',
    ],
  ]);
  $this
    ->assertEqual('empty', $migration
    ->getSourcePlugin()
    ->getPluginId());
  $this
    ->assertEqual('entity:entity_view_mode', $migration
    ->getDestinationPlugin()
    ->getPluginId());

  // Test the source plugin is invalidated.
  $migration
    ->set('source', [
    'plugin' => 'd6_field',
  ]);
  $this
    ->assertEqual('d6_field', $migration
    ->getSourcePlugin()
    ->getPluginId());

  // Test the destination plugin is invalidated.
  $migration
    ->set('destination', [
    'plugin' => 'null',
  ]);
  $this
    ->assertEqual('null', $migration
    ->getDestinationPlugin()
    ->getPluginId());
}