Skip to content

Commit 4c652ad

Browse files
committed
Fix tests, !== ! == ===
1 parent 40f4967 commit 4c652ad

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/wp-includes/html-api/class-wp-html-processor.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,9 @@ public static function create_fragment( $html, $context = '<body>', $encoding =
308308
}
309309

310310
$context_node = self::parse_context_element( $context );
311-
var_dump( $context_node );
312311
if ( null === $context_node ) {
313312
_doing_it_wrong(
314-
__FUNCTION__,
313+
__METHOD__,
315314
__( 'The context argument must be an HTML start tag.' ),
316315
'6.7.0'
317316
);
@@ -320,7 +319,7 @@ public static function create_fragment( $html, $context = '<body>', $encoding =
320319

321320
if ( self::is_void( $context_node[0] ) ) {
322321
_doing_it_wrong(
323-
__FUNCTION__,
322+
__METHOD__,
324323
__( 'The context argument may not specify a void element.' ),
325324
'6.7.0'
326325
);
@@ -329,7 +328,7 @@ public static function create_fragment( $html, $context = '<body>', $encoding =
329328

330329
if ( in_array( $context_node[0], array( 'IFRAME', 'NOEMBED', 'NOFRAMES', 'SCRIPT', 'STYLE', 'TEXTAREA', 'TITLE', 'XMP' ), true ) ) {
331330
_doing_it_wrong(
332-
__FUNCTION__,
331+
__METHOD__,
333332
__( 'The context argument may not specify a self-contained element.' ),
334333
'6.7.0'
335334
);
@@ -387,7 +386,7 @@ public static function create_fragment( $html, $context = '<body>', $encoding =
387386
* @return array|null Element name and associative array of attributes if parsed, otherwise NULL.
388387
*/
389388
private static function parse_context_element( $context = '<body>' ): ?array {
390-
if ( '<body>' !== $context ) {
389+
if ( '<body>' === $context ) {
391390
return array( 'BODY', array() );
392391
}
393392

tests/phpunit/tests/html-api/wpHtmlProcessorFragmentParsing.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ class Tests_HtmlApi_WpHtmlProcessorFragmentParsing extends WP_UnitTestCase {
2323
*
2424
* @dataProvider data_invalid_fragment_contexts
2525
*
26+
* @expectedIncorrectUsage WP_HTML_Processor::create_fragment
27+
*
2628
* @param string $context Invalid context node for fragment parser.
2729
*/
2830
public function test_rejects_invalid_fragment_contexts( string $context ) {

0 commit comments

Comments
 (0)