protected function NodeRevisionsAllTest::createNodeRevision in Drupal 8
Same name and namespace in other branches
- 9 core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php \Drupal\Tests\node\Functional\NodeRevisionsAllTest::createNodeRevision()
Creates a new revision for a given node.
Parameters
\Drupal\node\NodeInterface $node: A node object.
Return value
\Drupal\node\NodeInterface A node object with up to date revision information.
2 calls to NodeRevisionsAllTest::createNodeRevision()
- NodeRevisionsAllTest::setUp in core/
modules/ node/ tests/ src/ Functional/ NodeRevisionsAllTest.php - NodeRevisionsAllTest::testRevisions in core/
modules/ node/ tests/ src/ Functional/ NodeRevisionsAllTest.php - Checks node revision operations.
File
- core/
modules/ node/ tests/ src/ Functional/ NodeRevisionsAllTest.php, line 98
Class
- NodeRevisionsAllTest
- Create a node with revisions and test viewing, saving, reverting, and deleting revisions for user with access to all.
Namespace
Drupal\Tests\node\FunctionalCode
protected function createNodeRevision(NodeInterface $node) {
// Create revision with a random title and body and update variables.
$node->title = $this
->randomMachineName();
$node->body = [
'value' => $this
->randomMachineName(32),
'format' => filter_default_format(),
];
$node
->setNewRevision();
// Ensure the revision author is a different user.
$node
->setRevisionUserId($this->revisionUser
->id());
$node
->save();
return $node;
}