function MigrateSqlIdMapEnsureTablesTest::runEnsureTablesTest
Same name in other branches
- 9 core/modules/migrate/tests/src/Unit/MigrateSqlIdMapEnsureTablesTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapEnsureTablesTest::runEnsureTablesTest()
- 8.9.x core/modules/migrate/tests/src/Unit/MigrateSqlIdMapEnsureTablesTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapEnsureTablesTest::runEnsureTablesTest()
- 11.x 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 169
Class
- MigrateSqlIdMapEnsureTablesTest
- Tests the SQL ID map plugin ensureTables() method.
Namespace
Drupal\Tests\migrate\UnitCode
protected function runEnsureTablesTest($schema) {
$database = $this->getMockBuilder('Drupal\\Core\\Database\\Connection')
->disableOriginalConstructor()
->getMock();
$database->expects($this->any())
->method('schema')
->willReturn($schema);
$database->expects($this->any())
->method('tablePrefix')
->willReturn('');
$migration = $this->getMigration();
$plugin = $this->createMock('Drupal\\migrate\\Plugin\\MigrateSourceInterface');
$plugin->expects($this->any())
->method('getIds')
->willReturn([
'source_id_property' => [
'type' => 'integer',
],
'source_id_property_2' => [
'type' => 'integer',
],
]);
$migration->expects($this->any())
->method('getSourcePlugin')
->willReturn($plugin);
$plugin = $this->createMock('Drupal\\migrate\\Plugin\\MigrateSourceInterface');
$plugin->expects($this->any())
->method('getIds')
->willReturn([
'destination_id_property' => [
'type' => 'string',
],
]);
$migration->expects($this->any())
->method('getDestinationPlugin')
->willReturn($plugin);
/** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface $event_dispatcher */
$event_dispatcher = $this->createMock('Symfony\\Contracts\\EventDispatcher\\EventDispatcherInterface');
$migration_manager = $this->createMock('Drupal\\migrate\\Plugin\\MigrationPluginManagerInterface');
$map = new TestSqlIdMap($database, [], 'sql', [], $migration, $event_dispatcher, $migration_manager);
$map->getDatabase();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.