public function SqlTest::testFailEnsureTables in Drupal 10
Same name and namespace in other branches
- 9 core/modules/migrate/tests/src/Kernel/Plugin/id_map/SqlTest.php \Drupal\Tests\migrate\Kernel\Plugin\id_map\SqlTest::testFailEnsureTables()
Tests exception is thrown in ensureTables fails.
@dataProvider providerTestFailEnsureTables
File
- core/
modules/ migrate/ tests/ src/ Kernel/ Plugin/ id_map/ SqlTest.php, line 140
Class
- SqlTest
- Tests that the migrate map table is created.
Namespace
Drupal\Tests\migrate\Kernel\Plugin\id_mapCode
public function testFailEnsureTables($ids) {
// This just tests mysql, as other PDO integrations allow longer indexes.
if (Database::getConnection()
->databaseType() !== 'mysql') {
$this
->markTestSkipped("This test only runs for MySQL");
}
$this->migrationDefinition['source']['ids'] = $ids;
$migration = $this->container
->get('plugin.manager.migration')
->createStubMigration($this->migrationDefinition);
// Use local id map plugin to force an error.
$map = new SqlIdMapTest($this->database, [], 'test', [], $migration, $this->eventDispatcher);
$this
->expectException(DatabaseExceptionWrapper::class);
$this
->expectExceptionMessage("Syntax error or access violation: 1074 Column length too big for column 'sourceid1' (max = 16383); use BLOB or TEXT instead:");
$map
->ensureTables();
}