diff -u b/core/modules/migrate/src/Entity/Migration.php b/core/modules/migrate/src/Entity/Migration.php --- b/core/modules/migrate/src/Entity/Migration.php +++ b/core/modules/migrate/src/Entity/Migration.php @@ -373,18 +373,16 @@ * {@inheritdoc} */ public function setMigrationStatus($status) { - \Drupal::state()->set('migrate.' . $this->id() . '.status', $status); + $migrate_status_store = \Drupal::keyValue('migrate_status'); + $migrate_status_store->set($this->id(), $status); } /** * {@inheritdoc} */ public function getMigrationStatus() { - $status = \Drupal::state()->get('migrate.' . $this->id() . '.status'); - if (is_null($status)) { - $status = MigrationInterface::STATUS_IDLE; - } - return $status; + $migrate_status_store = \Drupal::keyValue('migrate_status'); + return $migrate_status_store->get($this->id(), static::STATUS_IDLE); } /** diff -u b/core/modules/migrate/src/MigrateExecutable.php b/core/modules/migrate/src/MigrateExecutable.php --- b/core/modules/migrate/src/MigrateExecutable.php +++ b/core/modules/migrate/src/MigrateExecutable.php @@ -238,9 +238,8 @@ */ public function import() { // Only begin the import operation if the migration is currently idle. - if ($this->migration->getMigrationStatus() != MigrationInterface::STATUS_IDLE) { - $this->message->display( - $this->t('Migration @id is busy with another operation', array( + if ($this->migration->getMigrationStatus() !== MigrationInterface::STATUS_IDLE) { + $this->message->display($this->t('Migration @id is busy with another operation', array( '@id' => $this->migration->id(), )), 'error'); return MigrationInterface::RESULT_FAILED; @@ -279,7 +278,7 @@ while ($source->valid()) { // Primarily looking for STATUS_STOPPING here, but we should quit on any // unexpected status. - if ($this->migration->getMigrationStatus() != MigrationInterface::STATUS_IMPORTING) { + if ($this->migration->getMigrationStatus() !== MigrationInterface::STATUS_IMPORTING) { break; } $row = $source->current(); diff -u b/core/modules/migrate/tests/src/Unit/MigrateTestCase.php b/core/modules/migrate/tests/src/Unit/MigrateTestCase.php --- b/core/modules/migrate/tests/src/Unit/MigrateTestCase.php +++ b/core/modules/migrate/tests/src/Unit/MigrateTestCase.php @@ -9,6 +9,7 @@ use Drupal\Tests\UnitTestCase; use Drupal\Core\Database\Driver\fake\FakeConnection; +use Drupal\migrate\Entity\MigrationInterface; /** * Provides setup and helper methods for Migrate module tests. @@ -20,7 +21,7 @@ /** * @var \Drupal\migrate\Entity\MigrationInterface::STATUS_* */ - protected $migrationStatus; + protected $migrationStatus = MigrationInterface::STATUS_IDLE; /** * Retrieve a mocked migration.