WordPress.org

Make WordPress Core

Changeset 51367


Ignore:
Timestamp:
07/07/2021 10:32:56 AM (4 weeks 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.

Location:
trunk/tests/phpunit/tests
Files:
63 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/admin/includesScreen.php

    r50449 r51367  
    392392
    393393        $tabs = $screen->get_help_tabs();
    394         $this->assertSame( 4, count( $tabs ) );
     394        $this->assertCount( 4, $tabs );
    395395        $this->assertArrayHasKey( $tab_1, $tabs );
    396396        $this->assertArrayHasKey( $tab_2, $tabs );
     
    412412        $screen->remove_help_tab( $tab_1 );
    413413        $this->assertNull( $screen->get_help_tab( $tab_1 ) );
    414         $this->assertSame( 3, count( $screen->get_help_tabs() ) );
     414        $this->assertCount( 3, $screen->get_help_tabs() );
    415415
    416416        $screen->remove_help_tab( $tab_2 );
    417417        $this->assertNull( $screen->get_help_tab( $tab_2 ) );
    418         $this->assertSame( 2, count( $screen->get_help_tabs() ) );
     418        $this->assertCount( 2, $screen->get_help_tabs() );
    419419
    420420        $screen->remove_help_tab( $tab_3 );
    421421        $this->assertNull( $screen->get_help_tab( $tab_3 ) );
    422         $this->assertSame( 1, count( $screen->get_help_tabs() ) );
     422        $this->assertCount( 1, $screen->get_help_tabs() );
    423423
    424424        $screen->remove_help_tab( $tab_4 );
    425425        $this->assertNull( $screen->get_help_tab( $tab_4 ) );
    426         $this->assertSame( 0, count( $screen->get_help_tabs() ) );
     426        $this->assertCount( 0, $screen->get_help_tabs() );
    427427
    428428        $screen->remove_help_tabs();
  • trunk/tests/phpunit/tests/ajax/CustomizeMenus.php

    r49696 r51367  
    580580        if ( isset( $post_args['search'] ) && 'test' === $post_args['search'] ) {
    581581            $this->assertTrue( $response['success'] );
    582             $this->assertSame( 6, count( $response['data']['items'] ) );
     582            $this->assertCount( 6, $response['data']['items'] );
    583583            $item_ids = wp_list_pluck( $response['data']['items'], 'id' );
    584584            $this->assertContains( 'post-' . $included_auto_draft_post->ID, $item_ids );
  • trunk/tests/phpunit/tests/blocks/block-list.php

    r50450 r51367  
    107107        $blocks        = new WP_Block_List( $parsed_blocks, $context, $this->registry );
    108108
    109         $this->assertSame( 1, count( $blocks ) );
     109        $this->assertCount( 1, $blocks );
    110110    }
    111111
  • trunk/tests/phpunit/tests/category.php

    r48937 r51367  
    3030        // Validate length is 1 + created due to uncategorized.
    3131        $cat_ids = get_all_category_ids();
    32         $this->assertSame( 3, count( $cat_ids ) );
     32        $this->assertCount( 3, $cat_ids );
    3333    }
    3434
  • trunk/tests/phpunit/tests/comment.php

    r50375 r51367  
    12661266
    12671267        // Number of exported comments.
    1268         $this->assertSame( 1, count( $actual['data'] ) );
     1268        $this->assertCount( 1, $actual['data'] );
    12691269
    12701270        // Number of exported comment properties.
    1271         $this->assertSame( 8, count( $actual['data'][0]['data'] ) );
     1271        $this->assertCount( 8, $actual['data'][0]['data'] );
    12721272
    12731273        // Exported group.
     
    13291329
    13301330        // Number of exported comments.
    1331         $this->assertSame( 1, count( $actual['data'] ) );
     1331        $this->assertCount( 1, $actual['data'] );
    13321332
    13331333        // Number of exported comment properties.
    1334         $this->assertSame( 7, count( $actual['data'][0]['data'] ) );
     1334        $this->assertCount( 7, $actual['data'][0]['data'] );
    13351335    }
    13361336
     
    13601360
    13611361        // Number of exported comments.
    1362         $this->assertSame( 0, count( $actual['data'] ) );
     1362        $this->assertCount( 0, $actual['data'] );
    13631363    }
    13641364}
  • trunk/tests/phpunit/tests/comment/getCommentExcerpt.php

    r50449 r51367  
    1717        $excerpt = get_comment_excerpt( $comment_id );
    1818
    19         $this->assertSame( 20, count( explode( ' ', $excerpt ) ) );
     19        $this->assertCount( 20, explode( ' ', $excerpt ) );
    2020    }
    2121
     
    3131        $excerpt = get_comment_excerpt( $comment_id );
    3232
    33         $this->assertSame( 10, count( explode( ' ', $excerpt ) ) );
     33        $this->assertCount( 10, explode( ' ', $excerpt ) );
    3434    }
    3535
  • trunk/tests/phpunit/tests/comment/query.php

    r51331 r51367  
    12921292
    12931293        $comments = get_comments( array( 'post_id' => $post_id ) );
    1294         $this->assertSame( $limit, count( $comments ) );
     1294        $this->assertCount( $limit, $comments );
    12951295        foreach ( $comments as $comment ) {
    12961296            $this->assertEquals( $post_id, $comment->comment_post_ID );
     
    13011301
    13021302        $comments = get_comments( array( 'post_id' => $post_id2 ) );
    1303         $this->assertSame( $limit, count( $comments ) );
     1303        $this->assertCount( $limit, $comments );
    13041304        foreach ( $comments as $comment ) {
    13051305            $this->assertEquals( $post_id2, $comment->comment_post_ID );
     
    13101310
    13111311        $comments = get_comments( array( 'post_id' => $post_id3 ) );
    1312         $this->assertSame( $limit, count( $comments ) );
     1312        $this->assertCount( $limit, $comments );
    13131313        foreach ( $comments as $comment ) {
    13141314            $this->assertEquals( $post_id3, $comment->comment_post_ID );
     
    13211321            )
    13221322        );
    1323         $this->assertSame( $limit, count( $comments ) );
     1323        $this->assertCount( $limit, $comments );
    13241324        foreach ( $comments as $comment ) {
    13251325            $this->assertEquals( $post_id3, $comment->comment_post_ID );
     
    13321332            )
    13331333        );
    1334         $this->assertSame( 0, count( $comments ) );
     1334        $this->assertCount( 0, $comments );
    13351335
    13361336        self::factory()->comment->create_post_comments( $post_id3, $limit, array( 'comment_approved' => '1' ) );
    13371337        $comments = get_comments( array( 'post_id' => $post_id3 ) );
    1338         $this->assertSame( $limit * 2, count( $comments ) );
     1338        $this->assertCount( $limit * 2, $comments );
    13391339        foreach ( $comments as $comment ) {
    13401340            $this->assertEquals( $post_id3, $comment->comment_post_ID );
     
    13631363            )
    13641364        );
    1365         $this->assertSame( 2, count( $comments ) );
     1365        $this->assertCount( 2, $comments );
    13661366        $this->assertEquals( $comment_id2, $comments[0]->comment_ID );
    13671367        $this->assertEquals( $comment_id, $comments[1]->comment_ID );
     
    13731373            )
    13741374        );
    1375         $this->assertSame( 2, count( $comments ) );
     1375        $this->assertCount( 2, $comments );
    13761376        $this->assertEquals( $comment_id2, $comments[0]->comment_ID );
    13771377        $this->assertEquals( $comment_id, $comments[1]->comment_ID );
     
    13841384            )
    13851385        );
    1386         $this->assertSame( 2, count( $comments ) );
     1386        $this->assertCount( 2, $comments );
    13871387        $this->assertEquals( $comment_id, $comments[0]->comment_ID );
    13881388        $this->assertEquals( $comment_id2, $comments[1]->comment_ID );
     
    13951395            )
    13961396        );
    1397         $this->assertSame( 2, count( $comments ) );
     1397        $this->assertCount( 2, $comments );
    13981398        $this->assertEquals( $comment_id, $comments[0]->comment_ID );
    13991399        $this->assertEquals( $comment_id2, $comments[1]->comment_ID );
     
    14231423            )
    14241424        );
    1425         $this->assertSame( 1, count( $comments ) );
     1425        $this->assertCount( 1, $comments );
    14261426
    14271427        $comments = get_comments(
     
    14311431            )
    14321432        );
    1433         $this->assertSame( 1, count( $comments ) );
     1433        $this->assertCount( 1, $comments );
    14341434    }
    14351435
  • trunk/tests/phpunit/tests/feed/rss2.php

    r50337 r51367  
    107107
    108108        // There should only be one <rss> child element.
    109         $this->assertSame( 1, count( $rss ) );
     109        $this->assertCount( 1, $rss );
    110110
    111111        $this->assertSame( '2.0', $rss[0]['attributes']['version'] );
     
    115115
    116116        // RSS should have exactly one child element (channel).
    117         $this->assertSame( 1, count( $rss[0]['child'] ) );
     117        $this->assertCount( 1, $rss[0]['child'] );
    118118    }
    119119
     
    321321
    322322        // There should only be one <rss> child element.
    323         $this->assertSame( 1, count( $rss ) );
     323        $this->assertCount( 1, $rss );
    324324    }
    325325
     
    349349
    350350        // There should only be one <rss> child element.
    351         $this->assertSame( 1, count( $rss ) );
     351        $this->assertCount( 1, $rss );
    352352    }
    353353
     
    382382
    383383        // There should only be one <rss> child element.
    384         $this->assertSame( 1, count( $rss ) );
     384        $this->assertCount( 1, $rss );
    385385    }
    386386
     
    410410
    411411        // There should only be one <rss> child element.
    412         $this->assertSame( 1, count( $rss ) );
     412        $this->assertCount( 1, $rss );
    413413    }
    414414
     
    438438
    439439        // There should only be one <rss> child element.
    440         $this->assertSame( 1, count( $rss ) );
     440        $this->assertCount( 1, $rss );
    441441    }
    442442
     
    466466
    467467        // There should only be one <rss> child element.
    468         $this->assertSame( 1, count( $rss ) );
     468        $this->assertCount( 1, $rss );
    469469    }
    470470
  • trunk/tests/phpunit/tests/functions/wpListFilter.php

    r49184 r51367  
    5252            'AND'
    5353        );
    54         $this->assertSame( 2, count( $list ) );
     54        $this->assertCount( 2, $list );
    5555        $this->assertArrayHasKey( 'foo', $list );
    5656        $this->assertArrayHasKey( 'bar', $list );
     
    6666            'OR'
    6767        );
    68         $this->assertSame( 3, count( $list ) );
     68        $this->assertCount( 3, $list );
    6969        $this->assertArrayHasKey( 'foo', $list );
    7070        $this->assertArrayHasKey( 'bar', $list );
     
    8181            'NOT'
    8282        );
    83         $this->assertSame( 1, count( $list ) );
     83        $this->assertCount( 1, $list );
    8484        $this->assertArrayHasKey( 'baz', $list );
    8585    }
     
    289289    function test_filter_object_list_nested_array_and() {
    290290        $list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'blue' ) ), 'AND' );
    291         $this->assertSame( 1, count( $list ) );
     291        $this->assertCount( 1, $list );
    292292        $this->assertArrayHasKey( 'baz', $list );
    293293    }
     
    295295    function test_filter_object_list_nested_array_not() {
    296296        $list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'red' ) ), 'NOT' );
    297         $this->assertSame( 2, count( $list ) );
     297        $this->assertCount( 2, $list );
    298298        $this->assertArrayHasKey( 'bar', $list );
    299299        $this->assertArrayHasKey( 'baz', $list );
     
    309309            'OR'
    310310        );
    311         $this->assertSame( 2, count( $list ) );
     311        $this->assertCount( 2, $list );
    312312        $this->assertArrayHasKey( 'foo', $list );
    313313        $this->assertArrayHasKey( 'baz', $list );
     
    316316    function test_filter_object_list_nested_array_or_singular() {
    317317        $list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'blue' ) ), 'OR' );
    318         $this->assertSame( 1, count( $list ) );
     318        $this->assertCount( 1, $list );
    319319        $this->assertArrayHasKey( 'baz', $list );
    320320    }
  • trunk/tests/phpunit/tests/import/import.php

    r50463 r51367  
    8686            )
    8787        );
    88         $this->assertSame( 11, count( $posts ) );
     88        $this->assertCount( 11, $posts );
    8989
    9090        $post = $posts[0];
     
    9696        $this->assertSame( 0, $post->post_parent );
    9797        $cats = wp_get_post_categories( $post->ID );
    98         $this->assertSame( 27, count( $cats ) );
     98        $this->assertCount( 27, $cats );
    9999
    100100        $post = $posts[1];
     
    106106        $this->assertSame( 0, $post->post_parent );
    107107        $cats = wp_get_post_categories( $post->ID );
    108         $this->assertSame( 1, count( $cats ) );
     108        $this->assertCount( 1, $cats );
    109109        $this->assertTrue( has_post_format( 'aside', $post->ID ) );
    110110
     
    117117        $this->assertSame( 0, $post->post_parent );
    118118        $cats = wp_get_post_categories( $post->ID, array( 'fields' => 'all' ) );
    119         $this->assertSame( 1, count( $cats ) );
     119        $this->assertCount( 1, $cats );
    120120        $this->assertSame( 'foo', $cats[0]->slug );
    121121
     
    128128        $this->assertSame( 0, $post->post_parent );
    129129        $cats = wp_get_post_categories( $post->ID, array( 'fields' => 'all' ) );
    130         $this->assertSame( 1, count( $cats ) );
     130        $this->assertCount( 1, $cats );
    131131        $this->assertSame( 'foo-bar', $cats[0]->slug );
    132132
     
    139139        $this->assertSame( 0, $post->post_parent );
    140140        $cats = wp_get_post_categories( $post->ID );
    141         $this->assertSame( 1, count( $cats ) );
     141        $this->assertCount( 1, $cats );
    142142        $tags = wp_get_post_tags( $post->ID );
    143         $this->assertSame( 3, count( $tags ) );
     143        $this->assertCount( 3, $tags );
    144144        $this->assertSame( 'tag1', $tags[0]->slug );
    145145        $this->assertSame( 'tag2', $tags[1]->slug );
     
    199199        $this->assertSame( 0, $post->post_parent );
    200200        $cats = wp_get_post_categories( $post->ID );
    201         $this->assertSame( 1, count( $cats ) );
     201        $this->assertCount( 1, $cats );
    202202    }
    203203
  • trunk/tests/phpunit/tests/import/parser.php

    r51335 r51367  
    107107            );
    108108
    109             $this->assertSame( 2, count( $result['posts'] ), $message );
    110             $this->assertSame( 19, count( $result['posts'][0] ), $message );
    111             $this->assertSame( 18, count( $result['posts'][1] ), $message );
     109            $this->assertCount( 2, $result['posts'], $message );
     110            $this->assertCount( 19, $result['posts'][0], $message );
     111            $this->assertCount( 18, $result['posts'][1], $message );
    112112            $this->assertEquals(
    113113                array(
     
    161161            $this->assertSame( $result['tags'][0]['tag_name'], 'chicken', $message );
    162162
    163             $this->assertSame( 6, count( $result['posts'] ), $message );
    164             $this->assertSame( 19, count( $result['posts'][0] ), $message );
    165             $this->assertSame( 18, count( $result['posts'][1] ), $message );
     163            $this->assertCount( 6, $result['posts'], $message );
     164            $this->assertCount( 19, $result['posts'][0], $message );
     165            $this->assertCount( 18, $result['posts'][1], $message );
    166166
    167167            $this->assertEquals(
  • trunk/tests/phpunit/tests/meta.php

    r51331 r51367  
    101101
    102102        foreach ( $found as $action => $mids ) {
    103             $this->assertSame( 2, count( $mids ) );
     103            $this->assertCount( 2, $mids );
    104104        }
    105105    }
     
    138138        );
    139139
    140         $this->assertSame( 1, count( $u ) );
     140        $this->assertCount( 1, $u );
    141141
    142142        // User found is not locally defined author (it's the admin).
  • trunk/tests/phpunit/tests/multisite/networkQuery.php

    r49603 r51367  
    7171            );
    7272
    73             $this->assertSame( 3, count( $found ) );
     73            $this->assertCount( 3, $found );
    7474        }
    7575
  • trunk/tests/phpunit/tests/multisite/siteQuery.php

    r49603 r51367  
    136136            );
    137137
    138             $this->assertSame( 3, count( $found ) );
     138            $this->assertCount( 3, $found );
    139139        }
    140140
  • 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
  • trunk/tests/phpunit/tests/pomo/po.php

    r48937 r51367  
    318318        $po = new PO();
    319319        $this->assertTrue( $po->import_from_file( DIR_TESTDATA . '/pomo/windows-line-endings.po' ) );
    320         $this->assertSame( 1, count( $po->entries ) );
     320        $this->assertCount( 1, $po->entries );
    321321    }
    322322
  • 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 );
  • 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 ) );
  • trunk/tests/phpunit/tests/post/getPages.php

    r50449 r51367  
    1717
    1818        $pages = get_pages();
    19         $this->assertSame( 3, count( $pages ) );
     19        $this->assertCount( 3, $pages );
    2020        $time1 = wp_cache_get( 'last_changed', 'posts' );
    2121        $this->assertNotEmpty( $time1 );
     
    2727        // Again. num_queries and last_changed should remain the same.
    2828        $pages = get_pages();
    29         $this->assertSame( 3, count( $pages ) );
     29        $this->assertCount( 3, $pages );
    3030        $this->assertSame( $time1, wp_cache_get( 'last_changed', 'posts' ) );
    3131        $this->assertSame( $num_queries, $wpdb->num_queries );
     
    3737        // different args to get_pages(). num_queries should bump by 1.
    3838        $pages = get_pages( array( 'number' => 2 ) );
    39         $this->assertSame( 2, count( $pages ) );
     39        $this->assertCount( 2, $pages );
    4040        $this->assertSame( $time1, wp_cache_get( 'last_changed', 'posts' ) );
    4141        $this->assertSame( $num_queries + 1, $wpdb->num_queries );
     
    4848        // Again. num_queries and last_changed should remain the same.
    4949        $pages = get_pages( array( 'number' => 2 ) );
    50         $this->assertSame( 2, count( $pages ) );
     50        $this->assertCount( 2, $pages );
    5151        $this->assertSame( $time1, wp_cache_get( 'last_changed', 'posts' ) );
    5252        $this->assertSame( $num_queries, $wpdb->num_queries );
     
    5757        // Do the first query again. The interim queries should not affect it.
    5858        $pages = get_pages();
    59         $this->assertSame( 3, count( $pages ) );
     59        $this->assertCount( 3, $pages );
    6060        $this->assertSame( $time1, wp_cache_get( 'last_changed', 'posts' ) );
    6161        $this->assertSame( $num_queries, $wpdb->num_queries );
     
    7272        // last_changed bumped so num_queries should increment.
    7373        $pages = get_pages( array( 'number' => 2 ) );
    74         $this->assertSame( 2, count( $pages ) );
     74        $this->assertCount( 2, $pages );
    7575        $this->assertSame( $time2, wp_cache_get( 'last_changed', 'posts' ) );
    7676        $this->assertSame( $num_queries + 1, $wpdb->num_queries );
     
    9292        // num_queries should bump after wp_delete_post() bumps last_changed.
    9393        $pages = get_pages();
    94         $this->assertSame( 2, count( $pages ) );
     94        $this->assertCount( 2, $pages );
    9595        $this->assertSame( $last_changed, wp_cache_get( 'last_changed', 'posts' ) );
    9696        $this->assertSame( $num_queries + 1, $wpdb->num_queries );
     
    278278            )
    279279        );
    280         $this->assertSame( 3, count( get_pages( array( 'meta_key' => 'some-meta-key' ) ) ) );
     280        $this->assertCount( 3,  get_pages( array( 'meta_key' => 'some-meta-key' ) ) );
    281281    }
    282282
     
    373373        preg_match_all( '#<option#', wp_dropdown_pages( 'echo=0' ), $matches );
    374374
    375         $this->assertSame( 5, count( $matches[0] ) );
     375        $this->assertCount( 5, $matches[0] );
    376376    }
    377377
  • trunk/tests/phpunit/tests/post/objects.php

    r51331 r51367  
    114114
    115115        $this->assertIsArray( $post->post_category );
    116         $this->assertSame( 1, count( $post->post_category ) );
     116        $this->assertCount( 1, $post->post_category );
    117117        $this->assertEquals( get_option( 'default_category' ), $post->post_category[0] );
    118118        $term1 = wp_insert_term( 'Foo', 'category' );
     
    120120        $term3 = wp_insert_term( 'Baz', 'category' );
    121121        wp_set_post_categories( $post_id, array( $term1['term_id'], $term2['term_id'], $term3['term_id'] ) );
    122         $this->assertSame( 3, count( $post->post_category ) );
     122        $this->assertCount( 3, $post->post_category );
    123123        $this->assertSame( array( $term2['term_id'], $term3['term_id'], $term1['term_id'] ), $post->post_category );
    124124
    125125        $post = get_post( $post_id, ARRAY_A );
    126         $this->assertSame( 3, count( $post['post_category'] ) );
     126        $this->assertCount( 3, $post['post_category'] );
    127127        $this->assertSame( array( $term2['term_id'], $term3['term_id'], $term1['term_id'] ), $post['post_category'] );
    128128    }
     
    136136        wp_set_post_tags( $post_id, 'Foo, Bar, Baz' );
    137137        $this->assertIsArray( $post->tags_input );
    138         $this->assertSame( 3, count( $post->tags_input ) );
     138        $this->assertCount( 3, $post->tags_input );
    139139        $this->assertSame( array( 'Bar', 'Baz', 'Foo' ), $post->tags_input );
    140140
    141141        $post = get_post( $post_id, ARRAY_A );
    142142        $this->assertIsArray( $post['tags_input'] );
    143         $this->assertSame( 3, count( $post['tags_input'] ) );
     143        $this->assertCount( 3, $post['tags_input'] );
    144144        $this->assertSame( array( 'Bar', 'Baz', 'Foo' ), $post['tags_input'] );
    145145    }
  • trunk/tests/phpunit/tests/post/query.php

    r51331 r51367  
    9797
    9898        // Fourth post added in filter.
    99         $this->assertSame( 4, count( $query->posts ) );
     99        $this->assertCount( 4, $query->posts );
    100100        $this->assertSame( 4, $query->post_count );
    101101
  • trunk/tests/phpunit/tests/post/types.php

    r51331 r51367  
    350350        $this->assertNotContains( '%foo%', $wp_rewrite->rewritecode );
    351351        $this->assertNotContains( 'bar=', $wp_rewrite->queryreplace );
    352         $this->assertSame( --$count_before, count( $wp_rewrite->rewritereplace ) ); // Array was reduced by one value.
     352        $this->assertCount( --$count_before, $wp_rewrite->rewritereplace ); // Array was reduced by one value.
    353353    }
    354354
     
    462462
    463463        $this->assertArrayHasKey( 'future_foo', $wp_filter );
    464         $this->assertSame( 1, count( $wp_filter['future_foo']->callbacks ) );
     464        $this->assertCount( 1, $wp_filter['future_foo']->callbacks );
    465465        $this->assertTrue( unregister_post_type( 'foo' ) );
    466466        $this->assertArrayNotHasKey( 'future_foo', $wp_filter );
     
    482482
    483483        $this->assertArrayHasKey( 'add_meta_boxes_foo', $wp_filter );
    484         $this->assertSame( 1, count( $wp_filter['add_meta_boxes_foo']->callbacks ) );
     484        $this->assertCount( 1, $wp_filter['add_meta_boxes_foo']->callbacks );
    485485        $this->assertTrue( unregister_post_type( 'foo' ) );
    486486        $this->assertArrayNotHasKey( 'add_meta_boxes_foo', $wp_filter );
  • trunk/tests/phpunit/tests/query/metaQuery.php

    r48939 r51367  
    697697        );
    698698
    699         $this->assertSame( 0, count( $query->posts ) );
     699        $this->assertCount( 0, $query->posts );
    700700    }
    701701
     
    15351535
    15361536        $query = new WP_Query( $args );
    1537         $this->assertSame( 2, count( $query->posts ) );
     1537        $this->assertCount( 2, $query->posts );
    15381538        foreach ( $query->posts as $post ) {
    15391539            $this->assertInstanceOf( 'WP_Post', $post );
     
    15511551
    15521552        $query = new WP_Query( $args );
    1553         $this->assertSame( 3, count( $query->posts ) );
     1553        $this->assertCount( 3, $query->posts );
    15541554        foreach ( $query->posts as $post ) {
    15551555            $this->assertInstanceOf( 'WP_Post', $post );
     
    15831583        );
    15841584
    1585         $this->assertSame( 2, count( $posts ) );
     1585        $this->assertCount( 2, $posts );
    15861586        $posts = wp_list_pluck( $posts, 'ID' );
    15871587        $this->assertSameSets( array( $post_id, $post_id3 ), $posts );
     
    15951595        );
    15961596
    1597         $this->assertSame( 2, count( $posts ) );
     1597        $this->assertCount( 2, $posts );
    15981598        foreach ( $posts as $post ) {
    15991599            $this->assertInstanceOf( 'WP_Post', $post );
     
    16261626
    16271627        $posts = get_posts( $args );
    1628         $this->assertSame( 2, count( $posts ) );
     1628        $this->assertCount( 2, $posts );
    16291629        foreach ( $posts as $post ) {
    16301630            $this->assertInstanceOf( 'WP_Post', $post );
     
    16601660            )
    16611661        );
    1662         $this->assertSame( 1, count( $q->posts ) );
     1662        $this->assertCount( 1, $q->posts );
    16631663        foreach ( $q->posts as $post ) {
    16641664            $this->assertInstanceOf( 'WP_Post', $post );
     
    16731673            )
    16741674        );
    1675         $this->assertSame( 2, count( $posts ) );
     1675        $this->assertCount( 2, $posts );
    16761676        foreach ( $posts as $post ) {
    16771677            $this->assertInstanceOf( 'WP_Post', $post );
     
    16871687            )
    16881688        );
    1689         $this->assertSame( 2, count( $posts ) );
     1689        $this->assertCount( 2, $posts );
    16901690        foreach ( $posts as $post ) {
    16911691            $this->assertInstanceOf( 'WP_Post', $post );
     
    16961696
    16971697        $posts = get_posts( array( 'meta_value' => 0 ) );
    1698         $this->assertSame( 5, count( $posts ) );
     1698        $this->assertCount( 5, $posts );
    16991699        foreach ( $posts as $post ) {
    17001700            $this->assertInstanceOf( 'WP_Post', $post );
     
    17051705
    17061706        $posts = get_posts( array( 'meta_value' => '0' ) );
    1707         $this->assertSame( 5, count( $posts ) );
     1707        $this->assertCount( 5,  $posts );
    17081708        foreach ( $posts as $post ) {
    17091709            $this->assertInstanceOf( 'WP_Post', $post );
  • trunk/tests/phpunit/tests/query/taxQuery.php

    r48939 r51367  
    10261026
    10271027        $posts = $query->get_posts();
    1028         $this->assertSame( 0, count( $posts ) );
     1028        $this->assertCount( 0, $posts );
    10291029    }
    10301030
     
    10611061
    10621062        $posts = $query->get_posts();
    1063         $this->assertSame( 0, count( $posts ) );
     1063        $this->assertCount( 0, $posts );
    10641064    }
    10651065
     
    11131113        );
    11141114
    1115         $this->assertSame( 4, count( $posts ) );
     1115        $this->assertCount( 4, $posts );
    11161116
    11171117        $posts = get_posts(
     
    11311131        );
    11321132
    1133         $this->assertSame( 1, count( $posts ) );
     1133        $this->assertCount( 1, $posts );
    11341134
    11351135        $posts = get_posts(
     
    11481148        );
    11491149
    1150         $this->assertSame( 3, count( $posts ) );
     1150        $this->assertCount( 3, $posts );
    11511151
    11521152        $posts = get_posts(
     
    11661166        );
    11671167
    1168         $this->assertSame( 1, count( $posts ) );
     1168        $this->assertCount( 1, $posts );
    11691169
    11701170        $posts = get_posts(
     
    11831183        );
    11841184
    1185         $this->assertSame( 1, count( $posts ) );
     1185        $this->assertCount( 1, $posts );
    11861186
    11871187        $posts = get_posts(
     
    12011201        );
    12021202
    1203         $this->assertSame( 1, count( $posts ) );
     1203        $this->assertCount( 1, $posts );
    12041204    }
    12051205
  • trunk/tests/phpunit/tests/rest-api/rest-attachments-controller.php

    r51331 r51367  
    416416        $request  = new WP_REST_Request( 'GET', '/wp/v2/media' );
    417417        $response = rest_get_server()->dispatch( $request );
    418         $this->assertSame( 2, count( $response->get_data() ) );
     418        $this->assertCount( 2, $response->get_data() );
    419419        $request = new WP_REST_Request( 'GET', '/wp/v2/media' );
    420420        // Attachments without a parent.
     
    422422        $response = rest_get_server()->dispatch( $request );
    423423        $data     = $response->get_data();
    424         $this->assertSame( 1, count( $data ) );
     424        $this->assertCount( 1, $data );
    425425        $this->assertSame( $attachment_id2, $data[0]['id'] );
    426426        // Attachments with parent=post_id.
     
    429429        $response = rest_get_server()->dispatch( $request );
    430430        $data     = $response->get_data();
    431         $this->assertSame( 1, count( $data ) );
     431        $this->assertCount( 1, $data );
    432432        $this->assertSame( $attachment_id, $data[0]['id'] );
    433433        // Attachments with invalid parent.
     
    436436        $response = rest_get_server()->dispatch( $request );
    437437        $data     = $response->get_data();
    438         $this->assertSame( 0, count( $data ) );
     438        $this->assertCount( 0, $data );
    439439    }
    440440
     
    510510        $this->assertSame( 200, $response->get_status() );
    511511        $data = $response->get_data();
    512         $this->assertSame( 2, count( $data ) );
     512        $this->assertCount( 2, $data );
    513513        $ids = array(
    514514            $data[0]['id'],
     
    14661466        $data       = $response->get_data();
    14671467        $properties = $data['schema']['properties'];
    1468         $this->assertSame( 27, count( $properties ) );
     1468        $this->assertCount( 27, $properties );
    14691469        $this->assertArrayHasKey( 'author', $properties );
    14701470        $this->assertArrayHasKey( 'alt_text', $properties );
  • trunk/tests/phpunit/tests/rest-api/rest-autosaves-controller.php

    r49606 r51367  
    287287        $data       = $response->get_data();
    288288        $properties = $data['schema']['properties'];
    289         $this->assertSame( 13, count( $properties ) );
     289        $this->assertCount( 13, $properties );
    290290        $this->assertArrayHasKey( 'author', $properties );
    291291        $this->assertArrayHasKey( 'content', $properties );
  • trunk/tests/phpunit/tests/rest-api/rest-block-type-controller.php

    r50527 r51367  
    342342        $this->assertSame( $block_type, $data['name'] );
    343343        $this->assertArrayHasKey( 'variations', $data );
    344         $this->assertSame( 1, count( $data['variations'] ) );
     344        $this->assertCount( 1, $data['variations'] );
    345345        $variation = $data['variations'][0];
    346346        $this->assertSame( 'variation title', $variation['title'] );
  • trunk/tests/phpunit/tests/rest-api/rest-categories-controller.php

    r50463 r51367  
    184184        $response = rest_get_server()->dispatch( $request );
    185185        $data     = $response->get_data();
    186         $this->assertSame( 2, count( $data ) );
     186        $this->assertCount( 2, $data );
    187187        $this->assertSame( 'Season 5', $data[0]['name'] );
    188188        $this->assertSame( 'The Be Sharps', $data[1]['name'] );
     
    192192        $response = rest_get_server()->dispatch( $request );
    193193        $data     = $response->get_data();
    194         $this->assertSame( $total_categories, count( $data ) );
     194        $this->assertCount( $total_categories, $data );
    195195    }
    196196
     
    292292        $response = rest_get_server()->dispatch( $request );
    293293        $data     = $response->get_data();
    294         $this->assertSame( 2, count( $data ) );
     294        $this->assertCount( 2, $data );
    295295        $this->assertSame( $id1, $data[0]['id'] );
    296296
     
    299299        $response = rest_get_server()->dispatch( $request );
    300300        $data     = $response->get_data();
    301         $this->assertSame( 2, count( $data ) );
     301        $this->assertCount( 2, $data );
    302302        $this->assertSame( $id2, $data[0]['id'] );
    303303    }
     
    340340        $this->assertSame( 200, $response->get_status() );
    341341        $data = $response->get_data();
    342         $this->assertSame( 1, count( $data ) );
     342        $this->assertCount( 1, $data );
    343343        $this->assertSame( 'Uncategorized', $data[0]['name'] );
    344344
     
    350350        $this->assertSame( 200, $response->get_status() );
    351351        $data = $response->get_data();
    352         $this->assertSame( 2, count( $data ) );
     352        $this->assertCount( 2, $data );
    353353        $this->assertSame( 'Apple', $data[0]['name'] );
    354354    }
     
    440440
    441441        $data = $response->get_data();
    442         $this->assertSame( 3, count( $data ) );
     442        $this->assertCount( 3, $data );
    443443
    444444        // Check ordered by name by default.
     
    458458
    459459        $data = $response->get_data();
    460         $this->assertSame( 3, count( $data ) );
     460        $this->assertCount( 3, $data );
    461461        $names = wp_list_pluck( $data, 'name' );
    462462        $this->assertSame( array( 'Image', 'Marvel', 'DC' ), $names, 'Terms should be ordered by description' );
     
    468468
    469469        $data = $response->get_data();
    470         $this->assertSame( 3, count( $data ) );
     470        $this->assertCount( 3, $data );
    471471        $names = wp_list_pluck( $data, 'name' );
    472472        $this->assertSame( array( 'DC', 'Marvel', 'Image' ), $names, 'Terms should be reverse-ordered by description' );
     
    483483
    484484        $data = $response->get_data();
    485         $this->assertSame( 3, count( $data ) );
     485        $this->assertCount( 3, $data );
    486486        $names = wp_list_pluck( $data, 'name' );
    487487        $this->assertSame( array( 'DC', 'Marvel', 'Image' ), $names );
     
    519519
    520520        $data = $response->get_data();
    521         $this->assertSame( 2, count( $data ) );
     521        $this->assertCount( 2, $data );
    522522        $this->assertSame( 'Cape', $data[0]['name'] );
    523523    }
     
    536536        $this->assertSame( 200, $response->get_status() );
    537537        $data = $response->get_data();
    538         $this->assertSame( 1, count( $data ) );
     538        $this->assertCount( 1, $data );
    539539        $this->assertSame( 'Apple', $data[0]['name'] );
    540540
     
    544544        $this->assertSame( 200, $response->get_status() );
    545545        $data = $response->get_data();
    546         $this->assertSame( 0, count( $data ) );
     546        $this->assertCount( 0, $data );
    547547    }
    548548
     
    556556        $this->assertSame( 200, $response->get_status() );
    557557        $data = $response->get_data();
    558         $this->assertSame( 1, count( $data ) );
     558        $this->assertCount( 1, $data );
    559559        $this->assertSame( 'Apple', $data[0]['name'] );
    560560    }
     
    573573        $response = rest_get_server()->dispatch( $request );
    574574        $data     = $response->get_data();
    575         $this->assertSame( 1, count( $data ) );
     575        $this->assertCount( 1, $data );
    576576        $this->assertSame( 'Child', $data[0]['name'] );
    577577    }
     
    11311131        $data       = $response->get_data();
    11321132        $properties = $data['schema']['properties'];
    1133         $this->assertSame( 9, count( $properties ) );
     1133        $this->assertCount( 9, $properties );
    11341134        $this->assertArrayHasKey( 'id', $properties );
    11351135        $this->assertArrayHasKey( 'count', $properties );
  • trunk/tests/phpunit/tests/rest-api/rest-comments-controller.php

    r51331 r51367  
    489489        $response = rest_get_server()->dispatch( $request );
    490490        $data     = $response->get_data();
    491         $this->assertSame( 2, count( $data ) );
     491        $this->assertCount( 2, $data );
    492492        $this->assertSame( $id1, $data[0]['id'] );
    493493
     
    496496        $response = rest_get_server()->dispatch( $request );
    497497        $data     = $response->get_data();
    498         $this->assertSame( 2, count( $data ) );
     498        $this->assertCount( 2, $data );
    499499        $this->assertSame( $id2, $data[0]['id'] );
    500500
     
    31573157        $data       = $response->get_data();
    31583158        $properties = $data['schema']['properties'];
    3159         $this->assertSame( 17, count( $properties ) );
     3159        $this->assertCount( 17, $properties );
    31603160        $this->assertArrayHasKey( 'id', $properties );
    31613161        $this->assertArrayHasKey( 'author', $properties );
  • trunk/tests/phpunit/tests/rest-api/rest-pages-controller.php

    r50463 r51367  
    110110        $response = rest_get_server()->dispatch( $request );
    111111        $data     = $response->get_data();
    112         $this->assertSame( 1, count( $data ) );
     112        $this->assertCount( 1, $data );
    113113        $this->assertSame( $id1, $data[0]['id'] );
    114114    }
     
    133133        $response = rest_get_server()->dispatch( $request );
    134134        $data     = $response->get_data();
    135         $this->assertSame( 2, count( $data ) );
     135        $this->assertCount( 2, $data );
    136136
    137137        // Filter to parent.
     
    139139        $response = rest_get_server()->dispatch( $request );
    140140        $data     = $response->get_data();
    141         $this->assertSame( 1, count( $data ) );
     141        $this->assertCount( 1, $data );
    142142        $this->assertSame( $id2, $data[0]['id'] );
    143143
     
    180180        $response = rest_get_server()->dispatch( $request );
    181181        $data     = $response->get_data();
    182         $this->assertSame( 4, count( $data ) );
     182        $this->assertCount( 4, $data );
    183183
    184184        // Filter to parents.
     
    186186        $response = rest_get_server()->dispatch( $request );
    187187        $data     = $response->get_data();
    188         $this->assertSame( 2, count( $data ) );
     188        $this->assertCount( 2, $data );
    189189        $this->assertSameSets( array( $id2, $id4 ), wp_list_pluck( $data, 'id' ) );
    190190    }
     
    209209        $response = rest_get_server()->dispatch( $request );
    210210        $data     = $response->get_data();
    211         $this->assertSame( 2, count( $data ) );
     211        $this->assertCount( 2, $data );
    212212
    213213        // Filter to parent.
     
    215215        $response = rest_get_server()->dispatch( $request );
    216216        $data     = $response->get_data();
    217         $this->assertSame( 1, count( $data ) );
     217        $this->assertCount( 1, $data );
    218218        $this->assertSame( $id1, $data[0]['id'] );
    219219
     
    559559
    560560        $all_data = $response->get_data();
    561         $this->assertSame( 4, count( $all_data ) );
     561        $this->assertCount( 4, $all_data );
    562562        foreach ( $all_data as $post ) {
    563563            $this->assertSame( 'page', $post['type'] );
     
    738738        $data       = $response->get_data();
    739739        $properties = $data['schema']['properties'];
    740         $this->assertSame( 24, count( $properties ) );
     740        $this->assertCount( 24, $properties );
    741741        $this->assertArrayHasKey( 'author', $properties );
    742742        $this->assertArrayHasKey( 'comment_status', $properties );
  • 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 );
  • trunk/tests/phpunit/tests/rest-api/rest-post-types-controller.php

    r48939 r51367  
    145145        $data       = $response->get_data();
    146146        $properties = $data['schema']['properties'];
    147         $this->assertSame( 10, count( $properties ) );
     147        $this->assertCount( 10, $properties );
    148148        $this->assertArrayHasKey( 'capabilities', $properties );
    149149        $this->assertArrayHasKey( 'description', $properties );
  • trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php

    r51137 r51367  
    269269        $response = rest_get_server()->dispatch( $request );
    270270        $this->assertSame( 200, $response->get_status() );
    271         $this->assertSame( $total_posts, count( $response->get_data() ) );
     271        $this->assertCount( $total_posts, $response->get_data() );
    272272
    273273        // Limit to editor and author.
     
    277277        $this->assertSame( 200, $response->get_status() );
    278278        $data = $response->get_data();
    279         $this->assertSame( 2, count( $data ) );
     279        $this->assertCount( 2, $data );
    280280        $this->assertSameSets( array( self::$editor_id, self::$author_id ), wp_list_pluck( $data, 'author' ) );
    281281
     
    286286        $this->assertSame( 200, $response->get_status() );
    287287        $data = $response->get_data();
    288         $this->assertSame( 1, count( $data ) );
     288        $this->assertCount( 1, $data );
    289289        $this->assertSame( self::$editor_id, $data[0]['author'] );
    290290    }
     
    301301        $response = rest_get_server()->dispatch( $request );
    302302        $this->assertSame( 200, $response->get_status() );
    303         $this->assertSame( $total_posts, count( $response->get_data() ) );
     303        $this->assertCount( $total_posts, $response->get_data() );
    304304
    305305        // Exclude editor and author.
     
    310310        $this->assertSame( 200, $response->get_status() );
    311311        $data = $response->get_data();
    312         $this->assertSame( $total_posts - 2, count( $data ) );
     312        $this->assertCount( $total_posts - 2, $data );
    313313        $this->assertNotEquals( self::$editor_id, $data[0]['author'] );
    314314        $this->assertNotEquals( self::$author_id, $data[0]['author'] );
     
    321321        $this->assertSame( 200, $response->get_status() );
    322322        $data = $response->get_data();
    323         $this->assertSame( $total_posts - 1, count( $data ) );
     323        $this->assertCount( $total_posts - 1, $data );
    324324        $this->assertNotEquals( self::$editor_id, $data[0]['author'] );
    325325        $this->assertNotEquals( self::$editor_id, $data[1]['author'] );
     
    352352        $response = rest_get_server()->dispatch( $request );
    353353        $data     = $response->get_data();
    354         $this->assertSame( 2, count( $data ) );
     354        $this->assertCount( 2, $data );
    355355        $this->assertSame( $id2, $data[0]['id'] );
    356356        $this->assertPostsOrderedBy( '{posts}.post_date DESC' );
     
    360360        $response = rest_get_server()->dispatch( $request );
    361361        $data     = $response->get_data();
    362         $this->assertSame( 2, count( $data ) );
     362        $this->assertCount( 2, $data );
    363363        $this->assertSame( $id1, $data[0]['id'] );
    364364        $this->assertPostsOrderedBy( "FIELD({posts}.ID,$id1,$id2)" );
     
    510510        $request->set_param( 'per_page', self::$per_page );
    511511        $response = rest_get_server()->dispatch( $request );
    512         $this->assertSame( $total_posts, count( $response->get_data() ) );
     512        $this->assertCount( $total_posts,  $response->get_data() );
    513513
    514514        $request = new WP_REST_Request( 'GET', '/wp/v2/posts' );
     
    516516        $response = rest_get_server()->dispatch( $request );
    517517        $data     = $response->get_data();
    518         $this->assertSame( 1, count( $data ) );
     518        $this->assertCount( 1, $data );
    519519        $this->assertSame( 'Search Result', $data[0]['title']['rendered'] );
    520520    }
     
    539539        $this->assertSame( 200, $response->get_status() );
    540540        $data = $response->get_data();
    541         $this->assertSame( 1, count( $data ) );
     541        $this->assertCount( 1, $data );
    542542        $this->assertSame( 'Apple', $data[0]['title']['rendered'] );
    543543    }
     
    568568        $this->assertSame( 200, $response->get_status() );
    569569        $data = $response->get_data();
    570         $this->assertSame( 2, count( $data ) );
     570        $this->assertCount( 2, $data );
    571571        $titles = array(
    572572            $data[0]['title']['rendered'],
     
    602602        $this->assertSame( 200, $response->get_status() );
    603603        $data = $response->get_data();
    604         $this->assertSame( 2, count( $data ) );
     604        $this->assertCount( 2, $data );
    605605        $titles = array(
    606606            $data[0]['title']['rendered'],
     
    621621        $response = rest_get_server()->dispatch( $request );
    622622        $this->assertSame( 200, $response->get_status() );
    623         $this->assertSame( self::$total_posts, count( $response->get_data() ) );
     623        $this->assertCount( self::$total_posts, $response->get_data() );
    624624
    625625        $request = new WP_REST_Request( 'GET', '/wp/v2/posts' );
     
    634634        $response = rest_get_server()->dispatch( $request );
    635635        $this->assertSame( 200, $response->get_status() );
    636         $this->assertSame( 1, count( $response->get_data() ) );
     636        $this->assertCount( 1, $response->get_data() );
    637637    }
    638638
     
    651651        $this->assertSame( 200, $response->get_status() );
    652652        $data = $response->get_data();
    653         $this->assertSame( 2, count( $data ) );
     653        $this->assertCount( 2, $data );
    654654        $statuses = array(
    655655            $data[0]['status'],
     
    674674        $this->assertSame( 200, $response->get_status() );
    675675        $data = $response->get_data();
    676         $this->assertSame( 2, count( $data ) );
     676        $this->assertCount( 2, $data );
    677677        $statuses = array(
    678678            $data[0]['status'],
     
    41684168        $data       = $response->get_data();
    41694169        $properties = $data['schema']['properties'];
    4170         $this->assertSame( 26, count( $properties ) );
     4170        $this->assertCount( 26, $properties );
    41714171        $this->assertArrayHasKey( 'author', $properties );
    41724172        $this->assertArrayHasKey( 'comment_status', $properties );
  • trunk/tests/phpunit/tests/rest-api/rest-revisions-controller.php

    r50463 r51367  
    329329        $data       = $response->get_data();
    330330        $properties = $data['schema']['properties'];
    331         $this->assertSame( 12, count( $properties ) );
     331        $this->assertCount( 12, $properties );
    332332        $this->assertArrayHasKey( 'author', $properties );
    333333        $this->assertArrayHasKey( 'content', $properties );
  • trunk/tests/phpunit/tests/rest-api/rest-search-controller.php

    r49603 r51367  
    176176
    177177        $this->assertSame( 200, $response->get_status() );
    178         $this->assertSame( 3, count( $response->get_data() ) );
     178        $this->assertCount( 3, $response->get_data() );
    179179    }
    180180
  • trunk/tests/phpunit/tests/rest-api/rest-tags-controller.php

    r50463 r51367  
    201201        $response = rest_get_server()->dispatch( $request );
    202202        $data     = $response->get_data();
    203         $this->assertSame( 2, count( $data ) );
     203        $this->assertCount( 2, $data );
    204204        $this->assertSame( 'Season 5', $data[0]['name'] );
    205205        $this->assertSame( 'The Be Sharps', $data[1]['name'] );
     
    221221        $response = rest_get_server()->dispatch( $request );
    222222        $data     = $response->get_data();
    223         $this->assertSame( 2, count( $data ) );
     223        $this->assertCount( 2, $data );
    224224        $this->assertSame( $id1, $data[0]['id'] );
    225225
     
    228228        $response = rest_get_server()->dispatch( $request );
    229229        $data     = $response->get_data();
    230         $this->assertSame( 2, count( $data ) );
     230        $this->assertCount( 2, $data );
    231231        $this->assertSame( $id2, $data[0]['id'] );
    232232
     
    303303        $this->assertSame( 200, $response->get_status() );
    304304        $data = $response->get_data();
    305         $this->assertSame( 1, count( $data ) );
     305        $this->assertCount( 1, $data );
    306306        $this->assertSame( 'Zucchini', $data[0]['name'] );
    307307
     
    313313        $this->assertSame( 200, $response->get_status() );
    314314        $data = $response->get_data();
    315         $this->assertSame( 2, count( $data ) );
     315        $this->assertCount( 2, $data );
    316316        $this->assertSame( 'Apple', $data[0]['name'] );
    317317
     
    388388
    389389        $data = $response->get_data();
    390         $this->assertSame( 2, count( $data ) );
     390        $this->assertCount( 2, $data );
    391391        $this->assertSame( 'DC', $data[0]['name'] );
    392392
     
    475475
    476476        $data = $response->get_data();
    477         $this->assertSame( 2, count( $data ) );
     477        $this->assertCount( 2, $data );
    478478        $this->assertSame( 'Cape', $data[0]['name'] );
    479479    }
     
    492492        $this->assertSame( 200, $response->get_status() );
    493493        $data = $response->get_data();
    494         $this->assertSame( 1, count( $data ) );
     494        $this->assertCount( 1, $data );
    495495        $this->assertSame( 'Apple', $data[0]['name'] );
    496496
     
    500500        $this->assertSame( 200, $response->get_status() );
    501501        $data = $response->get_data();
    502         $this->assertSame( 0, count( $data ) );
     502        $this->assertCount( 0, $data );
    503503    }
    504504
     
    512512        $this->assertSame( 200, $response->get_status() );
    513513        $data = $response->get_data();
    514         $this->assertSame( 1, count( $data ) );
     514        $this->assertCount( 1, $data );
    515515        $this->assertSame( 'Apple', $data[0]['name'] );
    516516    }
     
    12251225        $data       = $response->get_data();
    12261226        $properties = $data['schema']['properties'];
    1227         $this->assertSame( 8, count( $properties ) );
     1227        $this->assertCount( 8, $properties );
    12281228        $this->assertArrayHasKey( 'id', $properties );
    12291229        $this->assertArrayHasKey( 'count', $properties );
  • trunk/tests/phpunit/tests/rest-api/rest-taxonomies-controller.php

    r50450 r51367  
    212212        $this->assertArrayHasKey( 1, $types );
    213213        $this->assertSame( 'attachment', $types[1] );
    214         $this->assertSame( 2, count( $types ) );
     214        $this->assertCount( 2, $types );
    215215    }
    216216
     
    220220        $data       = $response->get_data();
    221221        $properties = $data['schema']['properties'];
    222         $this->assertSame( 10, count( $properties ) );
     222        $this->assertCount( 10, $properties );
    223223        $this->assertArrayHasKey( 'capabilities', $properties );
    224224        $this->assertArrayHasKey( 'description', $properties );
  • trunk/tests/phpunit/tests/rest-api/rest-themes-controller.php

    r51137 r51367  
    343343        $data       = $response->get_data();
    344344        $properties = $data['schema']['properties'];
    345         $this->assertSame( 15, count( $properties ) );
     345        $this->assertCount( 15, $properties );
    346346
    347347        $this->assertArrayHasKey( 'author', $properties );
  • trunk/tests/phpunit/tests/rest-api/rest-users-controller.php

    r51331 r51367  
    388388        $request  = new WP_REST_Request( 'GET', '/wp/v2/users' );
    389389        $response = rest_get_server()->dispatch( $request );
    390         $this->assertSame( 10, count( $response->get_data() ) );
     390        $this->assertCount( 10, $response->get_data() );
    391391
    392392        $request = new WP_REST_Request( 'GET', '/wp/v2/users' );
    393393        $request->set_param( 'per_page', 5 );
    394394        $response = rest_get_server()->dispatch( $request );
    395         $this->assertSame( 5, count( $response->get_data() ) );
     395        $this->assertCount( 5, $response->get_data() );
    396396    }
    397397
     
    403403        $request->set_param( 'page', 2 );
    404404        $response = rest_get_server()->dispatch( $request );
    405         $this->assertSame( 5, count( $response->get_data() ) );
     405        $this->assertCount( 5, $response->get_data() );
    406406        $prev_link = add_query_arg(
    407407            array(
     
    599599        $response = rest_get_server()->dispatch( $request );
    600600        $data     = $response->get_data();
    601         $this->assertSame( 2, count( $data ) );
     601        $this->assertCount( 2, $data );
    602602        $this->assertSame( $id1, $data[0]['id'] );
    603603
     
    606606        $response = rest_get_server()->dispatch( $request );
    607607        $data     = $response->get_data();
    608         $this->assertSame( 2, count( $data ) );
     608        $this->assertCount( 2, $data );
    609609        $this->assertSame( $id2, $data[0]['id'] );
    610610
     
    619619        $response = rest_get_server()->dispatch( $request );
    620620        $data     = $response->get_data();
    621         $this->assertSame( 0, count( $data ) );
     621        $this->assertCount( 0, $data );
    622622
    623623    }
     
    656656        $request->set_param( 'search', 'yololololo' );
    657657        $response = rest_get_server()->dispatch( $request );
    658         $this->assertSame( 0, count( $response->get_data() ) );
     658        $this->assertCount( 0, $response->get_data() );
    659659
    660660        $yolo_id = $this->factory->user->create( array( 'display_name' => 'yololololo' ) );
     
    663663        $request->set_param( 'search', 'yololololo' );
    664664        $response = rest_get_server()->dispatch( $request );
    665         $this->assertSame( 1, count( $response->get_data() ) );
     665        $this->assertCount( 1, $response->get_data() );
    666666        // Default to wildcard search.
    667667        $adam_id = $this->factory->user->create(
     
    676676        $response = rest_get_server()->dispatch( $request );
    677677        $data     = $response->get_data();
    678         $this->assertSame( 1, count( $data ) );
     678        $this->assertCount( 1, $data );
    679679        $this->assertSame( $adam_id, $data[0]['id'] );
    680680    }
     
    700700        $response = rest_get_server()->dispatch( $request );
    701701        $data     = $response->get_data();
    702         $this->assertSame( 1, count( $data ) );
     702        $this->assertCount( 1, $data );
    703703        $this->assertSame( $id2, $data[0]['id'] );
    704704    }
     
    813813        $response = rest_get_server()->dispatch( $request );
    814814        $data     = $response->get_data();
    815         $this->assertSame( 3, count( $data ) );
     815        $this->assertCount( 3, $data );
    816816        $this->assertSame( $tango, $data[1]['id'] );
    817817        $this->assertSame( $yolo, $data[2]['id'] );
     
    820820        $response = rest_get_server()->dispatch( $request );
    821821        $data     = $response->get_data();
    822         $this->assertSame( 1, count( $data ) );
     822        $this->assertCount( 1, $data );
    823823        $this->assertSame( $yolo, $data[0]['id'] );
    824824
     
    850850        $response = rest_get_server()->dispatch( $request );
    851851        $data     = $response->get_data();
    852         $this->assertSame( 1, count( $data ) );
     852        $this->assertCount( 1, $data );
    853853        $this->assertSame( $lolz, $data[0]['id'] );
    854854
     
    857857        $response = rest_get_server()->dispatch( $request );
    858858        $data     = $response->get_data();
    859         $this->assertSame( 0, count( $data ) );
     859        $this->assertCount( 0, $data );
    860860        $this->assertSame( array(), $data );
    861861    }
     
    26212621        $properties = $data['schema']['properties'];
    26222622
    2623         $this->assertSame( 19, count( $properties ) );
     2623        $this->assertCount( 19, $properties );
    26242624        $this->assertArrayHasKey( 'avatar_urls', $properties );
    26252625        $this->assertArrayHasKey( 'capabilities', $properties );
  • trunk/tests/phpunit/tests/rest-api/rest-widgets-controller.php

    r51277 r51367  
    14511451        $properties = $data['schema']['properties'];
    14521452
    1453         $this->assertSame( 7, count( $properties ) );
     1453        $this->assertCount( 7, $properties );
    14541454        $this->assertArrayHasKey( 'id', $properties );
    14551455        $this->assertArrayHasKey( 'id_base', $properties );
  • trunk/tests/phpunit/tests/taxonomy.php

    r51337 r51367  
    863863        $this->assertNotContains( '%foo%', $wp_rewrite->rewritecode );
    864864        $this->assertNotContains( 'bar=', $wp_rewrite->queryreplace );
    865         $this->assertSame( --$count_before, count( $wp_rewrite->rewritereplace ) ); // Array was reduced by one value.
     865        $this->assertCount( --$count_before, $wp_rewrite->rewritereplace ); // Array was reduced by one value.
    866866    }
    867867
     
    892892
    893893        $this->assertArrayHasKey( 'wp_ajax_add-foo', $wp_filter );
    894         $this->assertSame( 1, count( $wp_filter['wp_ajax_add-foo']->callbacks ) );
     894        $this->assertCount( 1, $wp_filter['wp_ajax_add-foo']->callbacks );
    895895        $this->assertTrue( unregister_taxonomy( 'foo' ) );
    896896        $this->assertArrayNotHasKey( 'wp_ajax_add-foo', $wp_filter );
  • trunk/tests/phpunit/tests/term.php

    r51331 r51367  
    102102
    103103        $tt = wp_add_object_terms( $posts[0], $tags[1], 'post_tag' );
    104         $this->assertSame( 1, count( $tt ) );
     104        $this->assertCount( 1, $tt );
    105105        $this->assertSame( array( $tags[1] ), wp_get_object_terms( $posts[0], 'post_tag', array( 'fields' => 'ids' ) ) );
    106106
    107107        $three_tags = array( $tags[0], $tags[1], $tags[2] );
    108108        $tt         = wp_add_object_terms( $posts[1], $three_tags, 'post_tag' );
    109         $this->assertSame( 3, count( $tt ) );
     109        $this->assertCount( 3, $tt );
    110110        $this->assertSame( $three_tags, wp_get_object_terms( $posts[1], 'post_tag', array( 'fields' => 'ids' ) ) );
    111111
     
    114114        $this->assertInstanceOf( 'WP_Error', wp_remove_object_terms( $posts[0], $tags[1], 'non_existing_taxonomy' ) );
    115115        $this->assertTrue( wp_remove_object_terms( $posts[1], $three_tags, 'post_tag' ) );
    116         $this->assertSame( 0, count( wp_get_object_terms( $posts[1], 'post_tag' ) ) );
     116        $this->assertCount( 0, wp_get_object_terms( $posts[1], 'post_tag' ) );
    117117
    118118        foreach ( $tags as $term_id ) {
     
    178178
    179179        $this->assertIsArray( $post->post_category );
    180         $this->assertSame( 1, count( $post->post_category ) );
     180        $this->assertCount( 1, $post->post_category );
    181181        $this->assertEquals( get_option( 'default_category' ), $post->post_category[0] );
    182182
     
    186186
    187187        wp_set_post_categories( $post_id, array( $term1['term_id'], $term2['term_id'] ) );
    188         $this->assertSame( 2, count( $post->post_category ) );
     188        $this->assertCount( 2, $post->post_category );
    189189        $this->assertSame( array( $term2['term_id'], $term1['term_id'] ), $post->post_category );
    190190
     
    201201
    202202        wp_set_post_categories( $post_id, array(), true );
    203         $this->assertSame( 1, count( $post->post_category ) );
     203        $this->assertCount( 1, $post->post_category );
    204204        $this->assertEquals( get_option( 'default_category' ), $post->post_category[0] );
    205205
    206206        wp_set_post_categories( $post_id, array() );
    207         $this->assertSame( 1, count( $post->post_category ) );
     207        $this->assertCount( 1, $post->post_category );
    208208        $this->assertEquals( get_option( 'default_category' ), $post->post_category[0] );
    209209    }
  • trunk/tests/phpunit/tests/term/cache.php

    r50926 r51367  
    8484
    8585            $terms = get_terms( $tax, array( 'hide_empty' => false ) );
    86             $this->assertSame( $i, count( $terms ) );
     86            $this->assertCount( $i, $terms );
    8787            if ( $i > 1 ) {
    8888                $hierarchy = _get_term_hierarchy( $tax );
  • trunk/tests/phpunit/tests/term/getTerms.php

    r51331 r51367  
    116116        // last_changed and num_queries should bump.
    117117        $terms = get_terms( 'post_tag', array( 'update_term_meta_cache' => false ) );
    118         $this->assertSame( 3, count( $terms ) );
     118        $this->assertCount( 3, $terms );
    119119        $time1 = wp_cache_get( 'last_changed', 'terms' );
    120120        $this->assertNotEmpty( $time1 );
     
    125125        // Again. last_changed and num_queries should remain the same.
    126126        $terms = get_terms( 'post_tag', array( 'update_term_meta_cache' => false ) );
    127         $this->assertSame( 3, count( $terms ) );
     127        $this->assertCount( 3, $terms );
    128128        $this->assertSame( $time1, wp_cache_get( 'last_changed', 'terms' ) );
    129129        $this->assertSame( $num_queries, $wpdb->num_queries );
     
    145145        // num_queries should bump, last_changed should remain the same.
    146146        $terms = get_terms( 'post_tag', array( 'number' => 2 ) );
    147         $this->assertSame( 2, count( $terms ) );
     147        $this->assertCount( 2, $terms );
    148148        $this->assertSame( $time1, wp_cache_get( 'last_changed', 'terms' ) );
    149149        $this->assertSame( $num_queries + 1, $wpdb->num_queries );
     
    153153        // Again. last_changed and num_queries should remain the same.
    154154        $terms = get_terms( 'post_tag', array( 'number' => 2 ) );
    155         $this->assertSame( 2, count( $terms ) );
     155        $this->assertCount( 2, $terms );
    156156        $this->assertSame( $time1, wp_cache_get( 'last_changed', 'terms' ) );
    157157        $this->assertSame( $num_queries, $wpdb->num_queries );
     
    180180        // last_changed and num_queries should bump after a term is deleted.
    181181        $terms = get_terms( 'post_tag' );
    182         $this->assertSame( 2, count( $terms ) );
     182        $this->assertCount( 2, $terms );
    183183        $this->assertSame( $time2, wp_cache_get( 'last_changed', 'terms' ) );
    184184        $this->assertSame( $num_queries + 1, $wpdb->num_queries );
     
    188188        // Again. last_changed and num_queries should remain the same.
    189189        $terms = get_terms( 'post_tag' );
    190         $this->assertSame( 2, count( $terms ) );
     190        $this->assertCount( 2, $terms );
    191191        $this->assertSame( $time2, wp_cache_get( 'last_changed', 'terms' ) );
    192192        $this->assertSame( $num_queries, $wpdb->num_queries );
     
    618618            )
    619619        );
    620         $this->assertSame( 2, count( $terms ) );
     620        $this->assertCount( 2, $terms );
    621621        $this->assertSame( wp_list_pluck( $terms, 'name' ), array( 'Cheese', 'Crackers' ) );
    622622    }
     
    661661            )
    662662        );
    663         $this->assertSame( 1, count( $terms ) );
     663        $this->assertCount( 1, $terms );
    664664        $this->assertSame( array( 'Cheese' ), wp_list_pluck( $terms, 'name' ) );
    665665
     
    697697            )
    698698        );
    699         $this->assertSame( 1, count( $terms ) );
     699        $this->assertCount( 1, $terms );
    700700        $this->assertSame( array( 'term1' ), wp_list_pluck( $terms, 'name' ) );
    701701
     
    717717            )
    718718        );
    719         $this->assertSame( 1, count( $terms ) );
     719        $this->assertCount( 1, $terms );
    720720    }
    721721
     
    23092309
    23102310        // Verify that there are no children.
    2311         $this->assertSame( 0, count( $terms ) );
     2311        $this->assertCount( 0, $terms );
    23122312    }
    23132313
     
    23752375
    23762376        // Verify that there are no children.
    2377         $this->assertSame( 0, count( $terms ) );
     2377        $this->assertCount( 0, $terms );
    23782378    }
    23792379
     
    24882488
    24892489        // 'hierarchical=false' means that descendants are not fetched.
    2490         $this->assertSame( 0, count( $terms ) );
     2490        $this->assertCount( 0, $terms );
    24912491    }
    24922492
  • trunk/tests/phpunit/tests/term/getTheTerms.php

    r51335 r51367  
    2323        // Cache should be empty after a set.
    2424        $tt_1 = wp_set_object_terms( $post_id, $terms_1, $this->taxonomy );
    25         $this->assertSame( 3, count( $tt_1 ) );
     25        $this->assertCount( 3, $tt_1 );
    2626        $this->assertFalse( wp_cache_get( $post_id, $this->taxonomy . '_relationships' ) );
    2727
     
    4444        // Cache should be empty after a set.
    4545        $tt_2 = wp_set_object_terms( $post_id, $terms_2, $this->taxonomy );
    46         $this->assertSame( 2, count( $tt_2 ) );
     46        $this->assertCount( 2, $tt_2 );
    4747        $this->assertFalse( wp_cache_get( $post_id, $this->taxonomy . '_relationships' ) );
    4848    }
  • trunk/tests/phpunit/tests/term/meta.php

    r51331 r51367  
    456456        $meta         = has_term_meta( $t );
    457457
    458         $this->assertSame( 1, count( $meta ) );
     458        $this->assertCount( 1, $meta );
    459459
    460460        $expected = array(
  • trunk/tests/phpunit/tests/term/query.php

    r48939 r51367  
    289289        );
    290290
    291         $this->assertSame( 1, count( $query->terms ) );
     291        $this->assertCount( 1, $query->terms );
    292292        $this->assertSame( $t, reset( $query->terms )->term_id );
    293293    }
     
    313313        );
    314314
    315         $this->assertSame( 2, count( $query->terms ) );
     315        $this->assertCount( 2, $query->terms );
    316316        foreach ( $query->terms as $term ) {
    317317            $this->assertSame( $t, $term->term_id );
  • trunk/tests/phpunit/tests/term/taxQuery.php

    r48937 r51367  
    112112        );
    113113
    114         $this->assertSame( 1, count( $q->queries ) );
     114        $this->assertCount( 1, $q->queries );
    115115    }
    116116
  • trunk/tests/phpunit/tests/term/wpGetObjectTerms.php

    r51331 r51367  
    2121        // Set the initial terms.
    2222        $tt_1 = wp_set_object_terms( $post_id, $terms_1, $this->taxonomy );
    23         $this->assertSame( 3, count( $tt_1 ) );
     23        $this->assertCount( 3, $tt_1 );
    2424
    2525        // Make sure they're correct.
  • trunk/tests/phpunit/tests/term/wpSetObjectTerms.php

    r51331 r51367  
    114114            $tt = wp_set_object_terms( $id, array_values( $term_id ), $this->taxonomy );
    115115            // Should return three term taxonomy IDs.
    116             $this->assertSame( 3, count( $tt ) );
     116            $this->assertCount( 3, $tt );
    117117        }
    118118
     
    142142            $tt = wp_set_object_terms( $id, $terms, $this->taxonomy );
    143143            // Should return three term taxonomy IDs.
    144             $this->assertSame( 3, count( $tt ) );
     144            $this->assertCount( 3, $tt );
    145145            // Remember which term has which term_id.
    146146            for ( $i = 0; $i < 3; $i++ ) {
     
    269269        // Set the initial terms.
    270270        $tt_1 = wp_set_object_terms( $post_id, $terms_1, $this->taxonomy );
    271         $this->assertSame( 3, count( $tt_1 ) );
     271        $this->assertCount( 3, $tt_1 );
    272272
    273273        // Make sure they're correct.
     
    284284        // Change the terms.
    285285        $tt_2 = wp_set_object_terms( $post_id, $terms_2, $this->taxonomy );
    286         $this->assertSame( 2, count( $tt_2 ) );
     286        $this->assertCount( 2, $tt_2 );
    287287
    288288        // Make sure they're correct.
     
    313313        // Set the initial terms.
    314314        $tt_1 = wp_set_object_terms( $post_id, $terms_1, $this->taxonomy );
    315         $this->assertSame( 3, count( $tt_1 ) );
     315        $this->assertCount( 3, $tt_1 );
    316316
    317317        // Make sure they're correct.
     
    328328        // Change the terms.
    329329        $tt_2 = wp_set_object_terms( $post_id, $terms_2, $this->taxonomy );
    330         $this->assertSame( 2, count( $tt_2 ) );
     330        $this->assertCount( 2, $tt_2 );
    331331
    332332        // Make sure they're correct.
  • trunk/tests/phpunit/tests/theme/wpThemeGetAllowedFilters.php

    r50968 r51367  
    2222            remove_filter( 'network_allowed_themes', array( $this, 'filter_network_allowed_themes' ) );
    2323
    24             $this->assertSame( 2, count( $this->filter_network_allowed_themes_args ) );
     24            $this->assertCount( 2, $this->filter_network_allowed_themes_args );
    2525            $this->assertSame( $blog_id, $this->filter_network_allowed_themes_args[1] );
    2626        }
  • trunk/tests/phpunit/tests/user.php

    r51335 r51367  
    768768        $response = wpmu_validate_user_signup( $user_data['user_login'], $user_data['user_email'] );
    769769        $this->assertInstanceOf( 'WP_Error', $response['errors'] );
    770         $this->assertSame( 0, count( $response['errors']->get_error_codes() ) );
     770        $this->assertCount( 0, $response['errors']->get_error_codes() );
    771771    }
    772772
     
    17291729
    17301730        // Number of exported users.
    1731         $this->assertSame( 1, count( $actual['data'] ) );
     1731        $this->assertCount( 1, $actual['data'] );
    17321732
    17331733        // Number of exported user properties.
    1734         $this->assertSame( 11, count( $actual['data'][0]['data'] ) );
     1734        $this->assertCount( 11, $actual['data'][0]['data'] );
    17351735    }
    17361736
     
    18631863
    18641864        // Number of exported users.
    1865         $this->assertSame( 1, count( $actual['data'] ) );
     1865        $this->assertCount( 1, $actual['data'] );
    18661866
    18671867        // Number of exported user properties (the 11 core properties,
    18681868        // plus 1 additional from the filter).
    1869         $this->assertSame( 12, count( $actual['data'][0]['data'] ) );
     1869        $this->assertCount( 12, $actual['data'][0]['data'] );
    18701870
    18711871        // Check that the item added by the filter was retained.
     
    18951895
    18961896        // Number of exported users.
    1897         $this->assertSame( 1, count( $actual['data'] ) );
     1897        $this->assertCount( 1, $actual['data'] );
    18981898
    18991899        // Number of exported user properties
    19001900        // (the 11 core properties, plus 1 additional from the filter).
    1901         $this->assertSame( 12, count( $actual['data'][0]['data'] ) );
     1901        $this->assertCount( 12, $actual['data'][0]['data'] );
    19021902
    19031903        // Check that the duplicate 'name' => 'User ID' was stripped.
  • trunk/tests/phpunit/tests/user/query.php

    r51196 r51367  
    138138
    139139        // +1 for the default user created during installation.
    140         $this->assertSame( 13, count( $users ) );
     140        $this->assertCount( 13, $users );
    141141        foreach ( $users as $user ) {
    142142            $this->assertInstanceOf( 'WP_User', $user );
     
    150150        );
    151151        $users = $users->get_results();
    152         $this->assertSame( 13, count( $users ) );
     152        $this->assertCount( 13, $users );
    153153        foreach ( $users as $user ) {
    154154            $this->assertInstanceOf( 'WP_User', $user );
     
    503503        $users = new WP_User_Query( array( 'blog_id' => get_current_blog_id() ) );
    504504        $users = $users->get_results();
    505         $this->assertSame( 13, count( $users ) );
     505        $this->assertCount( 13, $users );
    506506
    507507        $users = new WP_User_Query(
     
    512512        );
    513513        $users = $users->get_results();
    514         $this->assertSame( 10, count( $users ) );
     514        $this->assertCount( 10, $users );
    515515
    516516        $users = new WP_User_Query(
     
    521521        );
    522522        $users = $users->get_results();
    523         $this->assertSame( 2, count( $users ) );
     523        $this->assertCount( 2, $users );
    524524
    525525        $users = new WP_User_Query(
     
    530530        );
    531531        $users = $users->get_results();
    532         $this->assertSame( 13, count( $users ) );
     532        $this->assertCount( 13, $users );
    533533    }
    534534
     
    13151315        $users          = $wp_user_search->get_results();
    13161316
    1317         $this->assertSame( 2, count( $users ) );
     1317        $this->assertCount( 2, $users );
    13181318    }
    13191319
     
    13241324        $wp_user_search = new WP_User_Query( array( 'role__in' => array( 'subscriber', 'editor' ) ) );
    13251325        $users          = $wp_user_search->get_results();
    1326         $this->assertSame( 5, count( $users ) );
     1326        $this->assertCount( 5, $users );
    13271327    }
    13281328
     
    13371337        );
    13381338
    1339         $this->assertSame( 2, count( $users ) );
     1339        $this->assertCount( 2, $users );
    13401340    }
    13411341
     
    13731373        );
    13741374
    1375         $this->assertSame( 2, count( $users ) );
     1375        $this->assertCount( 2, $users );
    13761376    }
    13771377
     
    13931393        $users = $users->get_results();
    13941394
    1395         $this->assertSame( 2, count( $users ) );
     1395        $this->assertCount( 2, $users );
    13961396
    13971397        foreach ( $users as $user ) {
     
    14081408
    14091409        // +1 for the default user created during installation.
    1410         $this->assertSame( 8, count( $users ) );
     1410        $this->assertCount( 8, $users );
    14111411        foreach ( $users as $user ) {
    14121412            $this->assertInstanceOf( 'WP_User', $user );
     
    14371437        );
    14381438
    1439         $this->assertSame( 2, count( $users ) );
     1439        $this->assertCount( 2, $users );
    14401440    }
    14411441
     
    14831483
    14841484        // Check results.
    1485         $this->assertSame( 1, count( $users ) );
     1485        $this->assertCount( 1, $users );
    14861486        $this->assertSame( self::$editor_ids[0], (int) $users[0]->ID );
    14871487    }
     
    14981498
    14991499        // +1 for the default user created during installation.
    1500         $this->assertSame( 11, count( $users ) );
     1500        $this->assertCount( 11, $users );
    15011501
    15021502        $users = get_users(
     
    15071507
    15081508        // +1 for the default user created during installation.
    1509         $this->assertSame( 10, count( $users ) );
     1509        $this->assertCount( 10, $users );
    15101510    }
    15111511
     
    15251525        );
    15261526
    1527         $this->assertSame( 5, count( $users ) );
     1527        $this->assertCount( 5, $users );
    15281528
    15291529        $users = get_users(
     
    15341534        );
    15351535
    1536         $this->assertSame( 3, count( $users ) );
     1536        $this->assertCount( 3, $users );
    15371537    }
    15381538
     
    15511551        );
    15521552
    1553         $this->assertSame( 1, count( $users ) );
     1553        $this->assertCount( 1, $users );
    15541554    }
    15551555
     
    15691569
    15701570        // +1 for the default user created during installation.
    1571         $this->assertSame( 12, count( $users ) );
     1571        $this->assertCount( 12, $users );
    15721572
    15731573        $users = get_users(
     
    15781578
    15791579        // +1 for the default user created during installation.
    1580         $this->assertSame( 10, count( $users ) );
     1580        $this->assertCount( 10, $users );
    15811581    }
    15821582
  • trunk/tests/phpunit/tests/widgets.php

    r51331 r51367  
    157157        }
    158158
    159         $this->assertSame( $num, count( $result ) );
     159        $this->assertCount( $num, $result );
    160160
    161161    }
  • trunk/tests/phpunit/tests/wp.php

    r45607 r51367  
    2222        $this->wp->add_query_var( 'test' );
    2323
    24         $this->assertSame( $public_qv_count + 2, count( $this->wp->public_query_vars ) );
     24        $this->assertCount( $public_qv_count + 2, $this->wp->public_query_vars );
    2525        $this->assertTrue( in_array( 'test', $this->wp->public_query_vars, true ) );
    2626        $this->assertTrue( in_array( 'test2', $this->wp->public_query_vars, true ) );
     
    3434        $this->wp->remove_query_var( 'test' );
    3535
    36         $this->assertSame( $public_qv_count, count( $this->wp->public_query_vars ) );
     36        $this->assertCount( $public_qv_count, $this->wp->public_query_vars );
    3737    }
    3838}
  • trunk/tests/phpunit/tests/xmlrpc/mt/getRecentPostTitles.php

    r48937 r51367  
    2727        $result = $this->myxmlrpcserver->mt_getRecentPostTitles( array( 1, 'author', 'author' ) );
    2828        $this->assertNotIXRError( $result );
    29         $this->assertSame( 0, count( $result ) );
     29        $this->assertCount( 0, $result );
    3030    }
    3131
  • trunk/tests/phpunit/tests/xmlrpc/mw/getRecentPosts.php

    r51331 r51367  
    4545        $result = $this->myxmlrpcserver->mw_getRecentPosts( array( 1, 'author', 'author' ) );
    4646        $this->assertNotIXRError( $result );
    47         $this->assertSame( 0, count( $result ) );
     47        $this->assertCount( 0, $result );
    4848    }
    4949
  • trunk/tests/phpunit/tests/xmlrpc/wp/editPost.php

    r51331 r51367  
    443443
    444444        // Verify that there is only a single value in the array and that a duplicate is not present.
    445         $this->assertSame( 1, count( get_post_meta( $post_id, 'enclosure' ) ) );
     445        $this->assertCount( 1, get_post_meta( $post_id, 'enclosure' ) );
    446446
    447447        // For good measure, check that the expected value is in the array.
     
    452452
    453453        // Having added the new enclosure, 2 values are expected in the array.
    454         $this->assertSame( 2, count( get_post_meta( $post_id, 'enclosure' ) ) );
     454        $this->assertCount( 2, get_post_meta( $post_id, 'enclosure' ) );
    455455
    456456        // Check that the new enclosure is in the enclosure meta.
  • trunk/tests/phpunit/tests/xmlrpc/wp/getPost.php

    r51331 r51367  
    8686
    8787        // When no fields are requested, only the IDs should be returned.
    88         $this->assertSame( 1, count( $result ) );
     88        $this->assertCount( 1, $result );
    8989        $this->assertSame( array( 'post_id' ), array_keys( $result ) );
    9090    }
  • trunk/tests/phpunit/tests/xmlrpc/wp/getPostTypes.php

    r51331 r51367  
    1717        $this->assertNotIXRError( $result );
    1818        $this->assertIsArray( $result );
    19         $this->assertSame( 0, count( $result ) );
     19        $this->assertCount( 0, $result );
    2020    }
    2121
  • 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
  • trunk/tests/phpunit/tests/xmlrpc/wp/getTerms.php

    r51331 r51367  
    7878        $this->assertNotIXRError( $results );
    7979
    80         $this->assertSame( $num_terms, count( $results ) );
     80        $this->assertCount( $num_terms, $results );
    8181        foreach ( $results as $term ) {
    8282            $this->assertSame( $tax_name, $term['taxonomy'] );
     
    8787        $results2 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) );
    8888        $this->assertNotIXRError( $results );
    89         $this->assertSame( 5, count( $results2 ) );
     89        $this->assertCount( 5, $results2 );
    9090        $this->assertSame( $results[1]['term_id'], $results2[1]['term_id'] ); // Check one of the terms.
    9191
     
    9393        $results3         = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) );
    9494        $this->assertNotIXRError( $results3 );
    95         $this->assertSame( $num_terms - 10, count( $results3 ) );
     95        $this->assertCount( $num_terms - 10, $results3 );
    9696        $this->assertSame( $results[11]['term_id'], $results3[1]['term_id'] );
    9797
     
    100100        $results4 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) );
    101101        $this->assertNotIXRError( $results4 );
    102         $this->assertSame( 0, count( $results4 ) );
     102        $this->assertCount( 0, $results4 );
    103103
    104104        unset( $GLOBALS['wp_taxonomies'][ $tax_name ] );
     
    120120        $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) );
    121121        $this->assertNotIXRError( $results );
    122         $this->assertNotEquals( 0, count( $results ) );
     122        $this->assertNotCount( 0, $results );
    123123
    124124        foreach ( $results as $term ) {
     
    141141        $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) );
    142142        $this->assertNotIXRError( $results );
    143         $this->assertSame( 1, count( $results ) );
     143        $this->assertCount( 1, $results );
    144144        $this->assertSame( $name, $results[0]['name'] );
    145145        $this->assertEquals( $name_id, $results[0]['term_id'] );
     
    149149        $results2 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) );
    150150        $this->assertNotIXRError( $results2 );
    151         $this->assertSame( 1, count( $results2 ) );
     151        $this->assertCount( 1, $results2 );
    152152        $this->assertSame( $name, $results2[0]['name'] );
    153153        $this->assertEquals( $name_id, $results2[0]['term_id'] );
  • trunk/tests/phpunit/tests/xmlrpc/wp/getUsers.php

    r51331 r51367  
    103103
    104104        // Verify that $user_ids matches $users_found.
    105         $this->assertSame( 0, count( array_diff( $user_ids, $users_found ) ) );
     105        $this->assertCount( 0, array_diff( $user_ids, $users_found ) );
    106106    }
    107107
Note: See TracChangeset for help on using the changeset viewer.