You are here

protected function MigrateTestCase::createSchemaFromRow in Drupal 9

Same name and namespace in other branches
  1. 8 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.

2 calls to MigrateTestCase::createSchemaFromRow()
MigrateSqlIdMapTest::saveMap in core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php
Saves a single ID mapping row in the database.
MigrateTestCase::getDatabase in core/modules/migrate/tests/src/Unit/MigrateTestCase.php
Gets an SQLite database connection object for use in tests.

File

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

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,
  ];
}