You are here

public function EntityRevisionConverterTest::testDeprecatedLoadPendingRevisionFlag in Drupal 8

@covers ::convert @expectedDeprecationMessage The load_pending_revision flag has been deprecated. You should use load_latest_revision instead.

File

core/modules/content_moderation/tests/src/Kernel/EntityRevisionConverterTest.php, line 46

Class

EntityRevisionConverterTest
@coversDefaultClass \Drupal\content_moderation\ParamConverter\EntityRevisionConverter @group content_moderation @group legacy

Namespace

Drupal\Tests\content_moderation\Kernel

Code

public function testDeprecatedLoadPendingRevisionFlag() {
  NodeType::create([
    'type' => 'article',
  ])
    ->save();
  $node = Node::create([
    'title' => 'test',
    'type' => 'article',
  ]);
  $node
    ->save();
  $node
    ->isDefaultRevision(FALSE);
  $node
    ->setNewRevision(TRUE);
  $node
    ->save();
  $converted = $this->container
    ->get('paramconverter.latest_revision')
    ->convert($node
    ->id(), [
    'load_pending_revision' => TRUE,
    'type' => 'entity:node',
  ], 'node', []);
  $this
    ->assertEquals($converted
    ->getLoadedRevisionId(), $node
    ->getLoadedRevisionId());
}