function EntityRevisionTest::testUntranslatable

Same name in other branches
  1. 9 core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityRevisionTest.php \Drupal\Tests\migrate\Unit\Plugin\migrate\destination\EntityRevisionTest::testUntranslatable()
  2. 10 core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityRevisionTest.php \Drupal\Tests\migrate\Unit\Plugin\migrate\destination\EntityRevisionTest::testUntranslatable()
  3. 11.x core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityRevisionTest.php \Drupal\Tests\migrate\Unit\Plugin\migrate\destination\EntityRevisionTest::testUntranslatable()

Tests that translation destination fails for untranslatable entities.

File

core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityRevisionTest.php, line 66

Class

EntityRevisionTest
Tests entity revision destination functionality.

Namespace

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

Code

public function testUntranslatable() {
    $this->entityType
        ->getKey('id')
        ->willReturn('id');
    $this->entityType
        ->getKey('revision')
        ->willReturn('vid');
    $this->entityType
        ->getKey('langcode')
        ->willReturn('');
    $this->entityFieldManager
        ->getBaseFieldDefinitions('foo')
        ->willReturn([
        'id' => BaseFieldDefinitionTest::create('integer'),
        'vid' => BaseFieldDefinitionTest::create('integer'),
    ]);
    $destination = new EntityRevisionTestDestination([
        '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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.