You are here

protected function MigrateSourceTestBase::setUp in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/migrate/tests/src/Kernel/MigrateSourceTestBase.php \Drupal\Tests\migrate\Kernel\MigrateSourceTestBase::setUp()
  2. 9 core/modules/migrate/tests/src/Kernel/MigrateSourceTestBase.php \Drupal\Tests\migrate\Kernel\MigrateSourceTestBase::setUp()

File

core/modules/migrate/tests/src/Kernel/MigrateSourceTestBase.php, line 56

Class

MigrateSourceTestBase
Base class for tests of Migrate source plugins.

Namespace

Drupal\Tests\migrate\Kernel

Code

protected function setUp() : void {
  parent::setUp();

  // Create a mock migration. This will be injected into the source plugin
  // under test.
  $this->migration = $this
    ->prophesize(MigrationInterface::class);
  $this->migration
    ->id()
    ->willReturn($this
    ->randomMachineName(16));

  // Prophesize a useless ID map plugin and an empty set of destination IDs.
  // Calling code can override these prophecies later and set up different
  // behaviors.
  $this->migration
    ->getIdMap()
    ->willReturn($this
    ->prophesize(MigrateIdMapInterface::class)
    ->reveal());
  $this->migration
    ->getDestinationIds()
    ->willReturn([]);
}