function MenuLinkTreeElementTest::testCount

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

Tests count().

@covers ::count

File

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

Class

MenuLinkTreeElementTest
Tests the menu link tree element value object.

Namespace

Drupal\Tests\Core\Menu

Code

public function testCount() {
    $link_1 = MenuLinkMock::create([
        'id' => 'test_1',
    ]);
    $link_2 = MenuLinkMock::create([
        'id' => 'test_2',
    ]);
    $child_item = new MenuLinkTreeElement($link_2, FALSE, 2, FALSE, []);
    $parent_item = new MenuLinkTreeElement($link_1, FALSE, 2, FALSE, [
        $child_item,
    ]);
    $this->assertSame(1, $child_item->count());
    $this->assertSame(2, $parent_item->count());
}

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