MigrationTest.php in Drupal 10
File
core/modules/migrate/tests/src/Kernel/MigrationTest.php
View source
<?php
namespace Drupal\Tests\migrate\Kernel;
use Drupal\KernelTests\KernelTestBase;
class MigrationTest extends KernelTestBase {
protected static $modules = [
'migrate',
'field',
];
public function testSetInvalidation() {
$migration = \Drupal::service('plugin.manager.migration')
->createStubMigration([
'source' => [
'plugin' => 'empty',
],
'destination' => [
'plugin' => 'entity:entity_view_mode',
],
]);
$this
->assertEquals('empty', $migration
->getSourcePlugin()
->getPluginId());
$this
->assertEquals('entity:entity_view_mode', $migration
->getDestinationPlugin()
->getPluginId());
$migration
->set('source', [
'plugin' => 'embedded_data',
'data_rows' => [],
'ids' => [],
]);
$this
->assertEquals('embedded_data', $migration
->getSourcePlugin()
->getPluginId());
$migration
->set('destination', [
'plugin' => 'null',
]);
$this
->assertEquals('null', $migration
->getDestinationPlugin()
->getPluginId());
}
}