| | 265 | /** |
| | 266 | * Test escaping of non-string values. |
| | 267 | * |
| | 268 | * @ticket 52458 |
| | 269 | * @dataProvider data_non_string_values |
| | 270 | * |
| | 271 | * @param mixed $value The value to be escaped. |
| | 272 | * @param mixed $expected The expected escaped value. |
| | 273 | */ |
| | 274 | function test_non_string_values( $value, $expected ) { |
| | 275 | $this->assertSame( $expected, esc_url( $value ) ); |
| | 276 | } |
| | 277 | |
| | 278 | /** |
| | 279 | * Data provider for `test_non_string_values()`. |
| | 280 | * |
| | 281 | * @return array { |
| | 282 | * @type mixed $value The value to be escaped. |
| | 283 | * @type mixed $expected The expected escaped value. |
| | 284 | * } |
| | 285 | */ |
| | 286 | function data_non_string_values() { |
| | 287 | return array( |
| | 288 | array( true, 'http://1' ), |
| | 289 | array( false, '' ), |
| | 290 | array( null, '' ), |
| | 291 | array( 0, 'http://0' ), |
| | 292 | array( 1, 'http://1' ), |
| | 293 | ); |
| | 294 | } |
| | 295 | |