Make WordPress Core


Ignore:
Timestamp:
07/07/2021 10:32:56 AM (4 years ago)
Author:
SergeyBiryukov
Message:

Tests: Use more appropriate assertions in various tests.

This replaces instances of assertSame( [number], count( ... ) ) with assertCount() to use native PHPUnit functionality.

Follow-up to [51335], [51337].

See #53363.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/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();
Note: See TracChangeset for help on using the changeset viewer.