Make WordPress Core


Ignore:
Timestamp:
07/07/2021 10:32:56 AM (5 years 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/xmlrpc/wp/getPosts.php

    r49108 r51367  
    7272        $results = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter ) );
    7373        $this->assertNotIXRError( $results );
    74         $this->assertSame( $num_posts, count( $results ) );
     74        $this->assertCount( $num_posts, $results );
    7575
    7676        // Page through results.
     
    8484        } while ( count( $presults ) > 0 );
    8585        // Verify that $post_ids matches $posts_found.
    86         $this->assertSame( 0, count( array_diff( $post_ids, $posts_found ) ) );
     86        $this->assertCount( 0, array_diff( $post_ids, $posts_found ) );
    8787
    8888        // Add comments to some of the posts.
     
    118118        $results3 = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter3 ) );
    119119        $this->assertNotIXRError( $results3 );
    120         $this->assertSame( 1, count( $results3 ) );
     120        $this->assertCount( 1, $results3 );
    121121        $this->assertEquals( $post->ID, $results3[0]['post_id'] );
    122122
     
    160160        $results = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter ) );
    161161        $this->assertNotIXRError( $results );
    162         $this->assertSame( 0, count( $results ) );
     162        $this->assertCount( 0, $results );
    163163
    164164        // Search for one of them.
     
    166166        $results = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter ) );
    167167        $this->assertNotIXRError( $results );
    168         $this->assertSame( 1, count( $results ) );
     168        $this->assertCount( 1, $results );
    169169    }
    170170
Note: See TracChangeset for help on using the changeset viewer.