function EntityContentBaseTest::testImportEntityLoadFailure

Same name in other branches
  1. 9 core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php \Drupal\Tests\migrate\Unit\Plugin\migrate\destination\EntityContentBaseTest::testImportEntityLoadFailure()
  2. 8.9.x core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php \Drupal\Tests\migrate\Unit\Plugin\migrate\destination\EntityContentBaseTest::testImportEntityLoadFailure()
  3. 10 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 63

Class

EntityContentBaseTest
Tests base entity migration destination functionality.

Namespace

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

Code

public function testImportEntityLoadFailure() : void {
    $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());
}

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