You are here

public function EntityContentBaseTest::testImportEntityLoadFailure in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php \Drupal\Tests\migrate\Unit\Plugin\migrate\destination\EntityContentBaseTest::testImportEntityLoadFailure()
  2. 9 core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php \Drupal\Tests\migrate\Unit\Plugin\migrate\destination\EntityContentBaseTest::testImportEntityLoadFailure()

Tests row skipping when we can't get an entity to save.

@covers ::import

File

core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php, line 62
Contains \Drupal\Tests\migrate\Unit\Plugin\migrate\destination\EntityContentBaseTest.

Class

EntityContentBaseTest
Tests base entity migration destination functionality.

Namespace

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

Code

public function testImportEntityLoadFailure() {
  $bundles = [];
  $destination = new EntityTestDestination([], '', [], $this->migration
    ->reveal(), $this->storage
    ->reveal(), $bundles, $this->entityFieldManager
    ->reveal(), $this
    ->prophesize(FieldTypePluginManagerInterface::class)
    ->reveal(), $this
    ->prophesize(AccountSwitcherInterface::class)
    ->reveal());
  $destination
    ->setEntity(FALSE);
  $this
    ->expectException(MigrateException::class);
  $this
    ->expectExceptionMessage('Unable to get entity');
  $destination
    ->import(new Row());
}