function RenderElementTypesTest::testContainer in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Common/RenderElementTypesTest.php \Drupal\system\Tests\Common\RenderElementTypesTest::testContainer()
Tests system #type 'container'.
File
- core/
modules/ system/ src/ Tests/ Common/ RenderElementTypesTest.php, line 60 - Contains \Drupal\system\Tests\Common\RenderElementTypesTest.
Class
- RenderElementTypesTest
- Tests the markup of core render element types passed to drupal_render().
Namespace
Drupal\system\Tests\CommonCode
function testContainer() {
// Basic container with no attributes.
$this
->assertElements(array(
'#type' => 'container',
'#markup' => 'foo',
), "<div>foo</div>\n", "#type 'container' with no HTML attributes");
// Container with a class.
$this
->assertElements(array(
'#type' => 'container',
'#markup' => 'foo',
'#attributes' => array(
'class' => array(
'bar',
),
),
), '<div class="bar">foo</div>' . "\n", "#type 'container' with a class HTML attribute");
// Container with children.
$this
->assertElements(array(
'#type' => 'container',
'child' => array(
'#markup' => 'foo',
),
), "<div>foo</div>\n", "#type 'container' with child elements");
}