mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Code Modernization: Rename parameters that use reserved keywords in phpunit/tests/functions/wpRefererField.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names. This commit renames the `$echo` parameter to `$display` in `Tests_Functions_wpRefererField::test_wp_referer_field_should_respect_display_arg()`. Follow-up to [54420], [54929]. Props jrf, aristath, poena, justinahinon, SergeyBiryukov. See #56788. git-svn-id: https://develop.svn.wordpress.org/trunk@55130 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -30,26 +30,26 @@ class Tests_Functions_wpRefererField extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that the echo argument is respected.
|
||||
* Tests that the display argument is respected.
|
||||
*
|
||||
* @ticket 54106
|
||||
*
|
||||
* @dataProvider data_wp_referer_field_should_respect_echo_arg
|
||||
* @dataProvider data_wp_referer_field_should_respect_display_arg
|
||||
*
|
||||
* @param mixed $echo Whether to echo or return the referer field.
|
||||
* @param mixed $display Whether to echo or return the referer field.
|
||||
*/
|
||||
public function test_wp_referer_field_should_respect_echo_arg( $echo ) {
|
||||
$actual = $echo ? get_echo( 'wp_referer_field' ) : wp_referer_field( false );
|
||||
public function test_wp_referer_field_should_respect_display_arg( $display ) {
|
||||
$actual = $display ? get_echo( 'wp_referer_field' ) : wp_referer_field( false );
|
||||
|
||||
$this->assertSame( '<input type="hidden" name="_wp_http_referer" value="" />', $actual );
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for test_wp_referer_field_should_respect_echo_arg().
|
||||
* Data provider for test_wp_referer_field_should_respect_display_arg().
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function data_wp_referer_field_should_respect_echo_arg() {
|
||||
public function data_wp_referer_field_should_respect_display_arg() {
|
||||
return array(
|
||||
'true' => array( true ),
|
||||
'(int) 1' => array( 1 ),
|
||||
|
||||
Reference in New Issue
Block a user