You are here

public function AreaOrderTest::testAreaOrder in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Kernel/Handler/AreaOrderTest.php \Drupal\Tests\views\Kernel\Handler\AreaOrderTest::testAreaOrder()

Tests the order of the handlers.

File

core/modules/views/tests/src/Kernel/Handler/AreaOrderTest.php, line 59

Class

AreaOrderTest
Tests the view area handler.

Namespace

Drupal\Tests\views\Kernel\Handler

Code

public function testAreaOrder() {
  $renderer = $this->container
    ->get('renderer');
  $view = Views::getView('test_area_order');
  $renderable = $view
    ->buildRenderable();
  $output = $this
    ->render($renderable);
  $position_powered = strpos($output, 'block-bartik-powered');
  $position_branding = strpos($output, 'block-bartik-branding');
  $this
    ->assertNotEquals(0, $position_powered, 'ID bartik-powered found.');
  $this
    ->assertNotEquals(0, $position_branding, 'ID bartik-branding found');

  // Make sure "powered" is before "branding", so it reflects the position
  // in the configuration, and not the weight of the blocks.
  $this
    ->assertTrue($position_powered < $position_branding, 'Block bartik-powered is positioned before block bartik-branding');
}