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/pomo/mo.php

    r48937 r51367  
    1616            $mo->headers
    1717        );
    18         $this->assertSame( 2, count( $mo->entries ) );
     18        $this->assertCount( 2, $mo->entries );
    1919        $this->assertSame( array( 'dyado' ), $mo->entries['baba']->translations );
    2020        $this->assertSame( array( 'yes' ), $mo->entries["kuku\nruku"]->translations );
     
    2424        $mo = new MO();
    2525        $mo->import_from_file( DIR_TESTDATA . '/pomo/plural.mo' );
    26         $this->assertSame( 1, count( $mo->entries ) );
     26        $this->assertCount( 1, $mo->entries );
    2727        $this->assertSame( array( 'oney dragoney', 'twoey dragoney', 'manyey dragoney', 'manyeyey dragoney', 'manyeyeyey dragoney' ), $mo->entries['one dragon']->translations );
    2828
     
    5050        $mo = new MO();
    5151        $mo->import_from_file( DIR_TESTDATA . '/pomo/context.mo' );
    52         $this->assertSame( 2, count( $mo->entries ) );
     52        $this->assertCount( 2, $mo->entries );
    5353        $plural_entry = new Translation_Entry(
    5454            array(
     
    8282        $guest->add_entry( new Translation_Entry( array( 'singular' => 'red' ) ) );
    8383        $host->merge_with( $guest );
    84         $this->assertSame( 3, count( $host->entries ) );
     84        $this->assertCount( 3, $host->entries );
    8585        $this->assertSame( array(), array_diff( array( 'pink', 'green', 'red' ), array_keys( $host->entries ) ) );
    8686    }
     
    160160        $again->import_from_file( $temp_fn );
    161161
    162         $this->assertSame( 0, count( $again->entries ) );
     162        $this->assertCount( 0, $again->entries );
    163163    }
    164164
Note: See TracChangeset for help on using the changeset viewer.