Changeset 38877 for trunk/tests/phpunit/tests/shortcode.php
- Timestamp:
- 10/23/2016 02:24:26 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/shortcode.php
r38713 r38877 341 341 } 342 342 343 function data_test_strip_shortcodes() { 344 return array( 345 array( 'before', 'before[gallery]' ), 346 array( 'after', '[gallery]after' ), 347 array( 'beforeafter', 'before[gallery]after' ), 348 array( 'before[after', 'before[after' ), 349 array( 'beforeafter', 'beforeafter' ), 350 array( 'beforeafter', 'before[gallery id="123" size="medium"]after' ), 351 array( 'before[unregistered_shortcode]after', 'before[unregistered_shortcode]after' ), 352 array( 'beforeafter', 'before[footag]after' ), 353 array( 'before after', 'before [footag]content[/footag] after' ), 354 array( 'before after', 'before [footag foo="123"]content[/footag] after' ), 355 ); 356 } 357 343 358 /** 344 359 * @ticket 10326 345 */ 346 function test_strip_shortcodes() { 347 $this->assertEquals('before', strip_shortcodes('before[gallery]')); 348 $this->assertEquals('after', strip_shortcodes('[gallery]after')); 349 $this->assertEquals('beforeafter', strip_shortcodes('before[gallery]after')); 350 } 351 360 * 361 * @dataProvider data_test_strip_shortcodes 362 * 363 * @param string $expected Expected output. 364 * @param string $content Content to run strip_shortcodes() on. 365 */ 366 function test_strip_shortcodes( $expected, $content ) { 367 $this->assertEquals( $expected, strip_shortcodes( $content ) ); 368 } 369 370 /** 371 * @ticket 37767 372 */ 373 function test_strip_shortcodes_filter() { 374 add_filter( 'strip_shortcodes_tagnames', array( $this, '_filter_strip_shortcodes_tagnames' ) ); 375 $this->assertEquals( 'beforemiddle [footag]after', strip_shortcodes( 'before[gallery]middle [footag]after' ) ); 376 remove_filter( 'strip_shortcodes_tagnames', array( $this, '_filter_strip_shortcodes_tagnames' ) ); 377 } 378 379 function _filter_strip_shortcodes_tagnames() { 380 return array( 'gallery' ); 381 } 352 382 353 383 // Store passed in shortcode_atts_{$shortcode} args
Note: See TracChangeset
for help on using the changeset viewer.