protected function MigrateEntityContentBaseTest::assertTranslations in Drupal 9
Same name and namespace in other branches
- 8 core/modules/migrate/tests/src/Kernel/MigrateEntityContentBaseTest.php \Drupal\Tests\migrate\Kernel\MigrateEntityContentBaseTest::assertTranslations()
Check the existing translations of an entity.
Parameters
int $id: The entity ID.
string $default: The expected default translation language code.
string[] $others: The expected other translation language codes.
1 call to MigrateEntityContentBaseTest::assertTranslations()
- MigrateEntityContentBaseTest::testTranslated in core/
modules/ migrate/ tests/ src/ Kernel/ MigrateEntityContentBaseTest.php - Tests importing and rolling back translated entities.
File
- core/
modules/ migrate/ tests/ src/ Kernel/ MigrateEntityContentBaseTest.php, line 71
Class
- MigrateEntityContentBaseTest
- Tests the EntityContentBase destination.
Namespace
Drupal\Tests\migrate\KernelCode
protected function assertTranslations($id, $default, $others = []) {
$entity = $this->storage
->load($id);
$this
->assertNotEmpty($entity, "Entity exists");
$this
->assertEquals($default, $entity
->language()
->getId(), "Entity default translation");
$translations = array_keys($entity
->getTranslationLanguages(FALSE));
sort($others);
sort($translations);
$this
->assertEquals($others, $translations, "Entity translations");
}