You are here

protected function NodeRevisionsTest::createRevisions in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/node/tests/src/Functional/NodeRevisionsTest.php \Drupal\Tests\node\Functional\NodeRevisionsTest::createRevisions()
  2. 9 core/modules/node/tests/src/Functional/NodeRevisionsTest.php \Drupal\Tests\node\Functional\NodeRevisionsTest::createRevisions()

Creates a series of revisions for the specified node.

Parameters

\Drupal\node\NodeInterface $node: The node object.

$count: The number of revisions to be created.

File

core/modules/node/tests/src/Functional/NodeRevisionsTest.php, line 474

Class

NodeRevisionsTest
Create a node with revisions and test viewing, saving, reverting, and deleting revisions for users with access for this content type.

Namespace

Drupal\Tests\node\Functional

Code

protected function createRevisions(NodeInterface $node, $count) {
  for ($i = 0; $i < $count; $i++) {
    $node->title = $this
      ->randomString();
    $node->untranslatable_string_field->value = $this
      ->randomString();
    $node
      ->setNewRevision(TRUE);
    $node
      ->save();
  }
}