function EntityRevisionTest::testGetEntityLoadFailure

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

Class

EntityRevisionTest
Tests entity revision destination.

Namespace

Drupal\Tests\migrate\Unit\destination

Code

public function testGetEntityLoadFailure() : void {
    $destination = $this->getEntityRevisionDestination([]);
    // 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, []));
}

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