function MigrateSqlIdMapEnsureTablesTest::testEnsureTablesExist
Same name in other branches
- 9 core/modules/migrate/tests/src/Unit/MigrateSqlIdMapEnsureTablesTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapEnsureTablesTest::testEnsureTablesExist()
- 8.9.x core/modules/migrate/tests/src/Unit/MigrateSqlIdMapEnsureTablesTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapEnsureTablesTest::testEnsureTablesExist()
- 10 core/modules/migrate/tests/src/Unit/MigrateSqlIdMapEnsureTablesTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapEnsureTablesTest::testEnsureTablesExist()
Tests the ensureTables method when the tables exist.
File
-
core/
modules/ migrate/ tests/ src/ Unit/ MigrateSqlIdMapEnsureTablesTest.php, line 131
Class
- MigrateSqlIdMapEnsureTablesTest
- Tests the SQL ID map plugin ensureTables() method.
Namespace
Drupal\Tests\migrate\UnitCode
public function testEnsureTablesExist() : void {
$schema = $this->prophesize('Drupal\\Core\\Database\\Schema');
$schema->tableExists('migrate_map_sql_idmap_test')
->willReturn(TRUE);
$schema->fieldExists('migrate_map_sql_idmap_test', 'rollback_action')
->willReturn(FALSE);
$schema->fieldExists('migrate_map_sql_idmap_test', 'hash')
->willReturn(FALSE);
$schema->fieldExists('migrate_map_sql_idmap_test', 'source_ids_hash')
->willReturn(FALSE);
$schema->addField('migrate_map_sql_idmap_test', 'rollback_action', [
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Flag indicating what to do for this item on rollback',
])
->shouldBeCalled();
$schema->addField('migrate_map_sql_idmap_test', 'hash', [
'type' => 'varchar',
'length' => '64',
'not null' => FALSE,
'description' => 'Hash of source row data, for detecting changes',
])
->shouldBeCalled();
$schema->addField('migrate_map_sql_idmap_test', 'source_ids_hash', [
'type' => 'varchar',
'length' => '64',
'not null' => TRUE,
'description' => 'Hash of source ids. Used as primary key',
])
->shouldBeCalled();
$this->runEnsureTablesTest($schema->reveal());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.