You are here

public function EntityContentBaseTest::testUntranslatable in Drupal 9

Same name in this branch
  1. 9 core/modules/migrate_drupal/tests/src/Kernel/d6/EntityContentBaseTest.php \Drupal\Tests\migrate_drupal\Kernel\d6\EntityContentBaseTest::testUntranslatable()
  2. 9 core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php \Drupal\Tests\migrate\Unit\Plugin\migrate\destination\EntityContentBaseTest::testUntranslatable()
Same name and namespace in other branches
  1. 8 core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php \Drupal\Tests\migrate\Unit\Plugin\migrate\destination\EntityContentBaseTest::testUntranslatable()

Tests that translation destination fails for untranslatable entities.

File

core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php, line 76
Contains \Drupal\Tests\migrate\Unit\Plugin\migrate\destination\EntityContentBaseTest.

Class

EntityContentBaseTest
Tests base entity migration destination functionality.

Namespace

Drupal\Tests\migrate\Unit\Plugin\migrate\destination

Code

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
    ->expectException(MigrateException::class);
  $this
    ->expectExceptionMessage('The "foo" entity type does not support translations.');
  $destination
    ->getIds();
}