diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml index f46b419656a44..b387ebacd0874 100644 --- a/.github/workflows/phpunit-tests.yml +++ b/.github/workflows/phpunit-tests.yml @@ -252,7 +252,7 @@ jobs: php: [ '7.4', '8.0', '8.4' ] db-type: [ 'mysql' ] db-version: [ '8.4' ] - phpunit-test-groups: [ 'html-api-html5lib-tests' ] + phpunit-test-groups: [ 'html-api-web-platform-tests' ] # A matrix value is needed in the 'name' directive for proper grouping in the GitHub UI. label: [ 'HTML API' ] with: @@ -305,7 +305,7 @@ jobs: - php: '8.4' db-version: '9.7' db-type: 'mysql' - phpunit-test-groups: 'html-api-html5lib-tests' + phpunit-test-groups: 'html-api-web-platform-tests' exclude: # Exclude PHP versions that are not supported by the database versions. diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 4b6c149867c7d..2b1a8c9dab784 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -29,7 +29,7 @@ ms-files ms-required external-http - html-api-html5lib-tests + html-api-web-platform-tests diff --git a/tests/phpunit/data/html5lib-tests/AUTHORS.rst b/tests/phpunit/data/html5lib-tests/AUTHORS.rst deleted file mode 100644 index 4a7de17ad456c..0000000000000 --- a/tests/phpunit/data/html5lib-tests/AUTHORS.rst +++ /dev/null @@ -1,34 +0,0 @@ -Credits -======= - -The ``html5lib`` test data is maintained by: - -- James Graham -- Geoffrey Sneddon - - -Contributors ------------- - -- Adam Barth -- Andi Sidwell -- Anne van Kesteren -- David Flanagan -- Edward Z. Yang -- Geoffrey Sneddon -- Henri Sivonen -- Ian Hickson -- Jacques Distler -- James Graham -- Lachlan Hunt -- lantis63 -- Mark Pilgrim -- Mats Palmgren -- Ms2ger -- Nolan Waite -- Philip Taylor -- Rafael Weinstein -- Ryan King -- Sam Ruby -- Simon Pieters -- Thomas Broyer diff --git a/tests/phpunit/data/html5lib-tests/LICENSE b/tests/phpunit/data/html5lib-tests/LICENSE deleted file mode 100644 index 8812371b41cfc..0000000000000 --- a/tests/phpunit/data/html5lib-tests/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright (c) 2006-2013 James Graham, Geoffrey Sneddon, and -other contributors - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tests/phpunit/data/html5lib-tests/README.md b/tests/phpunit/data/html5lib-tests/README.md deleted file mode 100644 index be775c8b497b5..0000000000000 --- a/tests/phpunit/data/html5lib-tests/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# html5lib-tests - -This directory contains a third-party test suite used for testing the WordPress HTML API. - -`html5lib-tests` can be found on GitHub at [html5lib/html5lib-tests](https://github.com/html5lib/html5lib-tests). - -The necessary files have been copied to this directory: - -- `AUTHORS.rst` -- `LICENSE` -- `README.md` -- `tree-construction/README.md` -- `tree-construction/*.dat` - -The version of these files was taken from the git commit with -SHA [`a9f44960a9fedf265093d22b2aa3c7ca123727b9`](https://github.com/html5lib/html5lib-tests/commit/a9f44960a9fedf265093d22b2aa3c7ca123727b9). - -## Updating - -If there have been changes to the html5lib-tests repository, this test suite can be updated. In -order to update: - -1. Check out the latest version of git repository mentioned above. -1. Copy the files listed above into this directory. -1. Update the SHA mentioned in this README file with the new html5lib-tests SHA. diff --git a/tests/phpunit/data/html5lib-tests/.gitattributes b/tests/phpunit/data/web-platform-tests/.gitattributes similarity index 100% rename from tests/phpunit/data/html5lib-tests/.gitattributes rename to tests/phpunit/data/web-platform-tests/.gitattributes diff --git a/tests/phpunit/data/web-platform-tests/LICENSE.md b/tests/phpunit/data/web-platform-tests/LICENSE.md new file mode 100644 index 0000000000000..39c46d03ac298 --- /dev/null +++ b/tests/phpunit/data/web-platform-tests/LICENSE.md @@ -0,0 +1,11 @@ +# The 3-Clause BSD License + +Copyright © web-platform-tests contributors + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/tests/phpunit/data/web-platform-tests/README.md b/tests/phpunit/data/web-platform-tests/README.md new file mode 100644 index 0000000000000..60d9c767efe80 --- /dev/null +++ b/tests/phpunit/data/web-platform-tests/README.md @@ -0,0 +1,19 @@ +# Web Platform Tests + +This directory contains a third-party test suite used for testing the WordPress HTML API. + +The tests are maintained by the Web Platform Tests project. +The current tests can be found on GitHub at +[`web-platform-tests/wpt/html/syntax/parsing/resources`](https://github.com/web-platform-tests/wpt/tree/master/html/syntax/parsing/resources). + +The version of the WPT files was taken from the git commit with +SHA [`f4c2ec1d071ccbae305f7aea4e883b5bd0f5c0df`](https://github.com/web-platform-tests/wpt/commit/f4c2ec1d071ccbae305f7aea4e883b5bd0f5c0df). + +## Updating + +If there have been changes to the Web Platform Tests repository, this test suite can be updated. In +order to update: + +1. Check out the latest version of git repository mentioned above. +1. Replace the local `html_syntax_parsing_resources/` directory with the WPT repo's `html/syntax/parsing/resources` directory. +1. Update the SHA mentioned in this README file with the new Web Platform Tests SHA. diff --git a/tests/phpunit/data/html5lib-tests/tree-construction/README.md b/tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/README.md similarity index 96% rename from tests/phpunit/data/html5lib-tests/tree-construction/README.md rename to tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/README.md index 4737a3a867e86..5a428760cf55c 100644 --- a/tests/phpunit/data/html5lib-tests/tree-construction/README.md +++ b/tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/README.md @@ -31,7 +31,7 @@ errors. Then there \*may\* be a line that says "\#document-fragment", which must be followed by a newline (LF), followed by a string of characters that -indicates the context element, followed by a newline (LF). If the string +indicates the context element, followed by a newline (LF). If the string of characters starts with "svg ", the context element is in the SVG namespace and the substring after "svg " is the local name. If the string of characters starts with "math ", the context element is in the @@ -67,9 +67,7 @@ per parent node that the node has before the root document node. double-quotes, another space an the system id in double-quotes, and then in any case "`>`". - Processing instructions must be "``". (The HTML parser cannot emit - processing instructions, but scripts can, and the WebVTT to DOM - rules can emit them.) + space, then the data and then "`?>`". - Template contents are represented by the string "content" with the children below it. diff --git a/tests/phpunit/data/html5lib-tests/tree-construction/adoption01.dat b/tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/adoption01.dat similarity index 100% rename from tests/phpunit/data/html5lib-tests/tree-construction/adoption01.dat rename to tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/adoption01.dat diff --git a/tests/phpunit/data/html5lib-tests/tree-construction/adoption02.dat b/tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/adoption02.dat similarity index 64% rename from tests/phpunit/data/html5lib-tests/tree-construction/adoption02.dat rename to tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/adoption02.dat index e54d8033bac71..acd388547a1ec 100644 --- a/tests/phpunit/data/html5lib-tests/tree-construction/adoption02.dat +++ b/tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/adoption02.dat @@ -37,3 +37,20 @@ |
| | + +#data +
+#errors +(1,6): expected-doctype-but-got-start-tag +(1,22): unexpected-start-tag-implies-table-voodoo +(1,30): end-tag-too-early-named +(1,36): unexpected-start-tag-implies-end-tag +(1,36): expected-closing-tag-but-got-eof +#document +| +| +| +| +| +| +| diff --git a/tests/phpunit/data/html5lib-tests/tree-construction/blocks.dat b/tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/blocks.dat similarity index 100% rename from tests/phpunit/data/html5lib-tests/tree-construction/blocks.dat rename to tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/blocks.dat diff --git a/tests/phpunit/data/html5lib-tests/tree-construction/comments01.dat b/tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/comments01.dat similarity index 100% rename from tests/phpunit/data/html5lib-tests/tree-construction/comments01.dat rename to tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/comments01.dat diff --git a/tests/phpunit/data/html5lib-tests/tree-construction/doctype01.dat b/tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/doctype01.dat similarity index 100% rename from tests/phpunit/data/html5lib-tests/tree-construction/doctype01.dat rename to tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/doctype01.dat diff --git a/tests/phpunit/data/html5lib-tests/tree-construction/domjs-unsafe.dat b/tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/domjs-unsafe.dat similarity index 100% rename from tests/phpunit/data/html5lib-tests/tree-construction/domjs-unsafe.dat rename to tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/domjs-unsafe.dat diff --git a/tests/phpunit/data/html5lib-tests/tree-construction/entities01.dat b/tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/entities01.dat similarity index 100% rename from tests/phpunit/data/html5lib-tests/tree-construction/entities01.dat rename to tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/entities01.dat diff --git a/tests/phpunit/data/html5lib-tests/tree-construction/entities02.dat b/tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/entities02.dat similarity index 100% rename from tests/phpunit/data/html5lib-tests/tree-construction/entities02.dat rename to tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/entities02.dat diff --git a/tests/phpunit/data/html5lib-tests/tree-construction/foreign-fragment.dat b/tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/foreign-fragment.dat similarity index 100% rename from tests/phpunit/data/html5lib-tests/tree-construction/foreign-fragment.dat rename to tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/foreign-fragment.dat diff --git a/tests/phpunit/data/html5lib-tests/tree-construction/html5test-com.dat b/tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/html5test-com.dat similarity index 98% rename from tests/phpunit/data/html5lib-tests/tree-construction/html5test-com.dat rename to tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/html5test-com.dat index 48d0bf95b5572..203c77ef7a693 100644 --- a/tests/phpunit/data/html5lib-tests/tree-construction/html5test-com.dat +++ b/tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/html5test-com.dat @@ -134,7 +134,7 @@ #new-errors (1:2) unexpected-question-mark-instead-of-tag-name #document -| +| | | | diff --git a/tests/phpunit/data/html5lib-tests/tree-construction/inbody01.dat b/tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/inbody01.dat similarity index 100% rename from tests/phpunit/data/html5lib-tests/tree-construction/inbody01.dat rename to tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/inbody01.dat diff --git a/tests/phpunit/data/html5lib-tests/tree-construction/isindex.dat b/tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/isindex.dat similarity index 100% rename from tests/phpunit/data/html5lib-tests/tree-construction/isindex.dat rename to tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/isindex.dat diff --git a/tests/phpunit/data/html5lib-tests/tree-construction/main-element.dat b/tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/main-element.dat similarity index 100% rename from tests/phpunit/data/html5lib-tests/tree-construction/main-element.dat rename to tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/main-element.dat diff --git a/tests/phpunit/data/html5lib-tests/tree-construction/math.dat b/tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/math.dat similarity index 100% rename from tests/phpunit/data/html5lib-tests/tree-construction/math.dat rename to tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/math.dat diff --git a/tests/phpunit/data/html5lib-tests/tree-construction/menuitem-element.dat b/tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/menuitem-element.dat similarity index 97% rename from tests/phpunit/data/html5lib-tests/tree-construction/menuitem-element.dat rename to tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/menuitem-element.dat index fb13c3c33b0ab..f7c8e2c3ca74e 100644 --- a/tests/phpunit/data/html5lib-tests/tree-construction/menuitem-element.dat +++ b/tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/menuitem-element.dat @@ -161,13 +161,14 @@ #data #errors -33: Stray start tag “menuitem”. +1:34: ERROR: End tag 'select' isn't allowed here. Currently open tags: html, body, select, menuitem. #document | | | | |
+#document +| +| +| +| +| + +#data +
+#document +| +| +| +| +| +| +| + +#data + +#document +| +| +|

