You are here

protected function MigrateTestCase::createSchemaFromRow in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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
Get an SQLite database connection object for use in tests.

File

core/modules/migrate/tests/src/Unit/MigrateTestCase.php, line 144
Contains \Drupal\Tests\migrate\Unit\MigrateTestCase.

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's OK for every column
  // to be a text field.
  $fields = array_map(function () {
    return [
      'type' => 'text',
    ];
  }, $row);
  return [
    'fields' => $fields,
  ];
}