Tests: Use more appropriate assertions in various tests.

This replaces instances of `assertSame( [number], count( ... ) )` with `assertCount()` to use native PHPUnit functionality.

Follow-up to [51335], [51337].

See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51367 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2021-07-07 10:32:56 +00:00
parent b1f0971ee3
commit e77691036d
63 changed files with 291 additions and 291 deletions
+3 -3
View File
@@ -98,12 +98,12 @@ class Tests_Post extends WP_UnitTestCase {
update_object_term_cache( $id, $post_type );
$tcache = wp_cache_get( $id, 'post_tag_relationships' );
$this->assertIsArray( $tcache );
$this->assertSame( 2, count( $tcache ) );
$this->assertCount( 2, $tcache );
$tcache = wp_cache_get( $id, 'ctax_relationships' );
if ( 'cpt' === $post_type ) {
$this->assertIsArray( $tcache );
$this->assertSame( 2, count( $tcache ) );
$this->assertCount( 2, $tcache );
} else {
$this->assertFalse( $tcache );
}
@@ -917,7 +917,7 @@ class Tests_Post extends WP_UnitTestCase {
);
preg_match_all( '|href="([^"]+)"|', $wp_tag_cloud, $matches );
$this->assertSame( 1, count( $matches[1] ) );
$this->assertCount( 1, $matches[1] );
$terms = get_terms( $tax );
$term = reset( $terms );