You are here

public function EntityConverterLatestRevisionTest::testEntityWithPendingRevision in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/ParamConverter/EntityConverterLatestRevisionTest.php \Drupal\KernelTests\Core\ParamConverter\EntityConverterLatestRevisionTest::testEntityWithPendingRevision()
  2. 10 core/tests/Drupal/KernelTests/Core/ParamConverter/EntityConverterLatestRevisionTest.php \Drupal\KernelTests\Core\ParamConverter\EntityConverterLatestRevisionTest::testEntityWithPendingRevision()

Tests with a pending revision.

File

core/tests/Drupal/KernelTests/Core/ParamConverter/EntityConverterLatestRevisionTest.php, line 85

Class

EntityConverterLatestRevisionTest
Tests the entity converter when the "load_latest_revision" flag is set.

Namespace

Drupal\KernelTests\Core\ParamConverter

Code

public function testEntityWithPendingRevision() {
  $entity = EntityTestMulRev::create();
  $entity
    ->save();
  $entity
    ->isDefaultRevision(FALSE);
  $entity
    ->setNewRevision(TRUE);
  $entity
    ->save();
  $converted = $this->converter
    ->convert(1, [
    'load_latest_revision' => TRUE,
    'type' => 'entity:entity_test_mulrev',
  ], 'foo', []);
  $this
    ->assertEquals($entity
    ->getLoadedRevisionId(), $converted
    ->getLoadedRevisionId());
}