public function MigrateTableIncrementTest::testTableDestination in Migrate Plus 8.5
Tests table destination.
@dataProvider tableDestinationMigration
Parameters
array $definition: The migration definition.
Throws
\Drupal\migrate\MigrateException
File
- tests/
src/ Kernel/ MigrateTableIncrementTest.php, line 126
Class
- MigrateTableIncrementTest
- Tests migration destination table with auto-increment keys.
Namespace
Drupal\Tests\migrate_plus\KernelCode
public function testTableDestination(array $definition) {
$migration = \Drupal::service('plugin.manager.migration')
->createStubMigration($definition);
$executable = new MigrateExecutable($migration, $this);
$executable
->import();
$values = $this->connection
->select(static::TABLE_NAME)
->fields(static::TABLE_NAME)
->execute()
->fetchAllAssoc('data1');
$this
->assertEquals(1, $values['dummy1 value1']->id);
$this
->assertEquals(2, $values['dummy1 value2']->id);
$this
->assertEquals(3, $values['dummy1 value3']->id);
$this
->assertEquals('dummy2 value3', $values['dummy1 value3']->data2);
$this
->assertCount(3, $values);
}