render(); $expectedDom = new DOMDocument(); $this->assertTrue($expectedDom->loadHTML($expectedHtml, LIBXML_NOERROR), 'Expected HTML is not valid'); $actualDom = new DOMDocument(); $this->assertTrue($actualDom->loadHTML($actualHtml, LIBXML_NOERROR), 'Actual HTML is not valid'); $this->assertEquals($expectedDom, $actualDom); } /** * @deprecated Use {@link assertHtml()} instead. assertRendersHtml() suffers from the fact that the HTML being * processed must have a root node, e.g. the HTML `foobar` would always fail with "Extra content at * the end of the document". {@link assertHtml()} just does the job. */ protected function assertRendersHtml(string $html, ValidHtml $element): void { $this->assertXmlStringEqualsXmlString($html, $element->render()); } }