function NodeRevisionPermissionsTest::setUp
Same name in other branches
- 9 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 49
Class
- NodeRevisionPermissionsTest
- Tests user permissions for node revisions.
Namespace
Drupal\Tests\node\FunctionalCode
protected function setUp() {
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;
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.