You are here

public function MenuLinkTreeElementTest::testCount in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 42
Contains \Drupal\Tests\Core\Menu\MenuLinkTreeElementTest.

Class

MenuLinkTreeElementTest
Tests the menu link tree element value object.

Namespace

Drupal\Tests\Core\Menu

Code

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