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.

git-svn-id: https://develop.svn.wordpress.org/trunk@52775 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2022-02-19 12:40:48 +00:00
parent 407325eb1a
commit d0f8d4ff70

View File

@ -7,6 +7,22 @@
* @covers ::wp_validate_boolean
*/
class Tests_Functions_wpValidateBoolean extends WP_UnitTestCase {
/**
* Test wp_validate_boolean().
*
* @dataProvider data_provider
*
* @param mixed $test_value
* @param bool $expected
*
* @ticket 30238
* @ticket 39868
*/
public function test_wp_validate_boolean( $test_value, $expected ) {
$this->assertSame( $expected, wp_validate_boolean( $test_value ) );
}
/**
* Provides test scenarios for all possible scenarios in wp_validate_boolean().
*
@ -41,19 +57,4 @@ class Tests_Functions_wpValidateBoolean extends WP_UnitTestCase {
array( $std, true ),
);
}
/**
* Test wp_validate_boolean().
*
* @dataProvider data_provider
*
* @param mixed $test_value
* @param bool $expected
*
* @ticket 30238
* @ticket 39868
*/
public function test_wp_validate_boolean( $test_value, $expected ) {
$this->assertSame( wp_validate_boolean( $test_value ), $expected );
}
}