function SqlTest::testFailEnsureTables

Same name and namespace in other branches
  1. 9 core/modules/migrate/tests/src/Kernel/Plugin/id_map/SqlTest.php \Drupal\Tests\migrate\Kernel\Plugin\id_map\SqlTest::testFailEnsureTables()
  2. 10 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_map

Code

public function testFailEnsureTables($ids) : void {
    // 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->migrationPluginManager);
    $this->expectException(SchemaTableColumnSizeTooLargeException::class);
    $map->ensureTables();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.