function EntityContentBaseTest::testUntranslatable
Tests that translation destination fails for untranslatable entities.
File
- 
              core/modules/ migrate/ tests/ src/ Unit/ Plugin/ migrate/ destination/ EntityContentBaseTest.php, line 81 
Class
- EntityContentBaseTest
- Tests base entity migration destination functionality.
Namespace
Drupal\Tests\migrate\Unit\Plugin\migrate\destinationCode
public function testUntranslatable() {
  // An entity type without a language.
  $this->entityType
    ->getKey('langcode')
    ->willReturn('');
  $this->entityType
    ->getKey('id')
    ->willReturn('id');
  $this->entityFieldManager
    ->getBaseFieldDefinitions('foo')
    ->willReturn([
    'id' => BaseFieldDefinitionTest::create('integer'),
  ]);
  $destination = new EntityTestDestination([
    'translations' => TRUE,
  ], '', [], $this->migration
    ->reveal(), $this->storage
    ->reveal(), [], $this->entityFieldManager
    ->reveal(), $this->prophesize(FieldTypePluginManagerInterface::class)
    ->reveal(), $this->prophesize(AccountSwitcherInterface::class)
    ->reveal());
  $this->expectException(MigrateException::class);
  $this->expectExceptionMessage('The "foo" entity type does not support translations.');
  $destination->getIds();
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
