You are here

protected function MigrateSqlIdMapTest::getIdMap in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::getIdMap()

Creates a test SQL ID map plugin.

Return value

\Drupal\Tests\migrate\Unit\TestSqlIdMap A SQL ID map plugin test instance.

21 calls to MigrateSqlIdMapTest::getIdMap()
MigrateSqlIdMapTest::setupRows in core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php
Setup a database with the given rows.
MigrateSqlIdMapTest::testClearMessages in core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php
Tests the clear messages method.
MigrateSqlIdMapTest::testDestroy in core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php
Tests the destroy method.
MigrateSqlIdMapTest::testGetHighestId in core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php
Tests getHighestId method.
MigrateSqlIdMapTest::testGetHighestIdInvalid in core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php
Tests getHighestId method with invalid data.

... See full list

File

core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php, line 95

Class

MigrateSqlIdMapTest
Tests the SQL ID map plugin.

Namespace

Drupal\Tests\migrate\Unit

Code

protected function getIdMap() {
  $migration = $this
    ->getMigration();
  $plugin = $this
    ->createMock('Drupal\\migrate\\Plugin\\MigrateSourceInterface');
  $plugin
    ->method('getIds')
    ->willReturn($this->sourceIds);
  $migration
    ->method('getSourcePlugin')
    ->willReturn($plugin);
  $plugin = $this
    ->createMock('Drupal\\migrate\\Plugin\\MigrateDestinationInterface');
  $plugin
    ->method('getIds')
    ->willReturn($this->destinationIds);
  $migration
    ->method('getDestinationPlugin')
    ->willReturn($plugin);
  $event_dispatcher = $this
    ->createMock('Symfony\\Contracts\\EventDispatcher\\EventDispatcherInterface');
  $id_map = new TestSqlIdMap($this->database, [], 'sql', [], $migration, $event_dispatcher);
  $migration
    ->method('getIdMap')
    ->willReturn($id_map);
  return $id_map;
}