diff --git a/tests/phpunit/tests/html-api/wpHtmlProcessorHtml5lib.php b/tests/phpunit/tests/html-api/wpHtmlProcessorHtml5lib.php index ddb3f12ac13ce..7fbe88e972116 100644 --- a/tests/phpunit/tests/html-api/wpHtmlProcessorHtml5lib.php +++ b/tests/phpunit/tests/html-api/wpHtmlProcessorHtml5lib.php @@ -14,6 +14,12 @@ */ class Tests_HtmlApi_WpHtmlProcessorHtml5lib extends WP_UnitTestCase { + /** + * The HTML Processor only accepts HTML in document . + * Do not run tests that look for anything in document `head`. + */ + const SKIP_HEAD_TESTS = true; + const SKIP_TESTS = array( 'adoption01/case10 - line 159' => 'Unimplemented: Reconstruction of active formatting elements.', 'adoption01/case17 - line 318' => 'Unimplemented: Reconstruction of active formatting elements.', @@ -33,8 +39,6 @@ class Tests_HtmlApi_WpHtmlProcessorHtml5lib extends WP_UnitTestCase { * Verify the parsing results of the HTML Processor against the * test cases in the Html5lib tests project. * - * @ticket {TICKET_NUMBER} - * * @dataProvider data_external_html5lib_tests * * @param string $fragment_context Context element in which to parse HTML, such as BODY or SVG. @@ -88,7 +92,6 @@ public function data_external_html5lib_tests() { closedir( $handle ); } - /** * Generates the tree-like structure represented in the Html5lib tests. * @@ -153,7 +156,22 @@ public static function parse_html5_dat_testfile( $filename ) { if ( "#data\n" === $line ) { // Yield when switching from a previous state. if ( $state ) { - yield array( $test_line_number, $test_context_element, $test_html, $test_dom ); + $yield_test = true; + + if ( self::SKIP_HEAD_TESTS ) { + $html_start = "\n \n \n"; + + if ( + strlen( $test_dom ) < strlen( $html_start ) || + substr( $test_dom, 0, strlen( $html_start ) ) !== $html_start + ) { + $yield_test = false; + } + } + + if ( $yield_test ) { + yield array( $test_line_number, $test_context_element, $test_html, $test_dom ); + } } // Finish previous test.