TEXT +#errors +#script-on +#document +| +| +| +|

+| +| id="B" +|

X +#errors +#script-on +#document +| +| +| +|

+| +| size="4" +| +| size="4" +| +| size="5" +| 3 +#errors +#script-on +#document +| +| +| +| "1" +| 4 +#errors +#script-on +#document +| +| +| +| "1" +| abc #errors -(1,30): unexpected-start-tag-implies-table-voodoo -(1,58): eof-in-select +1:23: ERROR: Start tag 'select' isn't allowed here. Currently open tags: html, body, table. +1:56: ERROR: Character tokens aren't legal here +1:57: ERROR: Character tokens aren't legal here +1:58: ERROR: Character tokens aren't legal here +1:59: ERROR: Premature end of file. Currently open tags: html, body, table, select. #document | | @@ -462,8 +473,11 @@ #data

BC
#data #errors -(1,8): expected-doctype-but-got-start-tag -(1,16): unexpected-input-in-select +1:1: ERROR: Expected a doctype token +1:17: ERROR: Premature end of file. Currently open tags: html, body, select. #document | | | | +| diff --git a/tests/phpunit/data/html5lib-tests/tree-construction/tests8.dat b/tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/tests8.dat similarity index 100% rename from tests/phpunit/data/html5lib-tests/tree-construction/tests8.dat rename to tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/tests8.dat diff --git a/tests/phpunit/data/html5lib-tests/tree-construction/tests9.dat b/tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/tests9.dat similarity index 86% rename from tests/phpunit/data/html5lib-tests/tree-construction/tests9.dat rename to tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/tests9.dat index f8d04b23bc0be..1456324ffc21f 100644 --- a/tests/phpunit/data/html5lib-tests/tree-construction/tests9.dat +++ b/tests/phpunit/data/web-platform-tests/html_syntax_parsing_resources/tests9.dat @@ -48,20 +48,17 @@ #data #errors -(1,35) unexpected-start-tag-in-select -(1,42) unexpected-end-tag-in-select #document | | | | | #errors -(1,43) unexpected-start-tag-in-select -(1,50) unexpected-end-tag-in-select #document | | @@ -69,6 +66,7 @@ | | foobar

