protected function CustomBlockRevisionsTest::setUp

Sets the test up.

Overrides CustomBlockTestBase::setUp

File

drupal/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockRevisionsTest.php, line 41
Contains \Drupal\custom_block\Tests\CustomBlockRevisionsTest.

Class

CustomBlockRevisionsTest
Tests the block revision functionality.

Namespace

Drupal\custom_block\Tests

Code

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

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

  // Get original block.
  $blocks[] = $block->revision_id->value;
  $logs[] = '';

  // Create three revisions.
  $revision_count = 3;
  for ($i = 0; $i < $revision_count; $i++) {
    $block
      ->setNewRevision(TRUE);
    $logs[] = $block->log->value = $this
      ->randomName(32);
    $block
      ->save();
    $blocks[] = $block->revision_id->value;
  }
  $this->blocks = $blocks;
  $this->logs = $logs;
}