function MenuLinkTreeElementTest::testConstruction

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

Tests construction.

@covers ::__construct

File

core/tests/Drupal/Tests/Core/Menu/MenuLinkTreeElementTest.php, line 22

Class

MenuLinkTreeElementTest
Tests the menu link tree element value object.

Namespace

Drupal\Tests\Core\Menu

Code

public function testConstruction() {
    $link = MenuLinkMock::create([
        'id' => 'test',
    ]);
    $item = new MenuLinkTreeElement($link, FALSE, 3, FALSE, []);
    $this->assertSame($link, $item->link);
    $this->assertFalse($item->hasChildren);
    $this->assertSame(3, $item->depth);
    $this->assertFalse($item->inActiveTrail);
    $this->assertSame([], $item->subtree);
}

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