l10n_server-2.x-dev/l10n_migrate/tests/src/Kernel/MigrateL10nServerTranslationTest.php

l10n_migrate/tests/src/Kernel/MigrateL10nServerTranslationTest.php
<?php

namespace Drupal\Tests\l10n_migrate\Kernel;

/**
 * Test l10n_server_translation migration.
 *
 * @group l10n_migrate
 */
class MigrateL10nServerTranslationTest extends MigrateL10nTestBase {

  /**
   * {@inheritdoc}
   */
  protected static $modules = [
    'node',
    'l10n_migrate',
    'l10n_server',
    'migrate',
    'migrate_plus',
    'text',
    'taxonomy',
  ];

  /**
   * The entity type.
   */
  const ENTITY_TYPE = 'l10n_server_translation';

  /**
   * The entity class.
   */
  const ENTITY_CLASS = 'Drupal\l10n_server\Entity\L10nServerTranslation';

  /**
   * The database fields in Drupal 7.
   */
  const DATABASE_FIELDS_D7 = [
    'tid',
    'sid',
    'language',
    'translation',
    'uid_entered',
    'time_entered',
    'is_suggestion',
    'is_active',
    'time_changed',
  ];

  /**
   * The database fields in Drupal 10.
   */
  const DATABASE_FIELDS_D10 = [
    'tid',
    'sid',
    'language',
    'translation',
    'uid',
    'created',
    'suggestion',
    'status',
    'changed',
  ];

  /**
   * {@inheritdoc}
   */
  protected function setUp(): void {
    parent::setUp();
    $this->executeMigrations([static::ENTITY_TYPE]);
  }

  /**
   * {@inheritdoc}
   */
  protected function assertEntityAttributesValid(): void {
    $datasets = static::expectedDataTable();
    $entities = $this->entityStorage->loadMultiple();
    foreach ($entities as $entity) {
      $dataset = array_shift($datasets);
    }
  }

  /**
   * {@inheritdoc}
   */
  public static function expectedDataTable(): array {
    return [
      0 => [
        'tid' => 1526693,
        'sid' => 20842,
        'language' => 'de',
        'translation' => 'Wir führen auf @site momentan Wartungsarbeiten durch und sollten bald wieder erreichbar sein. Vielen Dank für Ihre Geduld.',
        'uid_entered' => 136,
        'time_entered' => 1266768119,
        'is_suggestion' => 0,
        'is_active' => 1,
        'time_changed' => 1571350936,
      ],
    ];
  }

}

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

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