| 170 | * Data provider. |
| 171 | * |
| 172 | * Passes the expected field name and the value to test. |
| 173 | * |
| 174 | * @since 4.4.0 |
| 175 | * |
| 176 | * @return array { |
| 177 | * @type array { |
| 178 | * @type string $expected The expected field id to be returned. |
| 179 | * @type string $value_to_test The value being passed to the get_field_name method. |
| 180 | * } |
| 181 | * } |
| 182 | */ |
| 183 | function data_wp_widget_get_field_name( ) { |
| 184 | |
| 185 | return array( |
| 186 | array( |
| 187 | 'widget-foo[2][title]', |
| 188 | 'title', |
| 189 | ), |
| 190 | array( |
| 191 | 'widget-foo[2][posttypes][]', |
| 192 | 'posttypes[]', |
| 193 | ), |
| 194 | array( |
| 195 | 'widget-foo[2][posttypes][4]', |
| 196 | 'posttypes[4]', |
| 197 | ), |
| 198 | array( |
| 199 | 'widget-foo[2][posttypes][4][]', |
| 200 | 'posttypes[4][]', |
| 201 | ), |
| 202 | array( |
| 203 | 'widget-foo[2][posttypes][4][][6]', |
| 204 | 'posttypes[4][][6]', |
| 205 | ), |
| 206 | ); |
| 207 | } |
| 208 | |
| 209 | /** |
| 222 | * Data provider. |
| 223 | * |
| 224 | * Passes the expected field id and the value to be used in the tests. |
| 225 | * |
| 226 | * @since 4.4.0 |
| 227 | * |
| 228 | * @return array { |
| 229 | * @type array { |
| 230 | * @type string $expected The expected field id to be returned. |
| 231 | * @type string $value_to_test The value being passed to the get_field_id method. |
| 232 | * } |
| 233 | * } |
| 234 | */ |
| 235 | function data_wp_widget_get_field_id() { |
| 236 | return array( |
| 237 | array( |
| 238 | 'widget-foo-2-title', |
| 239 | 'title', |
| 240 | ), |
| 241 | array( |
| 242 | 'widget-foo-2-posttypes', |
| 243 | 'posttypes[]', |
| 244 | ), |
| 245 | array( |
| 246 | 'widget-foo-2-posttypes-4', |
| 247 | 'posttypes[4]', |
| 248 | ), |
| 249 | array( |
| 250 | 'widget-foo-2-posttypes-4', |
| 251 | 'posttypes[4][]', |
| 252 | ), |
| 253 | array( |
| 254 | 'widget-foo-2-posttypes-4-6', |
| 255 | 'posttypes[4][][6]', |
| 256 | ), |
| 257 | ); |
| 258 | } |
| 259 | |
| 260 | /** |