You are here

public function DefaultMenuLinkTreeManipulatorsTest::testFlatten in Drupal 8

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));
}