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

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

namespace Drupal\Tests\l10n_migrate\Kernel;

/**
 * Test l10n_packager_file migration.
 *
 * @group l10n_migrate
 */
class MigrateL10nPackagerReleaseTest extends MigrateL10nTestBase {

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

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

  /**
   * The entity class.
   */
  const ENTITY_CLASS = 'Drupal\l10n_packager\Entity\L10nPackagerRelease';

  /**
   * The database fields in Drupal 7.
   */
  const DATABASE_FIELDS_D7 = [
    'rid',
    'status',
    'checked',
    'updated',
  ];

  /**
   * The database fields in Drupal 10.
   */
  const DATABASE_FIELDS_D10 = [
    'rid',
    'status',
    'checked',
    '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);
      // @todo Fix entity id is string, should be integer.
      $this->assertSame($dataset['rid'], (int) $entity->id());
      $this->assertSame($dataset['status'], $entity->getStatus());
      $this->assertSame($dataset['checked'], $entity->getCheckedTime());
      $this->assertSame($dataset['updated'], $entity->getChangedTime());
    }
  }

  /**
   * {@inheritdoc}
   */
  public static function expectedDataTable(): array {
    return [
      0 => [
        'rid' => 14,
        'status' => 1,
        'checked' => 1685981406,
        'updated' => 1685878681,
      ],
    ];
  }

}

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

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