Changeset 55047
- Timestamp:
- 01/10/2023 01:59:00 PM (22 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-locale.php
r54867 r55047 20 20 * 21 21 * @since 2.1.0 22 * @var string[] 23 */ 24 public $weekday; 22 * @since 6.2.0 Initialized to an empty array. 23 * @var string[] 24 */ 25 public $weekday = array(); 25 26 26 27 /** … … 33 34 * 34 35 * @since 2.1.0 35 * @var string[] 36 */ 37 public $weekday_initial; 36 * @since 6.2.0 Initialized to an empty array. 37 * @var string[] 38 */ 39 public $weekday_initial = array(); 38 40 39 41 /** … … 41 43 * 42 44 * @since 2.1.0 43 * @var string[] 44 */ 45 public $weekday_abbrev; 45 * @since 6.2.0 Initialized to an empty array. 46 * @var string[] 47 */ 48 public $weekday_abbrev = array(); 46 49 47 50 /** … … 49 52 * 50 53 * @since 2.1.0 51 * @var string[] 52 */ 53 public $month; 54 * @since 6.2.0 Initialized to an empty array. 55 * @var string[] 56 */ 57 public $month = array(); 54 58 55 59 /** … … 57 61 * 58 62 * @since 4.4.0 59 * @var string[] 60 */ 61 public $month_genitive; 63 * @since 6.2.0 Initialized to an empty array. 64 * @var string[] 65 */ 66 public $month_genitive = array(); 62 67 63 68 /** … … 65 70 * 66 71 * @since 2.1.0 67 * @var string[] 68 */ 69 public $month_abbrev; 72 * @since 6.2.0 Initialized to an empty array. 73 * @var string[] 74 */ 75 public $month_abbrev = array(); 70 76 71 77 /** … … 75 81 * 76 82 * @since 2.1.0 77 * @var string[] 78 */ 79 public $meridiem; 83 * @since 6.2.0 Initialized to an empty array. 84 * @var string[] 85 */ 86 public $meridiem = array(); 80 87 81 88 /** … … 93 100 * 94 101 * @since 2.3.0 102 * @since 6.2.0 Initialized to an empty array. 95 103 * @var array 96 104 */ 97 public $number_format ;105 public $number_format = array(); 98 106 99 107 /** -
trunk/tests/phpunit/tests/locale.php
r53866 r55047 14 14 parent::set_up(); 15 15 $this->locale = new WP_Locale(); 16 } 17 18 /** 19 * @ticket 57427 20 * 21 * @dataProvider data_property_initializes_to_array 22 * 23 * @param string $name Property name to test. 24 */ 25 public function test_property_initializes_to_array( $name ) { 26 $this->assertIsArray( $this->locale->$name, "WP_Locale::{$name} property should be an array" ); 27 28 // Test a custom implementation when `init()` is not invoked in the constructor. 29 $wp_locale = new Custom_WP_Locale(); 30 $this->assertIsArray( $wp_locale->$name, "Custom_WP_Locale::{$name} property should be an array" ); 31 } 32 33 /** 34 * Data provider. 35 * 36 * @return array 37 */ 38 public function data_property_initializes_to_array() { 39 return array( 40 'weekday' => array( 'weekday' ), 41 'weekday_initial' => array( 'weekday_initial' ), 42 'weekday_abbrev' => array( 'weekday_abbrev' ), 43 'month' => array( 'month' ), 44 'month_genitive' => array( 'month_genitive' ), 45 'month_abbrev' => array( 'month_abbrev' ), 46 'meridiem' => array( 'meridiem' ), 47 'number_format' => array( 'number_format' ), 48 ); 16 49 } 17 50 … … 142 175 } 143 176 } 177 178 class Custom_WP_Locale extends WP_Locale { 179 public function __construct() { 180 // Do not initialize to test property initialization. 181 // $this->init(); 182 $this->register_globals(); 183 } 184 }
Note: See TracChangeset
for help on using the changeset viewer.