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. 10 core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php \Drupal\Tests\migrate\Unit\Plugin\migrate\destination\EntityContentBaseTest::testImportEntityLoadFailure()
  3. 11.x core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php \Drupal\Tests\migrate\Unit\Plugin\migrate\destination\EntityContentBaseTest::testImportEntityLoadFailure()

Test 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 59

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());
    $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.