function EntityRevisionTest::testSave

Same name in other branches
  1. 9 core/modules/migrate/tests/src/Unit/destination/EntityRevisionTest.php \Drupal\Tests\migrate\Unit\destination\EntityRevisionTest::testSave()
  2. 8.9.x core/modules/migrate/tests/src/Unit/destination/EntityRevisionTest.php \Drupal\Tests\migrate\Unit\destination\EntityRevisionTest::testSave()
  3. 10 core/modules/migrate/tests/src/Unit/destination/EntityRevisionTest.php \Drupal\Tests\migrate\Unit\destination\EntityRevisionTest::testSave()

Tests entity revision save.

@covers ::save

File

core/modules/migrate/tests/src/Unit/destination/EntityRevisionTest.php, line 165

Class

EntityRevisionTest
Tests entity revision destination.

Namespace

Drupal\Tests\migrate\Unit\destination

Code

public function testSave() : void {
    $entity = $this->prophesize(ContentEntityInterface::class);
    $entity->save()
        ->shouldBeCalled();
    // Syncing should be set once.
    $entity->setSyncing(Argument::exact(TRUE))
        ->shouldBeCalledTimes(1);
    $entity->getRevisionId()
        ->shouldBeCalled()
        ->willReturn(1234);
    $destination = $this->getEntityRevisionDestination();
    $this->assertEquals([
        1234,
    ], $destination->save($entity->reveal(), []));
}

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