public function EntityRevisionTest::testGetEntityLoadFailure in Drupal 9
Same name and namespace in other branches
- 8 core/modules/migrate/tests/src/Unit/destination/EntityRevisionTest.php \Drupal\Tests\migrate\Unit\destination\EntityRevisionTest::testGetEntityLoadFailure()
Tests entity load failure.
@covers ::getEntity
File
- core/
modules/ migrate/ tests/ src/ Unit/ destination/ EntityRevisionTest.php, line 142 - Contains \Drupal\Tests\migrate\Unit\destination\EntityRevisionTest.
Class
- EntityRevisionTest
- Tests entity revision destination.
Namespace
Drupal\Tests\migrate\Unit\destinationCode
public function testGetEntityLoadFailure() {
$destination = $this
->getEntityRevisionDestination([]);
$entity_type = $this
->prophesize('\\Drupal\\Core\\Entity\\EntityTypeInterface');
$entity_type
->getKey('id')
->willReturn('nid');
$entity_type
->getKey('revision')
->willReturn('vid');
$this->storage
->getEntityType()
->willReturn($entity_type
->reveal());
// Return a failed load and make sure we don't fail and we return FALSE.
$this->storage
->load(1)
->shouldBeCalled()
->willReturn(FALSE);
$row = new Row([
'nid' => 1,
'vid' => 2,
], [
'nid' => 1,
'vid' => 2,
]);
$row
->setDestinationProperty('nid', 1);
$this
->assertFalse($destination
->getEntity($row, []));
}