summaryrefslogtreecommitdiffstats
path: root/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php')
-rw-r--r--core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php b/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php
index da20b49..33aec58 100644
--- a/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php
+++ b/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php
@@ -8,6 +8,7 @@
namespace Drupal\Tests\migrate\Unit\Plugin\migrate\destination;
use Drupal\Core\Entity\ContentEntityInterface;
+use Drupal\Core\Entity\ContentEntityType;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Field\FieldTypePluginManagerInterface;
@@ -97,6 +98,33 @@ class EntityContentBaseTest extends UnitTestCase {
$destination->import(new Row([], []));
}
+ /**
+ * Test that translation destination fails for untranslatable entities.
+ *
+ * @expectedException \Drupal\migrate\MigrateException
+ * @expectedExceptionMessage This entity type does not support translation
+ */
+ public function testUntranslatable() {
+ // An entity type without a language.
+ $entity_type = $this->prophesize(ContentEntityType::class);
+ $entity_type->getKey('langcode')->willReturn('');
+ $entity_type->getKey('id')->willReturn('id');
+
+ $this->storage->getEntityType()->willReturn($entity_type->reveal());
+
+ $destination = new EntityTestDestination(
+ [ 'translations' => TRUE ],
+ '',
+ [],
+ $this->migration->reveal(),
+ $this->storage->reveal(),
+ [],
+ $this->entityManager->reveal(),
+ $this->prophesize(FieldTypePluginManagerInterface::class)->reveal()
+ );
+ $destination->getIds();
+ }
+
}
/**