l10n_server-2.x-dev/l10n_migrate/tests/src/Kernel/MigrateL10nPackagerFileTest.php
l10n_migrate/tests/src/Kernel/MigrateL10nPackagerFileTest.php
<?php namespace Drupal\Tests\l10n_migrate\Kernel; /** * Test l10n_packager_file migration. * * @group l10n_migrate */ class MigrateL10nPackagerFileTest 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_file'; /** * The entity class. */ const ENTITY_CLASS = 'Drupal\l10n_packager\Entity\L10nPackagerFile'; /** * The database fields in Drupal 7. */ const DATABASE_FIELDS_D7 = [ 'drid', 'rid', 'language', 'fid', 'checked', 'sid_count', ]; /** * The database fields in Drupal 10. */ const DATABASE_FIELDS_D10 = [ 'drid', 'rid', 'language', 'fid', 'checked', 'sid_count', ]; /** * {@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['drid'], (int) $entity->id()); $this->assertSame($dataset['rid'], $entity->getReleaseId()); $this->assertSame($dataset['language'], $entity->getLanguage()); $this->assertSame($dataset['fid'], $entity->getFileId()); $this->assertSame($dataset['checked'], $entity->getCheckedTime()); $this->assertSame($dataset['sid_count'], $entity->getStringCount()); } } /** * {@inheritdoc} */ public static function expectedDataTable(): array { return [ 0 => [ 'drid' => 30277451, 'rid' => 541088, 'language' => 'de', 'fid' => 31234852, 'checked' => 1684472043, 'sid_count' => 10447, ], ]; } }