Changeset 33360 for branches/4.2/tests/phpunit/tests/shortcode.php
- Timestamp:
- 07/22/2015 05:43:35 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.2/tests/phpunit/tests/shortcode.php
r31622 r33360 387 387 388 388 /** 389 * Check for bugginess using normal input with latest patches. 390 * 391 * @dataProvider data_escaping 392 */ 393 function test_escaping( $input, $output ) { 394 return $this->assertEquals( $output, do_shortcode( $input ) ); 395 } 396 397 function data_escaping() { 398 return array( 399 array( 400 '<!--[if lt IE 7]>', 401 '<!--[if lt IE 7]>', 402 ), 403 array( 404 '[gallery title="<div>hello</div>"]', 405 '', 406 ), 407 array( 408 '[caption caption="test" width="2"]<div>hello</div>[/caption]', 409 '<div style="width: 12px" class="wp-caption alignnone"><div>hello</div><p class="wp-caption-text">test</p></div>', 410 ), 411 array( 412 '<div [gallery]>', 413 '<div >', 414 ), 415 array( 416 '<div [[gallery]]>', 417 '<div [gallery]>', 418 ), 419 array( 420 '[gallery]<div>Hello</div>[/gallery]', 421 '', 422 ), 423 ); 424 } 425 426 /** 427 * Check for bugginess using normal input with latest patches. 428 * 429 * @dataProvider data_escaping2 430 */ 431 function test_escaping2( $input, $output ) { 432 return $this->assertEquals( $output, strip_shortcodes( $input ) ); 433 } 434 435 function data_escaping2() { 436 return array( 437 array( 438 '<!--[if lt IE 7]>', 439 '<!--[if lt IE 7]>', 440 ), 441 array( 442 '[gallery title="<div>hello</div>"]', 443 '', 444 ), 445 array( 446 '[caption caption="test" width="2"]<div>hello</div>[/caption]', 447 '', 448 ), 449 array( 450 '<div [gallery]>', // Shortcodes will never be stripped inside elements. 451 '<div [gallery]>', 452 ), 453 array( 454 '<div [[gallery]]>', // Shortcodes will never be stripped inside elements. 455 '<div [[gallery]]>', 456 ), 457 array( 458 '[gallery]<div>Hello</div>[/gallery]', 459 '', 460 ), 461 ); 462 } 463 464 /** 389 465 * @ticket 26343 390 466 */
Note: See TracChangeset
for help on using the changeset viewer.