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

l10n_migrate/tests/fixtures/localize7_l10n_server_project.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\MigrateL10nServerProjectTest 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_project', array(
  'fields' => array(
    'pid' => array(
      'type' => 'serial',
      'not null' => TRUE,
      'size' => 'normal',
    ),
    'uri' => array(
      'type' => 'varchar',
      'not null' => TRUE,
      'length' => '50',
    ),
    'title' => array(
      'type' => 'varchar',
      'not null' => TRUE,
      'length' => '128',
    ),
    'home_link' => array(
      'type' => 'text',
      'not null' => TRUE,
      'size' => 'normal',
    ),
    'last_parsed' => array(
      'type' => 'int',
      'not null' => FALSE,
      'size' => 'normal',
    ),
    'connector_module' => array(
      'type' => 'varchar',
      'not null' => TRUE,
      'length' => '50',
    ),
    'status' => array(
      'type' => 'int',
      'not null' => TRUE,
      'size' => 'normal',
    ),
    'weight' => array(
      'type' => 'int',
      'not null' => TRUE,
      'size' => 'normal',
      'default' => '0',
    ),
  ),
  'primary key' => array(
    'pid',
  ),
  'unique keys' => array(
    'uri_connector_module' => array(
      'uri',
      'connector_module',
    ),
  ),
  'indexes' => array(
    'uri' => array(
      'uri',
    ),
    'weight' => array(
      'weight',
    ),
  ),
  'mysql_character_set' => 'utf8mb4',
));

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