You are here

protected function MigrateSqlIdMapEnsureTablesTest::runEnsureTablesTest in Zircon Profile 8.0

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

Actually run the test.

Parameters

array $schema: The mock schema object with expectations set. The Sql constructor calls ensureTables() which in turn calls this object and the expectations on it are the actual test and there are no additional asserts added.

2 calls to MigrateSqlIdMapEnsureTablesTest::runEnsureTablesTest()
MigrateSqlIdMapEnsureTablesTest::testEnsureTablesExist in core/modules/migrate/tests/src/Unit/MigrateSqlIdMapEnsureTablesTest.php
Tests the ensureTables method when the tables exist.
MigrateSqlIdMapEnsureTablesTest::testEnsureTablesNotExist in core/modules/migrate/tests/src/Unit/MigrateSqlIdMapEnsureTablesTest.php
Tests the ensureTables method when the tables do not exist.

File

core/modules/migrate/tests/src/Unit/MigrateSqlIdMapEnsureTablesTest.php, line 178
Contains \Drupal\Tests\migrate\Unit\MigrateSqlIdMapEnsureTablesTest.

Class

MigrateSqlIdMapEnsureTablesTest
Tests the SQL ID map plugin ensureTables() method.

Namespace

Drupal\Tests\migrate\Unit

Code

protected function runEnsureTablesTest($schema) {
  $database = $this
    ->getMockBuilder('Drupal\\Core\\Database\\Connection')
    ->disableOriginalConstructor()
    ->getMock();
  $database
    ->expects($this
    ->any())
    ->method('schema')
    ->willReturn($schema);
  $migration = $this
    ->getMigration();
  $plugin = $this
    ->getMock('Drupal\\migrate\\Plugin\\MigrateSourceInterface');
  $plugin
    ->expects($this
    ->any())
    ->method('getIds')
    ->willReturn(array(
    'source_id_property' => array(
      'type' => 'integer',
    ),
  ));
  $migration
    ->expects($this
    ->any())
    ->method('getSourcePlugin')
    ->willReturn($plugin);
  $plugin = $this
    ->getMock('Drupal\\migrate\\Plugin\\MigrateSourceInterface');
  $plugin
    ->expects($this
    ->any())
    ->method('getIds')
    ->willReturn(array(
    'destination_id_property' => array(
      'type' => 'string',
    ),
  ));
  $migration
    ->expects($this
    ->any())
    ->method('getDestinationPlugin')
    ->willReturn($plugin);

  /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher */
  $event_dispatcher = $this
    ->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface');
  $map = new TestSqlIdMap($database, array(), 'sql', array(), $migration, $event_dispatcher);
  $map
    ->getDatabase();
}