protected function NodeRevisionPermissionsTest::setUp in Drupal 9
Same name and namespace in other branches
- 8 core/modules/node/tests/src/Functional/NodeRevisionPermissionsTest.php \Drupal\Tests\node\Functional\NodeRevisionPermissionsTest::setUp()
Overrides NodeTestBase::setUp
File
- core/
modules/ node/ tests/ src/ Functional/ NodeRevisionPermissionsTest.php, line 57
Class
- NodeRevisionPermissionsTest
- Tests user permissions for node revisions.
Namespace
Drupal\Tests\node\FunctionalCode
protected function setUp() : void {
parent::setUp();
$types = [
'page',
'article',
];
foreach ($types as $type) {
// Create a node with several revisions.
$nodes[$type] = $this
->drupalCreateNode([
'type' => $type,
]);
$this->nodeRevisions[$type][] = $nodes[$type];
for ($i = 0; $i < 3; $i++) {
// Create a revision for the same nid and settings with a random log.
$revision = clone $nodes[$type];
$revision
->setNewRevision();
$revision->revision_log = $this
->randomMachineName(32);
$revision
->save();
$this->nodeRevisions[$type][] = $revision;
}
}
}