You are here

function ThemeItemListUnitTest::testItemList in Drupal 7

Test item list rendering.

File

modules/simpletest/tests/theme.test, line 279
Tests for the theme API.

Class

ThemeItemListUnitTest
Unit tests for theme_item_list().

Code

function testItemList() {
  $items = array(
    'a',
    array(
      'data' => 'b',
      'children' => array(
        'c' => 'c',
        'd' => 'd',
        'e' => 'e',
      ),
    ),
    'f',
  );
  $expected = '<div class="item-list"><ul><li class="first">a</li>
<li>b<div class="item-list"><ul><li class="first">c</li>
<li>d</li>
<li class="last">e</li>
</ul></div></li>
<li class="last">f</li>
</ul></div>';
  $output = theme('item_list', array(
    'items' => $items,
  ));
  $this
    ->assertIdentical($expected, $output, 'Item list is rendered correctly.');
}