baz

quux #errors -(1,50) unexpected-start-tag-in-select -(1,54) unexpected-start-tag-in-select -(1,62) unexpected-end-tag-in-select -(1,66) unexpected-start-tag-in-select -(1,74) unexpected-end-tag-in-select -(1,77) unexpected-start-tag-in-select -(1,88) unexpected-table-element-end-tag-in-select-in-table +1:75: ERROR: Start tag 'p' isn't allowed here. Currently open tags: html, body, table, tbody, tr, td, select, math. +1:81: ERROR: End tag 'table' isn't allowed here. Currently open tags: html, body, table, tbody, tr, td, select. #document | | @@ -318,28 +311,45 @@ | | | foobar

baz

quux #errors -(1,36) unexpected-start-tag-implies-table-voodoo -(1,42) unexpected-start-tag-in-select -(1,46) unexpected-start-tag-in-select -(1,54) unexpected-end-tag-in-select -(1,58) unexpected-start-tag-in-select -(1,66) unexpected-end-tag-in-select -(1,69) unexpected-start-tag-in-select -(1,80) unexpected-table-element-end-tag-in-select-in-table +1:29: ERROR: Start tag 'select' isn't allowed here. Currently open tags: html, body, table. +1:37: ERROR: Start tag 'math' isn't allowed here. Currently open tags: html, body, table, select. +1:47: ERROR: Character tokens aren't legal here +1:48: ERROR: Character tokens aren't legal here +1:49: ERROR: Character tokens aren't legal here +1:59: ERROR: Character tokens aren't legal here +1:60: ERROR: Character tokens aren't legal here +1:61: ERROR: Character tokens aren't legal here +1:67: ERROR: Start tag 'p' isn't allowed here. Currently open tags: html, body, table, select, math. +1:67: ERROR: Start tag 'p' isn't allowed here. Currently open tags: html, body, table, select. +1:70: ERROR: Character tokens aren't legal here +1:71: ERROR: Character tokens aren't legal here +1:72: ERROR: Character tokens aren't legal here #document | | | | |