WordPress.org

Make WordPress Core

Changeset 35987


Ignore:
Timestamp:
12/17/2015 04:55:23 PM (5 years ago)
Author:
boonebgorges
Message:

More focused test for post_type in tag cloud links.

We should not be testing the entire tag cloud markup, as it leads to collateral
damage wheneven wp_generate_tag_cloud() is touched. See [35984].

See #25566, #35138.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/post.php

    r35817 r35987  
    985985        ) );
    986986
     987        preg_match_all( "|href='([^']+)'|", $wp_tag_cloud, $matches );
     988        $this->assertSame( 1, count( $matches[1] ) );
     989
    987990        $terms = get_terms( $tax );
    988991        $term = reset( $terms );
    989         $url = sprintf( '%s?action=edit&taxonomy=%s&tag_ID=%d&post_type=%s',
    990             admin_url( 'edit-tags.php' ),
    991             $tax,
    992             $term->term_id,
    993             $post_type
    994         );
    995         $expected_wp_tag_cloud = sprintf( "<a href='%s' class='tag-link-%d' title='1 topic' style='font-size: 8pt;'>%s</a>",
    996             $url,
    997             $term->term_id,
    998             $term->name
    999         );
    1000         $this->assertEquals( $expected_wp_tag_cloud, $wp_tag_cloud );
    1001 
    1002         _unregister_post_type( $post_type );
    1003         _unregister_taxonomy( $tax );
     992
     993        foreach ( $matches[1] as $url ) {
     994            $this->assertContains( 'tag_ID=' . $term->term_id, $url );
     995            $this->assertContains( 'post_type=new_post_type', $url );
     996        }
    1004997    }
    1005998
Note: See TracChangeset for help on using the changeset viewer.