You are here

public function MenuLinkTreeElementTest::testConstruction in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Menu/MenuLinkTreeElementTest.php \Drupal\Tests\Core\Menu\MenuLinkTreeElementTest::testConstruction()
  2. 9 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);
}