l10n_server-2.x-dev/l10n_migrate/tests/fixtures/localize7_l10n_server_file.php

l10n_migrate/tests/fixtures/localize7_l10n_server_file.php
<?php
// phpcs:ignoreFile
/**
 * @file
 * A database agnostic dump for testing purposes.
 *
 * This file is based on one generated by the Drupal 10.1.5 db-tools.php
 * script.
 */

use Drupal\Core\Database\Database;
use Drupal\Tests\l10n_migrate\Kernel\MigrateL10nServerFileTest as MigrateL10nTestAlias;

$connection = Database::getConnection();

// Ensure any tables with a serial column with a value of 0 are created as
// expected.
if ($connection->databaseType() === 'mysql') {
  $sql_mode = $connection->query("SELECT @@sql_mode;")->fetchField();
  $connection->query("SET sql_mode = '$sql_mode,NO_AUTO_VALUE_ON_ZERO'");
}

$connection->schema()->createTable('l10n_server_file', array(
  'fields' => array(
    'fid' => array(
      'type' => 'serial',
      'not null' => TRUE,
      'size' => 'normal',
    ),
    'rid' => array(
      'type' => 'int',
      'not null' => FALSE,
      'size' => 'normal',
    ),
    'location' => array(
      'type' => 'varchar',
      'not null' => TRUE,
      'length' => '255',
    ),
    'revision' => array(
      'type' => 'varchar',
      'not null' => TRUE,
      'length' => '255',
    ),
    'pid' => array(
      'type' => 'int',
      'not null' => FALSE,
      'size' => 'normal',
    ),
  ),
  'primary key' => array(
    'fid',
  ),
  'indexes' => array(
    'rid' => array(
      'rid',
    ),
    'pid' => array(
      'pid',
    ),
  ),
  'mysql_character_set' => 'utf8mb4',
));

$rows = MigrateL10nTestAlias::expectedDataTable();
foreach ($rows as $row) {
  $connection->insert('l10n_server_file')
    ->fields(array_keys(current($rows)))
    ->values($row)
    ->execute();
}

// Reset the SQL mode.
if ($connection->databaseType() === 'mysql') {
  $connection->query("SET sql_mode = '$sql_mode'");
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc