function HtmlTagTest::testHtmlTag

Tests #type 'html_tag'.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Common/HtmlTagTest.php, line 27
Contains \Drupal\system\Tests\Common\HtmlTagTest.

Class

HtmlTagTest
Tests for #type 'html_tag'.

Namespace

Drupal\system\Tests\Common

Code

function testHtmlTag() {

  // Test auto-closure meta tag generation.
  $tag = array(
    '#type' => 'html_tag',
    '#tag' => 'meta',
    '#attributes' => array(
      'name' => 'description',
      'content' => 'Drupal test',
    ),
  );
  $this
    ->assertEqual('<meta name="description" content="Drupal test" />' . "\n", drupal_render($tag), 'Test auto-closure meta tag generation.');

  // Test title tag generation.
  $tag = array(
    '#type' => 'html_tag',
    '#tag' => 'title',
    '#value' => 'title test',
  );
  $this
    ->assertEqual('<title>title test</title>' . "\n", drupal_render($tag), 'Test title tag generation.');
}