Tests: Correct an assertion in wp_rand() tests.

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

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

See #55194.

git-svn-id: https://develop.svn.wordpress.org/trunk@53479 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2022-06-08 13:17:27 +00:00
parent 89cc0f5d95
commit fc121d69e9

View File

@ -7,19 +7,19 @@
class Tests_Pluggable_wpRand extends WP_UnitTestCase {
/**
* Tests that wp_rand() returns a positive integer for both positive and negative input.
* Tests that wp_rand() returns a non-negative integer for both positive and negative input.
*
* @ticket 55194
* @dataProvider data_wp_rand_should_return_a_positive_integer
* @dataProvider data_wp_rand_should_return_a_non_negative_integer
*
* @param int $min Lower limit for the generated number.
* @param int $max Upper limit for the generated number.
*/
public function test_wp_rand_should_return_a_positive_integer( $min, $max ) {
$this->assertGreaterThan(
public function test_wp_rand_should_return_a_non_negative_integer( $min, $max ) {
$this->assertGreaterThanOrEqual(
0,
wp_rand( $min, $max ),
'The value was not greater than 0'
'The value was not greater than or equal 0'
);
$this->assertLessThan(
@ -34,7 +34,7 @@ class Tests_Pluggable_wpRand extends WP_UnitTestCase {
*
* @return array
*/
public function data_wp_rand_should_return_a_positive_integer() {
public function data_wp_rand_should_return_a_non_negative_integer() {
return array(
'1 and 99' => array(
'min' => 1,