From 5b2a8ed2a0a9350a38345983c64d5d51c55b6ad8 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Thu, 17 Dec 2015 16:55:23 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@35987 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/post.php | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/tests/phpunit/tests/post.php b/tests/phpunit/tests/post.php index 6345438039..f98786e2f3 100644 --- a/tests/phpunit/tests/post.php +++ b/tests/phpunit/tests/post.php @@ -984,23 +984,16 @@ class Tests_Post extends WP_UnitTestCase { 'link' => 'edit' ) ); + preg_match_all( "|href='([^']+)'|", $wp_tag_cloud, $matches ); + $this->assertSame( 1, count( $matches[1] ) ); + $terms = get_terms( $tax ); $term = reset( $terms ); - $url = sprintf( '%s?action=edit&taxonomy=%s&tag_ID=%d&post_type=%s', - admin_url( 'edit-tags.php' ), - $tax, - $term->term_id, - $post_type - ); - $expected_wp_tag_cloud = sprintf( "%s", - $url, - $term->term_id, - $term->name - ); - $this->assertEquals( $expected_wp_tag_cloud, $wp_tag_cloud ); - _unregister_post_type( $post_type ); - _unregister_taxonomy( $tax ); + foreach ( $matches[1] as $url ) { + $this->assertContains( 'tag_ID=' . $term->term_id, $url ); + $this->assertContains( 'post_type=new_post_type', $url ); + } } /**