function EntityContentBaseTest::testUntranslatable

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()
Same name in other branches
  1. 8.9.x core/modules/migrate_drupal/tests/src/Kernel/d6/EntityContentBaseTest.php \Drupal\Tests\migrate_drupal\Kernel\d6\EntityContentBaseTest::testUntranslatable()
  2. 8.9.x core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php \Drupal\Tests\migrate\Unit\Plugin\migrate\destination\EntityContentBaseTest::testUntranslatable()
  3. 10 core/modules/migrate_drupal/tests/src/Kernel/d6/EntityContentBaseTest.php \Drupal\Tests\migrate_drupal\Kernel\d6\EntityContentBaseTest::testUntranslatable()
  4. 10 core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php \Drupal\Tests\migrate\Unit\Plugin\migrate\destination\EntityContentBaseTest::testUntranslatable()
  5. 11.x core/modules/migrate_drupal/tests/src/Kernel/d6/EntityContentBaseTest.php \Drupal\Tests\migrate_drupal\Kernel\d6\EntityContentBaseTest::testUntranslatable()
  6. 11.x 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 81

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->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.