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

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

namespace Drupal\Tests\l10n_migrate\Kernel;

/**
 * Test l10n_server_error migration.
 *
 * @group l10n_migrate
 */
class MigrateL10nServerErrorTest extends MigrateL10nTestBase {

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

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

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

  /**
   * The database fields in Drupal 7.
   */
  const DATABASE_FIELDS_D7 = [
    'eid',
    'rid',
    'value',
  ];

  /**
   * The database fields in Drupal 10.
   */
  const DATABASE_FIELDS_D10 = [
    'eid',
    'rid',
    'value',
  ];

  /**
   * {@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['eid'], (int) $entity->id());
      $this->assertSame($dataset['rid'], $entity->getReleaseId());
      $this->assertSame($dataset['value'], $entity->getValue());
    }
  }

  /**
   * {@inheritdoc}
   */
  public static function expectedDataTable(): array {
    return [
      0 => [
        'eid' => 3637725,
        'rid' => 541088,
        'value' => 'The first parameter to TranslatableMarkup() should be a literal string. There should be no variables, concatenation, constants or other non-literal strings there. At <em class="placeholder">TranslatableMarkup($string,$args,$options)</em> in <em class="placeholder">drupal-10.0.0/core/includes/bootstrap.inc</em> on line <em class="placeholder">102</em>. Read more at <a href="http://drupal.org/node/322732">http://drupal.org/node/322732</a>',
      ],
    ];
  }

}

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

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