function BlockContentRevisionsTest::setUp
Same name in this branch
- 10 core/modules/block_content/tests/src/Kernel/BlockContentRevisionsTest.php \Drupal\Tests\block_content\Kernel\BlockContentRevisionsTest::setUp()
Same name in other branches
- 9 core/modules/block_content/tests/src/Functional/BlockContentRevisionsTest.php \Drupal\Tests\block_content\Functional\BlockContentRevisionsTest::setUp()
- 8.9.x core/modules/block_content/tests/src/Functional/BlockContentRevisionsTest.php \Drupal\Tests\block_content\Functional\BlockContentRevisionsTest::setUp()
- 11.x core/modules/block_content/tests/src/Kernel/BlockContentRevisionsTest.php \Drupal\Tests\block_content\Kernel\BlockContentRevisionsTest::setUp()
- 11.x core/modules/block_content/tests/src/Functional/BlockContentRevisionsTest.php \Drupal\Tests\block_content\Functional\BlockContentRevisionsTest::setUp()
Sets the test up.
Overrides BlockContentTestBase::setUp
File
-
core/
modules/ block_content/ tests/ src/ Functional/ BlockContentRevisionsTest.php, line 37
Class
- BlockContentRevisionsTest
- Create a block with revisions.
Namespace
Drupal\Tests\block_content\FunctionalCode
protected function setUp() : void {
parent::setUp();
// Create initial block.
$block = $this->createBlockContent('initial');
$blocks = [];
$logs = [];
// Get original block.
$blocks[] = $block->getRevisionId();
$logs[] = '';
// Create three revisions.
$revision_count = 3;
for ($i = 0; $i < $revision_count; $i++) {
$block->setNewRevision(TRUE);
$block->setRevisionLogMessage($this->randomMachineName(32));
$block->setRevisionUser($this->adminUser);
$block->setRevisionCreationTime(time());
$logs[] = $block->getRevisionLogMessage();
$block->save();
$blocks[] = $block->getRevisionId();
}
$this->blocks = $blocks;
$this->revisionLogs = $logs;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.