Loading core/modules/layout_discovery/tests/src/Kernel/LayoutTest.php +1 −1 Original line number Diff line number Diff line Loading @@ -71,7 +71,7 @@ public function testRenderLayout($layout_id, $config, $regions, array $html) { $build_id_input = $this->cssSelect('input[name="form_build_id"]')[0]->asXML(); $form_id_input = '<input data-drupal-selector="edit-the-form-id" type="hidden" name="form_id" value="the_form_id"/>'; $html[] = 'Test suffix'; $html[] = $build_id_input . $form_id_input . '</form>'; $html[] = $build_id_input . "\n" . $form_id_input . "\n" . '</form>'; // Match the HTML to the full form element. $this->assertSame(implode("\n", $html), $this->cssSelect('#the-form-id')[0]->asXML()); Loading core/modules/system/tests/src/Kernel/Theme/FunctionsTest.php +3 −6 Original line number Diff line number Diff line Loading @@ -480,8 +480,7 @@ public function testDrupalPreRenderLinks() { // it. $render_array = $base_array; $html = \Drupal::service('renderer')->renderRoot($render_array); $dom = new \DOMDocument(); $dom->loadHTML($html); $dom = Html::load($html); $this->assertEquals(1, $dom->getElementsByTagName('ul')->length, 'One "ul" tag found in the rendered HTML.'); $list_elements = $dom->getElementsByTagName('li'); $this->assertEquals(3, $list_elements->length, 'Three "li" tags found in the rendered HTML.'); Loading @@ -498,16 +497,14 @@ public function testDrupalPreRenderLinks() { $child_html = \Drupal::service('renderer')->renderRoot($render_array['first_child']); $parent_html = \Drupal::service('renderer')->renderRoot($render_array); // First check the child HTML. $dom = new \DOMDocument(); $dom->loadHTML($child_html); $dom = Html::load($child_html); $this->assertEquals(1, $dom->getElementsByTagName('ul')->length, 'One "ul" tag found in the rendered child HTML.'); $list_elements = $dom->getElementsByTagName('li'); $this->assertEquals(2, $list_elements->length, 'Two "li" tags found in the rendered child HTML.'); $this->assertEquals('Parent link copy', $list_elements->item(0)->nodeValue, 'First expected link found.'); $this->assertEquals('First child link', $list_elements->item(1)->nodeValue, 'Second expected link found.'); // Then check the parent HTML. $dom = new \DOMDocument(); $dom->loadHTML($parent_html); $dom = Html::load($parent_html); $this->assertEquals(1, $dom->getElementsByTagName('ul')->length, 'One "ul" tag found in the rendered parent HTML.'); $list_elements = $dom->getElementsByTagName('li'); $this->assertEquals(2, $list_elements->length, 'Two "li" tags found in the rendered parent HTML.'); Loading core/modules/views/tests/src/Functional/Handler/FieldWebTest.php +1 −2 Original line number Diff line number Diff line Loading @@ -177,8 +177,7 @@ protected function assertNotSubString(string $haystack, string $needle, string $ * An array containing simplexml objects. */ protected function parseContent($content) { $htmlDom = new \DOMDocument(); @$htmlDom->loadHTML('<?xml encoding="UTF-8">' . $content); $htmlDom = Html::load($content); $elements = simplexml_import_dom($htmlDom); return $elements; Loading core/modules/views/tests/src/Kernel/Plugin/StyleTest.php +2 −2 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace Drupal\Tests\views\Kernel\Plugin; use Drupal\Component\Utility\Html; use Drupal\Tests\views\Kernel\ViewsKernelTestBase; use Drupal\views\Views; use Drupal\views_test_data\Plugin\views\row\RowTest; Loading Loading @@ -309,8 +310,7 @@ public function testCustomRowClasses() { * The HTML DOM. */ protected function getHtmlDom($output) { $html_dom = new \DOMDocument(); @$html_dom->loadHTML($output); $html_dom = Html::load($output); if ($html_dom) { // It's much easier to work with simplexml than DOM, luckily enough // we can just simply import our DOM tree. Loading core/modules/views/tests/src/Kernel/Plugin/StyleTestBase.php +2 −3 Original line number Diff line number Diff line Loading @@ -2,8 +2,8 @@ namespace Drupal\Tests\views\Kernel\Plugin; use Drupal\Component\Utility\Html; use Drupal\Tests\views\Kernel\ViewsKernelTestBase; use Masterminds\HTML5; /** * Tests some general style plugin related functionality. Loading @@ -21,8 +21,7 @@ abstract class StyleTestBase extends ViewsKernelTestBase { * Stores a view output in the elements. */ public function storeViewPreview($output) { $html5 = new HTML5(); $htmlDom = $html5->loadHTML('<html><body>' . $output . '</body></html>'); $htmlDom = Html::load($output); if ($htmlDom) { // It's much easier to work with simplexml than DOM, luckily enough // we can just simply import our DOM tree. Loading Loading
core/modules/layout_discovery/tests/src/Kernel/LayoutTest.php +1 −1 Original line number Diff line number Diff line Loading @@ -71,7 +71,7 @@ public function testRenderLayout($layout_id, $config, $regions, array $html) { $build_id_input = $this->cssSelect('input[name="form_build_id"]')[0]->asXML(); $form_id_input = '<input data-drupal-selector="edit-the-form-id" type="hidden" name="form_id" value="the_form_id"/>'; $html[] = 'Test suffix'; $html[] = $build_id_input . $form_id_input . '</form>'; $html[] = $build_id_input . "\n" . $form_id_input . "\n" . '</form>'; // Match the HTML to the full form element. $this->assertSame(implode("\n", $html), $this->cssSelect('#the-form-id')[0]->asXML()); Loading
core/modules/system/tests/src/Kernel/Theme/FunctionsTest.php +3 −6 Original line number Diff line number Diff line Loading @@ -480,8 +480,7 @@ public function testDrupalPreRenderLinks() { // it. $render_array = $base_array; $html = \Drupal::service('renderer')->renderRoot($render_array); $dom = new \DOMDocument(); $dom->loadHTML($html); $dom = Html::load($html); $this->assertEquals(1, $dom->getElementsByTagName('ul')->length, 'One "ul" tag found in the rendered HTML.'); $list_elements = $dom->getElementsByTagName('li'); $this->assertEquals(3, $list_elements->length, 'Three "li" tags found in the rendered HTML.'); Loading @@ -498,16 +497,14 @@ public function testDrupalPreRenderLinks() { $child_html = \Drupal::service('renderer')->renderRoot($render_array['first_child']); $parent_html = \Drupal::service('renderer')->renderRoot($render_array); // First check the child HTML. $dom = new \DOMDocument(); $dom->loadHTML($child_html); $dom = Html::load($child_html); $this->assertEquals(1, $dom->getElementsByTagName('ul')->length, 'One "ul" tag found in the rendered child HTML.'); $list_elements = $dom->getElementsByTagName('li'); $this->assertEquals(2, $list_elements->length, 'Two "li" tags found in the rendered child HTML.'); $this->assertEquals('Parent link copy', $list_elements->item(0)->nodeValue, 'First expected link found.'); $this->assertEquals('First child link', $list_elements->item(1)->nodeValue, 'Second expected link found.'); // Then check the parent HTML. $dom = new \DOMDocument(); $dom->loadHTML($parent_html); $dom = Html::load($parent_html); $this->assertEquals(1, $dom->getElementsByTagName('ul')->length, 'One "ul" tag found in the rendered parent HTML.'); $list_elements = $dom->getElementsByTagName('li'); $this->assertEquals(2, $list_elements->length, 'Two "li" tags found in the rendered parent HTML.'); Loading
core/modules/views/tests/src/Functional/Handler/FieldWebTest.php +1 −2 Original line number Diff line number Diff line Loading @@ -177,8 +177,7 @@ protected function assertNotSubString(string $haystack, string $needle, string $ * An array containing simplexml objects. */ protected function parseContent($content) { $htmlDom = new \DOMDocument(); @$htmlDom->loadHTML('<?xml encoding="UTF-8">' . $content); $htmlDom = Html::load($content); $elements = simplexml_import_dom($htmlDom); return $elements; Loading
core/modules/views/tests/src/Kernel/Plugin/StyleTest.php +2 −2 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace Drupal\Tests\views\Kernel\Plugin; use Drupal\Component\Utility\Html; use Drupal\Tests\views\Kernel\ViewsKernelTestBase; use Drupal\views\Views; use Drupal\views_test_data\Plugin\views\row\RowTest; Loading Loading @@ -309,8 +310,7 @@ public function testCustomRowClasses() { * The HTML DOM. */ protected function getHtmlDom($output) { $html_dom = new \DOMDocument(); @$html_dom->loadHTML($output); $html_dom = Html::load($output); if ($html_dom) { // It's much easier to work with simplexml than DOM, luckily enough // we can just simply import our DOM tree. Loading
core/modules/views/tests/src/Kernel/Plugin/StyleTestBase.php +2 −3 Original line number Diff line number Diff line Loading @@ -2,8 +2,8 @@ namespace Drupal\Tests\views\Kernel\Plugin; use Drupal\Component\Utility\Html; use Drupal\Tests\views\Kernel\ViewsKernelTestBase; use Masterminds\HTML5; /** * Tests some general style plugin related functionality. Loading @@ -21,8 +21,7 @@ abstract class StyleTestBase extends ViewsKernelTestBase { * Stores a view output in the elements. */ public function storeViewPreview($output) { $html5 = new HTML5(); $htmlDom = $html5->loadHTML('<html><body>' . $output . '</body></html>'); $htmlDom = Html::load($output); if ($htmlDom) { // It's much easier to work with simplexml than DOM, luckily enough // we can just simply import our DOM tree. Loading