Make WordPress Core

Changeset 53477


Ignore:
Timestamp:
06/07/2022 12:01:09 PM (23 months ago)
Author:
SergeyBiryukov
Message:

Tests: Use more descriptive names for wp_rand() test methods.

This aims to clarify the intention of the tests.

Follow-up to [53473].

Props mlajo, costdev, acoulombe, azouamauriac, swissspidy, tobifjellner, peterwilsoncc, audrasjb, marekdedic, SergeyBiryukov.
See #55194.

File:
1 edited

Legend:

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

    r53473 r53477  
    357357
    358358    /**
    359      * Tests that wp_rand() returns zero.
     359     * Tests that wp_rand() returns zero when `$min` and `$max` are zero.
    360360     *
    361361     * @ticket 55194
    362      * @dataProvider data_wp_rand_should_return_zero
     362     * @dataProvider data_wp_rand_should_return_zero_when_min_and_max_are_zero
    363363     * @covers ::wp_rand
    364364     *
     
    366366     * @param mixed $max Upper limit for the generated number.
    367367     */
    368     public function test_wp_rand_should_return_zero( $min, $max ) {
     368    public function test_wp_rand_should_return_zero_when_min_and_max_are_zero( $min, $max ) {
    369369        $this->assertSame( 0, wp_rand( $min, $max ) );
    370370    }
     
    375375     * @return array
    376376     */
    377     public function data_wp_rand_should_return_zero() {
     377    public function data_wp_rand_should_return_zero_when_min_and_max_are_zero() {
    378378        return array(
    379379            'min and max as 0'      => array(
     
    393393
    394394    /**
    395      * Tests that wp_rand() returns a value between 1 and 99.
     395     * Tests that wp_rand() returns a positive integer for both positive and negative input.
    396396     *
    397397     * @ticket 55194
    398      * @dataProvider data_wp_rand_should_return_between_1_and_99
     398     * @dataProvider data_wp_rand_should_return_a_positive_integer
    399399     * @covers ::wp_rand
    400400     *
     
    402402     * @param int $max Upper limit for the generated number.
    403403     */
    404     public function test_wp_rand_should_return_between_1_and_99( $min, $max ) {
     404    public function test_wp_rand_should_return_a_positive_integer( $min, $max ) {
    405405        $this->assertGreaterThan(
    406406            0,
     
    421421     * @return array
    422422     */
    423     public function data_wp_rand_should_return_between_1_and_99() {
     423    public function data_wp_rand_should_return_a_positive_integer() {
    424424        return array(
    425425            '1 and 99'       => array(
Note: See TracChangeset for help on using the changeset viewer.