You are here

function RenderElementTypesTestCase::testContainer in Drupal 7

Tests system #type 'container'.

File

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

Class

RenderElementTypesTestCase
Tests the markup of core render element types passed to drupal_render().

Code

function testContainer() {
  $elements = array(
    // Basic container with no attributes.
    array(
      'name' => "#type 'container' with no HTML attributes",
      'value' => array(
        '#type' => 'container',
        'child' => array(
          '#markup' => 'foo',
        ),
      ),
      'expected' => '<div>foo</div>',
    ),
    // Container with a class.
    array(
      'name' => "#type 'container' with a class HTML attribute",
      'value' => array(
        '#type' => 'container',
        'child' => array(
          '#markup' => 'foo',
        ),
        '#attributes' => array(
          'class' => 'bar',
        ),
      ),
      'expected' => '<div class="bar">foo</div>',
    ),
  );
  $this
    ->assertElements($elements);
}