l10n_server-2.x-dev/l10n_migrate/tests/src/Kernel/MigrateL10nServerTranslationHistoryTest.php
l10n_migrate/tests/src/Kernel/MigrateL10nServerTranslationHistoryTest.php
<?php namespace Drupal\Tests\l10n_migrate\Kernel; /** * Test l10n_server_translation_history migration. * * @group l10n_migrate */ class MigrateL10nServerTranslationHistoryTest 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_history'; /** * The entity class. */ const ENTITY_CLASS = 'Drupal\l10n_server\Entity\L10nServerTranslationHistory'; /** * The database fields in Drupal 7. */ const DATABASE_FIELDS_D7 = [ 'tid', 'uid_action', 'time_action', 'type_action', 'medium_action', ]; /** * The database fields in Drupal 10. */ const DATABASE_FIELDS_D10 = [ 'tid', 'uid_action', 'time_action', 'type_action', 'medium_action', ]; /** * {@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 id value, should be integer. // $this->assertSame($dataset['tid'], (int) $entity->id()); $this->assertSame($dataset['uid_action'], $entity->getActionUid()); $this->assertSame($dataset['time_action'], $entity->getActionTime()); $this->assertSame($dataset['type_action'], (int) $entity->getActionType()); $this->assertSame($dataset['medium_action'], $entity->getActionMedium()); } } /** * {@inheritdoc} */ public static function expectedDataTable(): array { return [ 0 => [ 'tid' => 1526693, 'uid_action' => 136, 'time_action' => 1266768119, 'type_action' => 1, 'medium_action' => 0, ], ]; } }