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/formats.php

    r51331 r51367  
    1414        $this->assertNotWPError( $result );
    1515        $this->assertIsArray( $result );
    16         $this->assertSame( 1, count( $result ) );
     16        $this->assertCount( 1, $result );
    1717
    1818        $format = get_post_format( $post_id );
     
    2222        $this->assertNotWPError( $result );
    2323        $this->assertIsArray( $result );
    24         $this->assertSame( 0, count( $result ) );
     24        $this->assertCount( 0, $result );
    2525
    2626        $result = set_post_format( $post_id, '' );
    2727        $this->assertNotWPError( $result );
    2828        $this->assertIsArray( $result );
    29         $this->assertSame( 0, count( $result ) );
     29        $this->assertCount( 0, $result );
    3030    }
    3131
     
    4242        $this->assertNotWPError( $result );
    4343        $this->assertIsArray( $result );
    44         $this->assertSame( 1, count( $result ) );
     44        $this->assertCount( 1, $result );
    4545        // The format can be set but not retrieved until it is registered.
    4646        $format = get_post_format( $post_id );
     
    5555        $this->assertNotWPError( $result );
    5656        $this->assertIsArray( $result );
    57         $this->assertSame( 0, count( $result ) );
     57        $this->assertCount( 0, $result );
    5858
    5959        $result = set_post_format( $post_id, '' );
    6060        $this->assertNotWPError( $result );
    6161        $this->assertIsArray( $result );
    62         $this->assertSame( 0, count( $result ) );
     62        $this->assertCount( 0, $result );
    6363
    6464        remove_post_type_support( 'page', 'post-formats' );
     
    7474        $this->assertNotWPError( $result );
    7575        $this->assertIsArray( $result );
    76         $this->assertSame( 1, count( $result ) );
     76        $this->assertCount( 1, $result );
    7777        $this->assertTrue( has_post_format( 'aside', $post_id ) );
    7878
     
    8080        $this->assertNotWPError( $result );
    8181        $this->assertIsArray( $result );
    82         $this->assertSame( 0, count( $result ) );
     82        $this->assertCount( 0, $result );
    8383        // Standard is a special case. It shows as false when set.
    8484        $this->assertFalse( has_post_format( 'standard', $post_id ) );
Note: See TracChangeset for help on using the changeset viewer.