Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/phpunit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<group>ms-files</group>
<group>ms-required</group>
<group>external-http</group>
<group>html-api-html5lib-tests</group>
<group>html-api-web-platform-tests</group>
</exclude>
</groups>
<logging>
Expand Down
34 changes: 0 additions & 34 deletions tests/phpunit/data/html5lib-tests/AUTHORS.rst

This file was deleted.

21 changes: 0 additions & 21 deletions tests/phpunit/data/html5lib-tests/LICENSE

This file was deleted.

25 changes: 0 additions & 25 deletions tests/phpunit/data/html5lib-tests/README.md

This file was deleted.

11 changes: 11 additions & 0 deletions tests/phpunit/data/web-platform-tests/LICENSE.md
Original file line number Diff line number Diff line change
@@ -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.
19 changes: 19 additions & 0 deletions tests/phpunit/data/web-platform-tests/README.md
Original file line number Diff line number Diff line change
@@ -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 [`1ae157bacf6cb1db64a60875800a30c80a4fc93c`](https://github.com/web-platform-tests/wpt/tree/1ae157bacf6cb1db64a60875800a30c80a4fc93c/html/syntax/parsing/resources).

## 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.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,20 @@
| <address>
| <a>
| <a>

#data
<nobr><table><marquee></table><nobr>
#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
| <html>
| <head>
| <body>
| <nobr>
| <marquee>
| <table>
| <nobr>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
function mark_diffs(expected, actual) {
var expected_lines = expected.split("\n");
var actual_lines = actual.split("\n");

var max_length = Math.max(expected_lines.length, actual_lines.length);

var expected_diff = ["code", {}];
var actual_diff = ["code", {}];

for (var i=0; i<max_length; i++) {
if (expected_lines[i] === actual_lines[i]) {
expected_diff.push(expected_lines[i] + "\n");
actual_diff.push(actual_lines[i] + "\n");
} else {
if (expected_lines[i]) {
expected_diff.push(["span", {style:"color:red"}, expected_lines[i] + "\n"]);
}
if (actual_lines[i]) {
actual_diff.push(["span", {style:"color:red"}, actual_lines[i] + "\n"]);
}
}
}
return [expected_diff, actual_diff];
}
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
#new-errors
(1:2) unexpected-question-mark-instead-of-tag-name
#document
| <!-- ?import namespace="foo" implementation="#bar" -->
| <?import namespace="foo" implementation="#bar"?>
| <html>
| <head>
| <body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,14 @@
#data
<!DOCTYPE html><select><menuitem></select>
#errors
33: Stray start tag menuitem.
1:34: ERROR: End tag 'select' isn't allowed here. Currently open tags: html, body, select, menuitem.
#document
| <!DOCTYPE html>
| <html>
| <head>
| <body>
| <select>
| <menuitem>

#data
<!DOCTYPE html><option><menuitem>
Expand Down
Loading
Loading