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

l10n_migrate/tests/fixtures/localize7_l10n_server_string.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\MigrateL10nServerStringTest 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_string', array(
  'fields' => array(
    'sid' => array(
      'type' => 'serial',
      'not null' => TRUE,
      'size' => 'normal',
    ),
    'value' => array(
      'type' => 'text',
      'not null' => TRUE,
      'size' => 'normal',
    ),
    'context' => array(
      'type' => 'varchar',
      'not null' => TRUE,
      'length' => '255',
      'default' => '',
    ),
    'hashkey' => array(
      'type' => 'char',
      'not null' => TRUE,
      'length' => '32',
    ),
  ),
  'primary key' => array(
    'sid',
  ),
  'unique keys' => array(
    'hashkey' => array(
      'hashkey',
    ),
  ),
  'mysql_character_set' => 'utf8mb4',
));

$rows = MigrateL10nTestAlias::expectedDataTable();
foreach ($rows as $row) {
  $connection->insert('l10n_server_string')
    ->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