protected function BlockContentRevisionsTest::setUp in Drupal 10
Same name and namespace in other branches
- 8 core/modules/block_content/tests/src/Functional/BlockContentRevisionsTest.php \Drupal\Tests\block_content\Functional\BlockContentRevisionsTest::setUp()
- 9 core/modules/block_content/tests/src/Functional/BlockContentRevisionsTest.php \Drupal\Tests\block_content\Functional\BlockContentRevisionsTest::setUp()
Sets the test up.
File
- core/
modules/ block_content/ tests/ src/ Functional/ BlockContentRevisionsTest.php, line 36
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(REQUEST_TIME);
$logs[] = $block
->getRevisionLogMessage();
$block
->save();
$blocks[] = $block
->getRevisionId();
}
$this->blocks = $blocks;
$this->revisionLogs = $logs;
}