From fc121d69e9b255ab34ea378f595f25edfc0c91d3 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 8 Jun 2022 13:17:27 +0000 Subject: [PATCH] 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 --- tests/phpunit/tests/pluggable/wpRand.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/phpunit/tests/pluggable/wpRand.php b/tests/phpunit/tests/pluggable/wpRand.php index f3092ca41b..e7ef3b2725 100644 --- a/tests/phpunit/tests/pluggable/wpRand.php +++ b/tests/phpunit/tests/pluggable/wpRand.php @@ -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,