@@ -16,7 +16,7 @@ class Tests_Functions_wpParseIdList extends WP_UnitTestCase {
1616 * @dataProvider data_wp_parse_id_list
1717 * @dataProvider data_unexpected_input
1818 *
19- * @param mixed[]|string $input_list
19+ * @param mixed[]|string|int $input_list
2020 * @param array<non-negative-int> $expected
2121 */
2222 public function test_wp_parse_id_list ( $ input_list , array $ expected ): void {
@@ -37,7 +37,7 @@ public function test_wp_parse_id_list( $input_list, array $expected ): void {
3737 /**
3838 * Data provider.
3939 *
40- * @return array<string, array{ input_list: mixed[]|string, expected: array<non-negative-int> }>
40+ * @return array<string, array{ input_list: mixed[]|string|int , expected: array<non-negative-int> }>
4141 */
4242 public function data_wp_parse_id_list (): array {
4343 return array (
@@ -74,13 +74,25 @@ public function data_wp_parse_id_list(): array {
7474 'input_list ' => array ( -1 , 2 , '-3 ' , '4 ' ),
7575 'expected ' => array ( 1 , 2 , 3 , 4 ),
7676 ),
77+ 'positive int ' => array (
78+ 'input_list ' => 5 ,
79+ 'expected ' => array ( 5 ),
80+ ),
81+ 'negative int ' => array (
82+ 'input_list ' => -5 ,
83+ 'expected ' => array ( 5 ),
84+ ),
85+ 'zero ' => array (
86+ 'input_list ' => 0 ,
87+ 'expected ' => array ( 0 ),
88+ ),
7789 );
7890 }
7991
8092 /**
8193 * Data provider.
8294 *
83- * @return array<string, array{ input_list: mixed[]|string, expected: array<non-negative-int> }>
95+ * @return array<string, array{ input_list: mixed[]|string|int , expected: array<non-negative-int> }>
8496 */
8597 public function data_unexpected_input (): array {
8698 return array (
@@ -100,6 +112,10 @@ public function data_unexpected_input(): array {
100112 'input_list ' => array ( '1 2 string with spaces ' ),
101113 'expected ' => array ( 1 ),
102114 ),
115+ 'comma in array ' => array (
116+ 'input_list ' => array ( '1,2 ' ),
117+ 'expected ' => array ( 1 ),
118+ ),
103119 'string with html ' => array (
104120 'input_list ' => '1 2 string <strong>with</strong> <h1>HEADING</h1> ' ,
105121 'expected ' => array ( 1 , 2 , 0 ),
0 commit comments