WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/07/2021 10:32:56 AM (3 months ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

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

    r51331 r51367  
    9999            $tcache = wp_cache_get( $id, 'post_tag_relationships' );
    100100            $this->assertIsArray( $tcache );
    101             $this->assertSame( 2, count( $tcache ) );
     101            $this->assertCount( 2, $tcache );
    102102
    103103            $tcache = wp_cache_get( $id, 'ctax_relationships' );
    104104            if ( 'cpt' === $post_type ) {
    105105                $this->assertIsArray( $tcache );
    106                 $this->assertSame( 2, count( $tcache ) );
     106                $this->assertCount( 2, $tcache );
    107107            } else {
    108108                $this->assertFalse( $tcache );
     
    918918
    919919        preg_match_all( '|href="([^"]+)"|', $wp_tag_cloud, $matches );
    920         $this->assertSame( 1, count( $matches[1] ) );
     920        $this->assertCount( 1, $matches[1] );
    921921
    922922        $terms = get_terms( $tax );
Note: See TracChangeset for help on using the changeset viewer.