Esempio n. 1
0
 /**
  * Test row skipping when we can't get an entity to save.
  *
  * @covers ::import
  * @expectedException \Drupal\migrate\MigrateException
  * @expectedExceptionMessage Unable to get entity
  */
 public function testImportEntityLoadFailure()
 {
     $bundles = [];
     $destination = new EntityTestDestination([], '', [], $this->migration->reveal(), $this->storage->reveal(), $bundles, $this->entityManager->reveal(), $this->prophesize(FieldTypePluginManagerInterface::class)->reveal());
     $destination->setEntity(FALSE);
     $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->entityManager->getBaseFieldDefinitions('foo')->willReturn(['id' => BaseFieldDefinitionTest::create('integer')]);
     $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();
 }