Make WordPress Core


Ignore:
Timestamp:
07/12/2021 10:35:44 AM (2 years ago)
Author:
SergeyBiryukov
Message:

Tests: Use more appropriate assertions in various tests.

This replaces instances of assertTrue( in_array( ... ) ) with assertContains() to use native PHPUnit functionality.

Follow-up to [51335], [51337], [51367], [51397], [51403].

Props hellofromTonya, jrf, SergeyBiryukov.
Fixes #53123. See #53363.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/user.php

    r51397 r51404  
    11141114        );
    11151115
    1116         $this->assertTrue( in_array( (string) self::$contrib_id, $users, true ) );
     1116        $this->assertContains( (string) self::$contrib_id, $users );
    11171117    }
    11181118
     
    11251125        );
    11261126
    1127         $this->assertTrue( in_array( (string) self::$contrib_id, $users, true ) );
     1127        $this->assertContains( (string) self::$contrib_id, $users );
    11281128    }
    11291129
     
    11361136        );
    11371137
    1138         $this->assertTrue( in_array( (string) self::$contrib_id, $users, true ) );
     1138        $this->assertContains( (string) self::$contrib_id, $users );
    11391139    }
    11401140
     
    11471147        );
    11481148
    1149         $this->assertTrue( in_array( (string) self::$contrib_id, $users, true ) );
     1149        $this->assertContains( (string) self::$contrib_id, $users );
    11501150    }
    11511151
     
    11581158        );
    11591159
    1160         $this->assertTrue( in_array( (string) self::$contrib_id, $users, true ) );
     1160        $this->assertContains( (string) self::$contrib_id, $users );
    11611161    }
    11621162
Note: See TracChangeset for help on using the changeset viewer.