function HtmlTest::testSerialize

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Component/Utility/HtmlTest.php \Drupal\Tests\Component\Utility\HtmlTest::testSerialize()
  2. 8.9.x core/tests/Drupal/Tests/Component/Utility/HtmlTest.php \Drupal\Tests\Component\Utility\HtmlTest::testSerialize()
  3. 11.x core/tests/Drupal/Tests/Component/Utility/HtmlTest.php \Drupal\Tests\Component\Utility\HtmlTest::testSerialize()

Tests Html::serialize().

Resolves an issue by where an empty DOMDocument object sent to serialization would cause errors in getElementsByTagName() in the serialization function.

@covers ::serialize

File

core/tests/Drupal/Tests/Component/Utility/HtmlTest.php, line 338

Class

HtmlTest
Tests \Drupal\Component\Utility\Html.

Namespace

Drupal\Tests\Component\Utility

Code

public function testSerialize() : void {
    $document = new \DOMDocument();
    $result = Html::serialize($document);
    $this->assertSame('', $result);
}

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