class MigrationTest in Drupal 10
Same name in this branch
- 10 core/modules/migrate/tests/src/Unit/MigrationTest.php \Drupal\Tests\migrate\Unit\MigrationTest
- 10 core/modules/migrate/tests/src/Kernel/MigrationTest.php \Drupal\Tests\migrate\Kernel\MigrationTest
- 10 core/modules/migrate/tests/src/Kernel/Plugin/MigrationTest.php \Drupal\Tests\migrate\Kernel\Plugin\MigrationTest
Same name and namespace in other branches
- 8 core/modules/migrate/tests/src/Kernel/MigrationTest.php \Drupal\Tests\migrate\Kernel\MigrationTest
- 9 core/modules/migrate/tests/src/Kernel/MigrationTest.php \Drupal\Tests\migrate\Kernel\MigrationTest
Tests the migration plugin.
@group migrate
@coversDefaultClass \Drupal\migrate\Plugin\Migration
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \PHPUnit\Framework\TestCase implements ServiceProviderInterface uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, AssertContentTrait, ConfigTestTrait, ExtensionListTestTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings
- class \Drupal\Tests\migrate\Kernel\MigrationTest
Expanded class hierarchy of MigrationTest
File
- core/
modules/ migrate/ tests/ src/ Kernel/ MigrationTest.php, line 14
Namespace
Drupal\Tests\migrate\KernelView source
class MigrationTest extends KernelTestBase {
/**
* Enable field because we are using one of its source plugins.
*
* @var array
*/
protected static $modules = [
'migrate',
'field',
];
/**
* Tests Migration::set().
*
* @covers ::set
*/
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());
// Test the source plugin is invalidated.
$migration
->set('source', [
'plugin' => 'embedded_data',
'data_rows' => [],
'ids' => [],
]);
$this
->assertEquals('embedded_data', $migration
->getSourcePlugin()
->getPluginId());
// Test the destination plugin is invalidated.
$migration
->set('destination', [
'plugin' => 'null',
]);
$this
->assertEquals('null', $migration
->getDestinationPlugin()
->getPluginId());
}
}