diff --git a/tests/phpunit/tests/term/wpGenerateTagCloud.php b/tests/phpunit/tests/term/wpGenerateTagCloud.php index 47a1283657..4f50ecc1d7 100644 --- a/tests/phpunit/tests/term/wpGenerateTagCloud.php +++ b/tests/phpunit/tests/term/wpGenerateTagCloud.php @@ -78,10 +78,12 @@ class Tests_WP_Generate_Tag_Cloud extends WP_UnitTestCase { 'number' => 1, 'hide_empty' => false, ) ); - $expected = "{$term->name}"; - $this->assertEquals( $expected, wp_generate_tag_cloud( $tags, array( + + $found = wp_generate_tag_cloud( $tags, array( 'hide_empty' => false, - ) ) ); + ) ); + + $this->assertContains( '>' . $tags[0]->name . '<', $found ); } function test_hide_empty_false_format_array() { @@ -94,10 +96,13 @@ class Tests_WP_Generate_Tag_Cloud extends WP_UnitTestCase { 'format' => 'array', ) ); - $expected = "{$term->name}"; - $this->assertEquals( $expected, wp_generate_tag_cloud( $tags, array( + $found = wp_generate_tag_cloud( $tags, array( 'hide_empty' => false, - ) ) ); + 'format' => 'array', + ) ); + + $this->assertInternalType( 'array', $found ); + $this->assertContains( '>' . $tags[0]->name . '<', $found[0] ); } function test_hide_empty_false_format_list() { @@ -109,11 +114,14 @@ class Tests_WP_Generate_Tag_Cloud extends WP_UnitTestCase { 'hide_empty' => false, ) ); - $expected = "\n"; - $this->assertEquals( $expected, wp_generate_tag_cloud( $tags, array( + $found = wp_generate_tag_cloud( $tags, array( 'hide_empty' => false, 'format' => 'list', - ) ) ); + ) ); + + $this->assertRegExp( "|^\n|", $found ); + $this->assertContains( '>' . $tags[0]->name . '<', $found ); } function test_hide_empty_false_multi() { @@ -129,13 +137,13 @@ class Tests_WP_Generate_Tag_Cloud extends WP_UnitTestCase { 'hide_empty' => false, ) ); - $expected = "{$terms[0]->name}\n". - "{$terms[1]->name}\n". - "{$terms[2]->name}\n". - "{$terms[3]->name}"; - $this->assertEquals( $expected, wp_generate_tag_cloud( $tags, array( + $found = wp_generate_tag_cloud( $tags, array( 'hide_empty' => false, - ) ) ); + ) ); + + foreach ( $tags as $tag ) { + $this->assertContains( '>' . $tag->name . '<', $found ); + } } function test_hide_empty_false_multi_format_list() { @@ -151,17 +159,17 @@ class Tests_WP_Generate_Tag_Cloud extends WP_UnitTestCase { 'hide_empty' => false, ) ); - $expected = "\n"; - - $this->assertEquals( $expected, wp_generate_tag_cloud( $tags, array( + $found = wp_generate_tag_cloud( $tags, array( 'hide_empty' => false, 'format' => 'list', - ) ) ); + ) ); + + $this->assertRegExp( "|^\n|", $found ); + + foreach ( $tags as $tag ) { + $this->assertContains( '>' . $tag->name . '<', $found ); + } } public function test_topic_count_text() {