Skip to content

Commit dd343f6

Browse files
committed
Tests: Correct URL details parsing fixtures and labels.
Reverse the attribute order in the multiline icon fixture so it exercises a distinct input. Correct a dataset label and document the malformed description fixture and minimal HTML wrapper. Follow-up to [64317]. Developed in: #14326 Props abcd95. See #66074. git-svn-id: https://develop.svn.wordpress.org/trunk@64389 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 213ecca commit dd343f6

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

  • tests/phpunit/tests/rest-api/wpRestUrlDetailsController

‎tests/phpunit/tests/rest-api/wpRestUrlDetailsController/parsing.php‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function data_get_title() {
6363
'<title >Testing &lt;title&gt;: with whitespace in opening tag</title>',
6464
'Testing : with whitespace in opening tag',
6565
),
66-
'when whitepace in closing tag' => array(
66+
'when whitespace in closing tag' => array(
6767
'<title>Testing &lt;title&gt;: with whitespace in closing tag</ title>',
6868
'Testing : with whitespace in closing tag',
6969
),
@@ -198,8 +198,8 @@ public function data_get_icon() {
198198
),
199199
'multiline attributes in reverse order' => array(
200200
'<link
201-
rel="icon"
202201
href="https://wordpress.org/favicon.ico"
202+
rel="icon"
203203
/>',
204204
'https://wordpress.org/favicon.ico',
205205
),
@@ -385,7 +385,9 @@ public function data_get_description() {
385385
'<meta content="<strong>Description</strong>: has <em>HTML</em> tags" name="description">',
386386
'Description: has HTML tags',
387387
),
388-
'with HTML tags and other attributes' => array(
388+
// Intentionally malformed: the fifth attribute is missing its closing
389+
// quote and the tag's closing bracket, testing parser resilience.
390+
'with HTML tags, other attributes, and malformed closing' => array(
389391
'<meta first="first" name="description" third="third" content="<strong>Description</strong>: has <em>HTML</em> tags" fifth="fifth>',
390392
'Description: has HTML tags',
391393
),
@@ -583,7 +585,13 @@ public function data_get_image() {
583585
}
584586

585587
/**
586-
* Wraps an HTML snippet in a minimal but well-formed HTML document.
588+
* Wraps an HTML snippet in a minimal HTML document structure.
589+
*
590+
* The returned document includes a DOCTYPE, opening `<html>` and `<head>`
591+
* tags, and a charset `<meta>` element. When `$with_body` is false the
592+
* document omits `<body>` and the closing `</html>` tag, relying on the
593+
* HTML parser to auto-close them. This mirrors real-world pages whose
594+
* markup may be incomplete.
587595
*
588596
* @param string $html The HTML to wrap.
589597
* @param bool $with_body Whether to include a body element.

0 commit comments

Comments
 (0)