function DefaultMenuLinkTreeManipulatorsTest::testFlatten

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Menu/DefaultMenuLinkTreeManipulatorsTest.php \Drupal\Tests\Core\Menu\DefaultMenuLinkTreeManipulatorsTest::testFlatten()
  2. 10 core/tests/Drupal/Tests/Core/Menu/DefaultMenuLinkTreeManipulatorsTest.php \Drupal\Tests\Core\Menu\DefaultMenuLinkTreeManipulatorsTest::testFlatten()
  3. 11.x core/tests/Drupal/Tests/Core/Menu/DefaultMenuLinkTreeManipulatorsTest.php \Drupal\Tests\Core\Menu\DefaultMenuLinkTreeManipulatorsTest::testFlatten()

Tests the flatten() tree manipulator.

@covers ::flatten

File

core/tests/Drupal/Tests/Core/Menu/DefaultMenuLinkTreeManipulatorsTest.php, line 259

Class

DefaultMenuLinkTreeManipulatorsTest
Tests the default menu link tree manipulators.

Namespace

Drupal\Tests\Core\Menu

Code

public function testFlatten() {
    $this->mockTree();
    $tree = $this->defaultMenuTreeManipulators
        ->flatten($this->originalTree);
    $this->assertEquals([
        1,
        2,
        5,
        6,
        8,
        9,
    ], array_keys($this->originalTree));
    $this->assertEquals([
        1,
        2,
        5,
        6,
        8,
        9,
        3,
        4,
        7,
    ], array_keys($tree));
}

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