MigrateStatusTest.php in Drupal 10
File
core/modules/migrate/tests/src/Kernel/MigrateStatusTest.php
View source
<?php
namespace Drupal\Tests\migrate\Kernel;
use Drupal\migrate\Plugin\MigrationInterface;
class MigrateStatusTest extends MigrateTestBase {
public function testStatus() {
$definition = [
'id' => 'migrate_status_test',
'migration_tags' => [
'Testing',
],
'source' => [
'plugin' => 'empty',
],
'destination' => [
'plugin' => 'config',
'config_name' => 'migrate_test.settings',
],
'process' => [
'foo' => 'bar',
],
];
$migration = \Drupal::service('plugin.manager.migration')
->createStubMigration($definition);
$status = $migration
->getStatus();
$this
->assertSame(MigrationInterface::STATUS_IDLE, $status);
$status_list = [
MigrationInterface::STATUS_IDLE,
MigrationInterface::STATUS_IMPORTING,
MigrationInterface::STATUS_ROLLING_BACK,
MigrationInterface::STATUS_STOPPING,
MigrationInterface::STATUS_DISABLED,
];
foreach ($status_list as $status) {
$migration
->setStatus($status);
$this
->assertSame($status, $migration
->getStatus());
}
}
}