Make WordPress Core


Ignore:
Timestamp:
07/07/2021 10:32:56 AM (4 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/rest-api/rest-post-statuses-controller.php

    r48939 r51367  
    3939        $data     = $response->get_data();
    4040        $statuses = get_post_stati( array( 'public' => true ), 'objects' );
    41         $this->assertSame( 1, count( $data ) );
     41        $this->assertCount( 1, $data );
    4242        $this->assertSame( 'publish', $data['publish']['slug'] );
    4343    }
     
    5151
    5252        $data = $response->get_data();
    53         $this->assertSame( 6, count( $data ) );
     53        $this->assertCount( 6, $data );
    5454        $this->assertSameSets(
    5555            array(
     
    154154        $data       = $response->get_data();
    155155        $properties = $data['schema']['properties'];
    156         $this->assertSame( 8, count( $properties ) );
     156        $this->assertCount( 8, $properties );
    157157        $this->assertArrayHasKey( 'name', $properties );
    158158        $this->assertArrayHasKey( 'private', $properties );
Note: See TracChangeset for help on using the changeset viewer.