You are here

protected function MigrateTestCase::createSchemaFromRow in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/migrate/tests/src/Unit/MigrateTestCase.php \Drupal\Tests\migrate\Unit\MigrateTestCase::createSchemaFromRow()
  2. 9 core/modules/migrate/tests/src/Unit/MigrateTestCase.php \Drupal\Tests\migrate\Unit\MigrateTestCase::createSchemaFromRow()

Generates a table schema from a row.

Parameters

array $row: The reference row on which to base the schema.

Return value

array The Schema API-ready table schema.

File

core/modules/migrate/tests/src/Unit/MigrateTestCase.php, line 149

Class

MigrateTestCase
Provides setup and helper methods for Migrate module tests.

Namespace

Drupal\Tests\migrate\Unit

Code

protected function createSchemaFromRow(array $row) {

  // SQLite uses loose ("affinity") typing, so it is OK for every column to be
  // a text field.
  $fields = array_map(function () {
    return [
      'type' => 'text',
    ];
  }, $row);
  return [
    'fields' => $fields,
  ];
}