function RenderElementTypesTestCase::testContainer

Tests system #type 'container'.

File

modules/simpletest/tests/theme.test, line 491

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);
}

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