function AreaOrderTest::testAreaOrder

Same name in other branches
  1. 8.9.x core/modules/views/tests/src/Kernel/Handler/AreaOrderTest.php \Drupal\Tests\views\Kernel\Handler\AreaOrderTest::testAreaOrder()
  2. 10 core/modules/views/tests/src/Kernel/Handler/AreaOrderTest.php \Drupal\Tests\views\Kernel\Handler\AreaOrderTest::testAreaOrder()
  3. 11.x 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() {
    $view = Views::getView('test_area_order');
    $renderable = $view->buildRenderable();
    $output = $this->render($renderable);
    $position_powered = strpos($output, 'block-id-olivero-powered');
    $position_branding = strpos($output, 'block-id-olivero-branding');
    $this->assertNotEquals(0, $position_powered, 'ID olivero-powered found.');
    $this->assertNotEquals(0, $position_branding, 'ID olivero-branding found');
    // Make sure "powered" is before "branding", so it reflects the position
    // in the configuration, and not the weight of the blocks.
    $this->assertLessThan($position_branding, $position_powered);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.