' );
+ * $processor = WP_HTML_Processor::create_fragment( '' );
* false === $processor->next_tag();
* WP_HTML_Processor::ERROR_UNSUPPORTED === $processor->get_last_error();
*
@@ -428,7 +428,7 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
*
* Example:
*
- * $processor = WP_HTML_Processor::createFragment( '' );
+ * $processor = WP_HTML_Processor::create_fragment( '' );
* $processor->next_tag( 'img' );
* true === $processor->matches_breadcrumbs( array( 'figure', 'img' ) );
* true === $processor->matches_breadcrumbs( array( 'span', 'figure', 'img' ) );
@@ -557,7 +557,7 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
*
* Example
*
- * $processor = WP_HTML_Processor::createFragment( '
' );
+ * $processor = WP_HTML_Processor::create_fragment( '
' );
* $processor->next_tag( 'IMG' );
* $processor->get_breadcrumbs() === array( 'HTML', 'BODY', 'P', 'STRONG', 'EM', 'IMG' );
*
@@ -1439,5 +1439,5 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
*
* @access private
*/
- const CONSTRUCTOR_UNLOCK_CODE = 'Use WP_HTML_Processor::createFragment instead of calling the class constructor directly.';
+ const CONSTRUCTOR_UNLOCK_CODE = 'Use WP_HTML_Processor::create_fragment() instead of calling the class constructor directly.';
}
diff --git a/tests/phpunit/tests/html-api/wpHtmlProcessor.php b/tests/phpunit/tests/html-api/wpHtmlProcessor.php
index d6b818dd44..37e3aa5de8 100644
--- a/tests/phpunit/tests/html-api/wpHtmlProcessor.php
+++ b/tests/phpunit/tests/html-api/wpHtmlProcessor.php
@@ -52,7 +52,7 @@ class Tests_HtmlApi_WpHtmlProcessor extends WP_UnitTestCase {
* @covers WP_HTML_Processor::get_tag
*/
public function test_get_tag_is_null_once_document_is_finished() {
- $p = WP_HTML_Processor::createFragment( 'Test
' );
+ $p = WP_HTML_Processor::create_fragment( 'Test
' );
$p->next_tag();
$this->assertSame( 'DIV', $p->get_tag() );
@@ -69,7 +69,7 @@ class Tests_HtmlApi_WpHtmlProcessor extends WP_UnitTestCase {
* @covers WP_HTML_Processor::next_tag
*/
public function test_stops_processing_after_unsupported_elements() {
- $p = WP_HTML_Processor::createFragment( '
' );
+ $p = WP_HTML_Processor::create_fragment( '
' );
$p->next_tag( 'P' );
$this->assertFalse( $p->next_tag(), 'Stepped into a tag after encountering X-NOT-SUPPORTED element when it should have aborted.' );
$this->assertNull( $p->get_tag(), "Should have aborted processing, but still reported tag {$p->get_tag()} after properly failing to step into tag." );
@@ -95,7 +95,7 @@ class Tests_HtmlApi_WpHtmlProcessor extends WP_UnitTestCase {
* @throws WP_HTML_Unsupported_Exception
*/
public function test_clear_to_navigate_after_seeking() {
- $p = WP_HTML_Processor::createFragment( '
' );
+ $p = WP_HTML_Processor::create_fragment( '
' );
while ( $p->next_tag() ) {
// Create a bookmark before entering a stack of elements and formatting elements.
@@ -144,7 +144,7 @@ class Tests_HtmlApi_WpHtmlProcessor extends WP_UnitTestCase {
* @covers WP_HTML_Processor::reconstruct_active_formatting_elements
*/
public function test_fails_to_reconstruct_formatting_elements() {
- $p = WP_HTML_Processor::createFragment( 'OneTwoThreeFour' );
+ $p = WP_HTML_Processor::create_fragment( 'OneTwoThreeFour' );
$this->assertTrue( $p->next_tag( 'EM' ), 'Could not find first EM.' );
$this->assertFalse( $p->next_tag( 'EM' ), 'Should have aborted before finding second EM as it required reconstructing the first EM.' );
diff --git a/tests/phpunit/tests/html-api/wpHtmlProcessorBreadcrumbs.php b/tests/phpunit/tests/html-api/wpHtmlProcessorBreadcrumbs.php
index 4f86f856e7..932b3ca8f2 100644
--- a/tests/phpunit/tests/html-api/wpHtmlProcessorBreadcrumbs.php
+++ b/tests/phpunit/tests/html-api/wpHtmlProcessorBreadcrumbs.php
@@ -23,7 +23,7 @@ class Tests_HtmlApi_WpHtmlProcessorBreadcrumbs extends WP_UnitTestCase {
* @param string $tag_name Name of first tag in HTML (because HTML treats IMAGE as IMG this may not match the HTML).
*/
public function test_navigates_into_normative_html_for_supported_elements( $html, $tag_name ) {
- $p = WP_HTML_Processor::createFragment( $html );
+ $p = WP_HTML_Processor::create_fragment( $html );
$this->assertTrue( $p->step(), "Failed to step into supported {$tag_name} element." );
$this->assertSame( $tag_name, $p->get_tag(), "Misread {$tag_name} as a {$p->get_tag()} element." );
@@ -85,7 +85,7 @@ class Tests_HtmlApi_WpHtmlProcessorBreadcrumbs extends WP_UnitTestCase {
* @param string $html HTML string containing unsupported elements.
*/
public function test_fails_when_encountering_unsupported_tag( $html ) {
- $p = WP_HTML_Processor::createFragment( $html );
+ $p = WP_HTML_Processor::create_fragment( $html );
$this->assertFalse( $p->step(), "Should not have stepped into unsupported {$p->get_tag()} element." );
}
@@ -236,7 +236,7 @@ class Tests_HtmlApi_WpHtmlProcessorBreadcrumbs extends WP_UnitTestCase {
* @param string $html HTML containing unsupported markup.
*/
public function test_fails_when_encountering_unsupported_markup( $html, $description ) {
- $p = WP_HTML_Processor::createFragment( $html );
+ $p = WP_HTML_Processor::create_fragment( $html );
while ( $p->step() && null === $p->get_attribute( 'supported' ) ) {
continue;
@@ -277,7 +277,7 @@ class Tests_HtmlApi_WpHtmlProcessorBreadcrumbs extends WP_UnitTestCase {
* @param int $n How many breadcrumb matches to scan through in order to find "target" element.
*/
public function test_finds_correct_tag_given_breadcrumbs( $html, $breadcrumbs, $n ) {
- $p = WP_HTML_Processor::createFragment( $html );
+ $p = WP_HTML_Processor::create_fragment( $html );
$p->next_tag(
array(
@@ -303,7 +303,7 @@ class Tests_HtmlApi_WpHtmlProcessorBreadcrumbs extends WP_UnitTestCase {
* @return void
*/
public function test_reports_correct_breadcrumbs_for_html( $html, $breadcrumbs, $ignored_n ) {
- $p = WP_HTML_Processor::createFragment( $html );
+ $p = WP_HTML_Processor::create_fragment( $html );
while ( $p->next_tag() && null === $p->get_attribute( 'target' ) ) {
continue;
@@ -362,7 +362,7 @@ class Tests_HtmlApi_WpHtmlProcessorBreadcrumbs extends WP_UnitTestCase {
* @param bool $should_match Whether the target node should match the breadcrumbs.
*/
public function test_reports_if_tag_matches_breadcrumbs_of_various_specificity( $html_with_target_node, $breadcrumbs, $should_match ) {
- $processor = WP_HTML_Processor::createFragment( $html_with_target_node );
+ $processor = WP_HTML_Processor::create_fragment( $html_with_target_node );
while ( $processor->next_tag() && null === $processor->get_attribute( 'target' ) ) {
continue;
}
@@ -420,7 +420,7 @@ class Tests_HtmlApi_WpHtmlProcessorBreadcrumbs extends WP_UnitTestCase {
* @covers WP_HTML_Processor::set_attribute
*/
public function test_can_modify_attributes_after_finding_tag() {
- $p = WP_HTML_Processor::createFragment( 'test ' );
+ $p = WP_HTML_Processor::create_fragment( '
test ' );
$this->assertTrue( $p->next_tag( array( 'breadcrumbs' => array( 'figcaption' ) ) ), 'Unable to find given tag.' );
@@ -438,7 +438,7 @@ class Tests_HtmlApi_WpHtmlProcessorBreadcrumbs extends WP_UnitTestCase {
* @covers WP_HTML_Processor::next_tag
*/
public function test_can_query_an_element_by_tag_name() {
- $p = WP_HTML_Processor::createFragment( '
' );
+ $p = WP_HTML_Processor::create_fragment( '
' );
$p->next_tag( 'IMG' );
$p->set_attribute( 'loading', 'lazy' );
@@ -455,7 +455,7 @@ class Tests_HtmlApi_WpHtmlProcessorBreadcrumbs extends WP_UnitTestCase {
* @covers WP_HTML_Processor::seek
*/
public function test_can_seek_back_and_forth() {
- $p = WP_HTML_Processor::createFragment( '
' );
+ $p = WP_HTML_Processor::create_fragment( '
' );
// Find first tag of interest.
while ( $p->next_tag() && null === $p->get_attribute( 'one' ) ) {
diff --git a/tests/phpunit/tests/html-api/wpHtmlProcessorSemanticRules.php b/tests/phpunit/tests/html-api/wpHtmlProcessorSemanticRules.php
index 8fd3661ea0..01bb41ba84 100644
--- a/tests/phpunit/tests/html-api/wpHtmlProcessorSemanticRules.php
+++ b/tests/phpunit/tests/html-api/wpHtmlProcessorSemanticRules.php
@@ -27,7 +27,7 @@ class Tests_HtmlApi_WpHtmlProcessorSemanticRules extends WP_UnitTestCase {
* @throws Exception
*/
public function test_in_body_skips_unexpected_button_closer() {
- $p = WP_HTML_Processor::createFragment( '
Test
' );
+ $p = WP_HTML_Processor::create_fragment( '
Test
' );
$p->step();
$this->assertEquals( 'DIV', $p->get_tag(), 'Did not stop at initial DIV tag.' );
@@ -52,7 +52,7 @@ class Tests_HtmlApi_WpHtmlProcessorSemanticRules extends WP_UnitTestCase {
* @throws WP_HTML_Unsupported_Exception
*/
public function test_in_body_button_with_no_button_in_scope() {
- $p = WP_HTML_Processor::createFragment( '
not here ' );
+ $p = WP_HTML_Processor::create_fragment( '
not here ' );
$this->assertTrue( $p->next_tag( 'BUTTON' ), 'Could not find expected first button.' );
$this->assertTrue( $p->get_attribute( 'one' ), 'Failed to match expected attribute on first button.' );
@@ -79,7 +79,7 @@ class Tests_HtmlApi_WpHtmlProcessorSemanticRules extends WP_UnitTestCase {
* @throws WP_HTML_Unsupported_Exception
*/
public function test_in_body_button_with_button_in_scope_as_parent() {
- $p = WP_HTML_Processor::createFragment( '
Click the button almosthere !
not here ' );
+ $p = WP_HTML_Processor::create_fragment( '
Click the button almosthere !
not here ' );
$this->assertTrue( $p->next_tag( 'BUTTON' ), 'Could not find expected first button.' );
$this->assertTrue( $p->get_attribute( 'one' ), 'Failed to match expected attribute on first button.' );
@@ -114,7 +114,7 @@ class Tests_HtmlApi_WpHtmlProcessorSemanticRules extends WP_UnitTestCase {
* @throws WP_HTML_Unsupported_Exception
*/
public function test_in_body_button_with_button_in_scope_as_ancestor() {
- $p = WP_HTML_Processor::createFragment( '
not here ' );
+ $p = WP_HTML_Processor::create_fragment( '
not here ' );
// This button finds itself normally nesting inside the DIV.
$this->assertTrue( $p->next_tag( 'BUTTON' ), 'Could not find expected first button.' );
@@ -149,7 +149,7 @@ class Tests_HtmlApi_WpHtmlProcessorSemanticRules extends WP_UnitTestCase {
* @covers WP_HTML_Processor::step_in_body
*/
public function test_in_body_any_other_end_tag_with_unclosed_special_element() {
- $p = WP_HTML_Processor::createFragment( '
' );
+ $p = WP_HTML_Processor::create_fragment( '
' );
$p->next_tag( 'P' );
$this->assertSame( 'P', $p->get_tag(), "Expected to start test on P element but found {$p->get_tag()} instead." );
@@ -172,7 +172,7 @@ class Tests_HtmlApi_WpHtmlProcessorSemanticRules extends WP_UnitTestCase {
* @covers WP_HTML_Processor::step_in_body
*/
public function test_in_body_any_other_end_tag_with_unclosed_non_special_element() {
- $p = WP_HTML_Processor::createFragment( '
' );
+ $p = WP_HTML_Processor::create_fragment( '
' );
$p->next_tag( 'CODE' );
$this->assertSame( 'CODE', $p->get_tag(), "Expected to start test on CODE element but found {$p->get_tag()} instead." );
diff --git a/tests/phpunit/tests/html-api/wpHtmlSupportRequiredHtmlProcessor.php b/tests/phpunit/tests/html-api/wpHtmlSupportRequiredHtmlProcessor.php
index b9dbbc8cb8..b0951b580c 100644
--- a/tests/phpunit/tests/html-api/wpHtmlSupportRequiredHtmlProcessor.php
+++ b/tests/phpunit/tests/html-api/wpHtmlSupportRequiredHtmlProcessor.php
@@ -42,7 +42,7 @@ class Tests_HtmlApi_WpHtmlSupportRequiredHtmlProcessor extends WP_UnitTestCase {
* @param string $tag_name the HTML Processor should abort when encountering this tag, e.g. "BUTTON".
*/
private function ensure_support_is_added_everywhere( $tag_name ) {
- $p = WP_HTML_Processor::createFragment( "<$tag_name>" );
+ $p = WP_HTML_Processor::create_fragment( "<$tag_name>" );
$this->assertFalse( $p->step(), "Must support terminating elements in specific scope check before adding support for the {$tag_name} element." );
}
diff --git a/tests/phpunit/tests/html-api/wpHtmlSupportRequiredOpenElements.php b/tests/phpunit/tests/html-api/wpHtmlSupportRequiredOpenElements.php
index afc619a869..9dbb689df0 100644
--- a/tests/phpunit/tests/html-api/wpHtmlSupportRequiredOpenElements.php
+++ b/tests/phpunit/tests/html-api/wpHtmlSupportRequiredOpenElements.php
@@ -44,7 +44,7 @@ class Tests_HtmlApi_WpHtmlSupportRequiredOpenElements extends WP_UnitTestCase {
* @param string $tag_name the HTML Processor should abort when encountering this tag, e.g. "BUTTON".
*/
private function ensure_support_is_added_everywhere( $tag_name ) {
- $p = WP_HTML_Processor::createFragment( "<$tag_name>" );
+ $p = WP_HTML_Processor::create_fragment( "<$tag_name>" );
$this->assertFalse( $p->step(), "Must support terminating elements in specific scope check before adding support for the {$tag_name} element." );
}