function MigrateSqlIdMapTest::testDestroy
Same name in other branches
- 9 core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::testDestroy()
- 8.9.x core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::testDestroy()
- 11.x core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::testDestroy()
Tests the destroy method.
Scenarios to test for:
- No errors.
- One error.
- Multiple errors.
File
-
core/
modules/ migrate/ tests/ src/ Unit/ MigrateSqlIdMapTest.php, line 983
Class
- MigrateSqlIdMapTest
- Tests the SQL ID map plugin.
Namespace
Drupal\Tests\migrate\UnitCode
public function testDestroy() : void {
$id_map = $this->getIdMap();
// Initialize the ID map.
$id_map->getDatabase();
$map_table_name = $id_map->mapTableName();
$message_table_name = $id_map->messageTableName();
$row = new Row([
'source_id_property' => 'source_value',
], [
'source_id_property' => [],
]);
$id_map->saveIdMapping($row, [
'destination_id_property' => 2,
]);
$id_map->saveMessage([
'source_id_property' => 'source_value',
], 'A message');
$this->assertTrue($this->database
->schema()
->tableExists($map_table_name), "{$map_table_name} exists");
$this->assertTrue($this->database
->schema()
->tableExists($message_table_name), "{$message_table_name} exists");
$id_map->destroy();
$this->assertFalse($this->database
->schema()
->tableExists($map_table_name), "{$map_table_name} does not exist");
$this->assertFalse($this->database
->schema()
->tableExists($message_table_name), "{$message_table_name} does not exist");
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.