You are here

protected function BlockContentRevisionsTest::setUp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/block_content/src/Tests/BlockContentRevisionsTest.php \Drupal\block_content\Tests\BlockContentRevisionsTest::setUp()

Sets the test up.

Overrides BlockContentTestBase::setUp

File

core/modules/block_content/src/Tests/BlockContentRevisionsTest.php, line 34
Contains \Drupal\block_content\Tests\BlockContentRevisionsTest.

Class

BlockContentRevisionsTest
Create a block with revisions.

Namespace

Drupal\block_content\Tests

Code

protected function setUp() {
  parent::setUp();

  // Create initial block.
  $block = $this
    ->createBlockContent('initial');
  $blocks = array();
  $logs = array();

  // Get original block.
  $blocks[] = $block
    ->getRevisionId();
  $logs[] = '';

  // Create three revisions.
  $revision_count = 3;
  for ($i = 0; $i < $revision_count; $i++) {
    $block
      ->setNewRevision(TRUE);
    $block
      ->setRevisionLog($this
      ->randomMachineName(32));
    $logs[] = $block
      ->getRevisionLog();
    $block
      ->save();
    $blocks[] = $block
      ->getRevisionId();
  }
  $this->blocks = $blocks;
  $this->revisionLogs = $logs;
}