/** * 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([], [])); }
/** * Helper method to create an entity revision destination with mock services. * * @see \Drupal\Tests\migrate\Unit\Destination\EntityRevision * * @param $configuration * Configuration for the destination. * @param string $plugin_id * The plugin id. * @param array $plugin_definition * The plugin definition. * * @return \Drupal\Tests\migrate\Unit\destination\EntityRevision * Mocked destination. */ protected function getEntityRevisionDestination(array $configuration = [], $plugin_id = 'entity_revision', array $plugin_definition = []) { return new EntityRevision($configuration, $plugin_id, $plugin_definition, $this->migration->reveal(), $this->storage->reveal(), [], $this->entityManager->reveal(), $this->fieldTypeManager->reveal()); }