Make WordPress Core


Ignore:
Timestamp:
10/05/2023 10:40:48 PM (2 years ago)
Author:
SergeyBiryukov
Message:

HTML API: Rename WP_HTML_Processor::createFragment() to follow WPCS.

WP_HTML_Processor::create_fragment() is the correct method name as per the WordPress PHP coding standards.

Follow-up to [56274].

Props dmsnell, jrf, hellofromTonya, SergeyBiryukov.
Fixes #59547.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/html-api/wpHtmlProcessorBreadcrumbs.php

    r56702 r56790  
    2424     */
    2525    public function test_navigates_into_normative_html_for_supported_elements( $html, $tag_name ) {
    26         $p = WP_HTML_Processor::createFragment( $html );
     26        $p = WP_HTML_Processor::create_fragment( $html );
    2727
    2828        $this->assertTrue( $p->step(), "Failed to step into supported {$tag_name} element." );
     
    8686     */
    8787    public function test_fails_when_encountering_unsupported_tag( $html ) {
    88         $p = WP_HTML_Processor::createFragment( $html );
     88        $p = WP_HTML_Processor::create_fragment( $html );
    8989
    9090        $this->assertFalse( $p->step(), "Should not have stepped into unsupported {$p->get_tag()} element." );
     
    237237     */
    238238    public function test_fails_when_encountering_unsupported_markup( $html, $description ) {
    239         $p = WP_HTML_Processor::createFragment( $html );
     239        $p = WP_HTML_Processor::create_fragment( $html );
    240240
    241241        while ( $p->step() && null === $p->get_attribute( 'supported' ) ) {
     
    278278     */
    279279    public function test_finds_correct_tag_given_breadcrumbs( $html, $breadcrumbs, $n ) {
    280         $p = WP_HTML_Processor::createFragment( $html );
     280        $p = WP_HTML_Processor::create_fragment( $html );
    281281
    282282        $p->next_tag(
     
    304304     */
    305305    public function test_reports_correct_breadcrumbs_for_html( $html, $breadcrumbs, $ignored_n ) {
    306         $p = WP_HTML_Processor::createFragment( $html );
     306        $p = WP_HTML_Processor::create_fragment( $html );
    307307
    308308        while ( $p->next_tag() && null === $p->get_attribute( 'target' ) ) {
     
    363363     */
    364364    public function test_reports_if_tag_matches_breadcrumbs_of_various_specificity( $html_with_target_node, $breadcrumbs, $should_match ) {
    365         $processor = WP_HTML_Processor::createFragment( $html_with_target_node );
     365        $processor = WP_HTML_Processor::create_fragment( $html_with_target_node );
    366366        while ( $processor->next_tag() && null === $processor->get_attribute( 'target' ) ) {
    367367            continue;
     
    421421     */
    422422    public function test_can_modify_attributes_after_finding_tag() {
    423         $p = WP_HTML_Processor::createFragment( '<div><figure><img><figcaption>test</figcaption></figure>' );
     423        $p = WP_HTML_Processor::create_fragment( '<div><figure><img><figcaption>test</figcaption></figure>' );
    424424
    425425        $this->assertTrue( $p->next_tag( array( 'breadcrumbs' => array( 'figcaption' ) ) ), 'Unable to find given tag.' );
     
    439439     */
    440440    public function test_can_query_an_element_by_tag_name() {
    441         $p = WP_HTML_Processor::createFragment( '<div><DIV><strong><img></strong></DIV>' );
     441        $p = WP_HTML_Processor::create_fragment( '<div><DIV><strong><img></strong></DIV>' );
    442442        $p->next_tag( 'IMG' );
    443443        $p->set_attribute( 'loading', 'lazy' );
     
    456456     */
    457457    public function test_can_seek_back_and_forth() {
    458         $p = WP_HTML_Processor::createFragment( '<div><p one><div><p><div two><p><div><p><div><p three>' );
     458        $p = WP_HTML_Processor::create_fragment( '<div><p one><div><p><div two><p><div><p><div><p three>' );
    459459
    460460        // Find first tag of interest.
Note: See TracChangeset for help on using the changeset viewer.