Changeset 33359 for trunk/tests/phpunit/tests/shortcode.php
- Timestamp:
- 07/22/2015 05:14:50 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/shortcode.php
r33118 r33359 405 405 406 406 /** 407 * Check for bugginess using normal input with latest patches. 408 * 409 * @dataProvider data_escaping 410 */ 411 function test_escaping( $input, $output ) { 412 return $this->assertEquals( $output, do_shortcode( $input ) ); 413 } 414 415 function data_escaping() { 416 return array( 417 array( 418 '<!--[if lt IE 7]>', 419 '<!--[if lt IE 7]>', 420 ), 421 array( 422 '[gallery title="<div>hello</div>"]', 423 '', 424 ), 425 array( 426 '[caption caption="test" width="2"]<div>hello</div>[/caption]', 427 '<div style="width: 12px" class="wp-caption alignnone"><div>hello</div><p class="wp-caption-text">test</p></div>', 428 ), 429 array( 430 '<div [gallery]>', 431 '<div >', 432 ), 433 array( 434 '<div [[gallery]]>', 435 '<div [gallery]>', 436 ), 437 array( 438 '[gallery]<div>Hello</div>[/gallery]', 439 '', 440 ), 441 ); 442 } 443 444 /** 445 * Check for bugginess using normal input with latest patches. 446 * 447 * @dataProvider data_escaping2 448 */ 449 function test_escaping2( $input, $output ) { 450 return $this->assertEquals( $output, strip_shortcodes( $input ) ); 451 } 452 453 function data_escaping2() { 454 return array( 455 array( 456 '<!--[if lt IE 7]>', 457 '<!--[if lt IE 7]>', 458 ), 459 array( 460 '[gallery title="<div>hello</div>"]', 461 '', 462 ), 463 array( 464 '[caption caption="test" width="2"]<div>hello</div>[/caption]', 465 '', 466 ), 467 array( 468 '<div [gallery]>', // Shortcodes will never be stripped inside elements. 469 '<div [gallery]>', 470 ), 471 array( 472 '<div [[gallery]]>', // Shortcodes will never be stripped inside elements. 473 '<div [[gallery]]>', 474 ), 475 array( 476 '[gallery]<div>Hello</div>[/gallery]', 477 '', 478 ), 479 ); 480 } 481 482 /** 407 483 * @ticket 26343 408 484 */
Note: See TracChangeset
for help on using the changeset viewer.