You are here

public function BlockUiTest::testBlockPlacementIndicator in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/block/src/Tests/BlockUiTest.php \Drupal\block\Tests\BlockUiTest::testBlockPlacementIndicator()

Tests the block placement indicator.

File

core/modules/block/src/Tests/BlockUiTest.php, line 278
Contains \Drupal\block\Tests\BlockUiTest.

Class

BlockUiTest
Tests that the block configuration UI exists and stores data correctly.

Namespace

Drupal\block\Tests

Code

public function testBlockPlacementIndicator() {

  // Select the 'Powered by Drupal' block to be placed.
  $block = array();
  $block['id'] = strtolower($this
    ->randomMachineName());
  $block['theme'] = 'classy';
  $block['region'] = 'content';

  // After adding a block, it will indicate which block was just added.
  $this
    ->drupalPostForm('admin/structure/block/add/system_powered_by_block', $block, t('Save block'));
  $this
    ->assertUrl('admin/structure/block/list/classy?block-placement=' . Html::getClass($block['id']));

  // Resaving the block page will remove the block indicator.
  $this
    ->drupalPostForm(NULL, array(), t('Save blocks'));
  $this
    ->assertUrl('admin/structure/block/list/classy');
}