Make WordPress Core

Ticket #55194: 55194.3.diff

File 55194.3.diff, 1.4 KB (added by SergeyBiryukov, 23 months ago)
  • tests/phpunit/tests/pluggable/wpRand.php

     
    77class Tests_Pluggable_wpRand extends WP_UnitTestCase {
    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
    2525                $this->assertLessThan(
     
    3434         *
    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(
    4040                                'min' => 1,