Make WordPress Core

Changeset 53479


Ignore:
Timestamp:
06/08/2022 01:17:27 PM (23 months ago)
Author:
SergeyBiryukov
Message:

Tests: Correct an assertion in wp_rand() tests.

The function returns non-negative integers, which includes zero.

Follow-up to [53473], [53477].

See #55194.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/pluggable/wpRand.php

    r53478 r53479  
    88
    99    /**
    10      * Tests that wp_rand() returns a positive integer for both positive and negative input.
     10     * Tests that wp_rand() returns a non-negative integer for both positive and negative input.
    1111     *
    1212     * @ticket 55194
    13      * @dataProvider data_wp_rand_should_return_a_positive_integer
     13     * @dataProvider data_wp_rand_should_return_a_non_negative_integer
    1414     *
    1515     * @param int $min Lower limit for the generated number.
    1616     * @param int $max Upper limit for the generated number.
    1717     */
    18     public function test_wp_rand_should_return_a_positive_integer( $min, $max ) {
    19         $this->assertGreaterThan(
     18    public function test_wp_rand_should_return_a_non_negative_integer( $min, $max ) {
     19        $this->assertGreaterThanOrEqual(
    2020            0,
    2121            wp_rand( $min, $max ),
    22             'The value was not greater than 0'
     22            'The value was not greater than or equal 0'
    2323        );
    2424
     
    3535     * @return array
    3636     */
    37     public function data_wp_rand_should_return_a_positive_integer() {
     37    public function data_wp_rand_should_return_a_non_negative_integer() {
    3838        return array(
    3939            '1 and 99'       => array(
Note: See TracChangeset for help on using the changeset viewer.