Make WordPress Core


Ignore:
Timestamp:
02/19/2022 12:40:48 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Tests: Correct the order of expected and actual values in wp_validate_boolean() tests.

This corrects the order of the parameters when used in assertions so if/when they fail the failure message is correct.

Additionally, this commit moves the test function before the data provider, for consistency with other tests.

Follow-up to [46159], [46224].

See #54725.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/functions/wpValidateBoolean.php

    r52010 r52775  
    88 */
    99class Tests_Functions_wpValidateBoolean extends WP_UnitTestCase {
     10
     11    /**
     12     * Test wp_validate_boolean().
     13     *
     14     * @dataProvider data_provider
     15     *
     16     * @param mixed $test_value
     17     * @param bool $expected
     18     *
     19     * @ticket 30238
     20     * @ticket 39868
     21     */
     22    public function test_wp_validate_boolean( $test_value, $expected ) {
     23        $this->assertSame( $expected, wp_validate_boolean( $test_value ) );
     24    }
     25
    1026    /**
    1127     * Provides test scenarios for all possible scenarios in wp_validate_boolean().
     
    4258            );
    4359    }
    44 
    45     /**
    46      * Test wp_validate_boolean().
    47      *
    48      * @dataProvider data_provider
    49      *
    50      * @param mixed $test_value
    51      * @param bool $expected
    52      *
    53      * @ticket 30238
    54      * @ticket 39868
    55      */
    56     public function test_wp_validate_boolean( $test_value, $expected ) {
    57         $this->assertSame( wp_validate_boolean( $test_value ), $expected );
    58     }
    5960}
Note: See TracChangeset for help on using the changeset viewer.