Changeset 52010 for trunk/tests/phpunit/tests/shortcode.php
- Timestamp:
- 11/04/2021 03:22:47 PM (4 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/shortcode.php (modified) (57 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/shortcode.php
r51568 r52010 7 7 protected $shortcodes = array( 'test-shortcode-tag', 'footag', 'bartag', 'baztag', 'dumptag', 'hyphen', 'hyphen-foo', 'hyphen-foo-bar', 'url', 'img' ); 8 8 9 function set_up() {9 public function set_up() { 10 10 parent::set_up(); 11 11 12 12 foreach ( $this->shortcodes as $shortcode ) { 13 add_shortcode( $shortcode, array( $this, ' _shortcode_' . str_replace( '-', '_', $shortcode ) ) );13 add_shortcode( $shortcode, array( $this, 'shortcode_' . str_replace( '-', '_', $shortcode ) ) ); 14 14 } 15 15 … … 20 20 } 21 21 22 function tear_down() {22 public function tear_down() { 23 23 global $shortcode_tags; 24 24 foreach ( $this->shortcodes as $shortcode ) { … … 28 28 } 29 29 30 function _shortcode_test_shortcode_tag( $atts, $content = null, $tagname = null ) {30 public function shortcode_test_shortcode_tag( $atts, $content = null, $tagname = null ) { 31 31 $this->atts = $atts; 32 32 $this->content = $content; … … 38 38 39 39 // [footag foo="bar"] 40 function _shortcode_footag( $atts ) {40 public function shortcode_footag( $atts ) { 41 41 $foo = isset( $atts['foo'] ) ? $atts['foo'] : ''; 42 42 return "foo = $foo"; … … 44 44 45 45 // [bartag foo="bar"] 46 function _shortcode_bartag( $atts ) {46 public function shortcode_bartag( $atts ) { 47 47 $processed_atts = shortcode_atts( 48 48 array( … … 58 58 59 59 // [baztag]content[/baztag] 60 function _shortcode_baztag( $atts, $content = '' ) {60 public function shortcode_baztag( $atts, $content = '' ) { 61 61 return 'content = ' . do_shortcode( $content ); 62 62 } 63 63 64 function _shortcode_dumptag( $atts ) {64 public function shortcode_dumptag( $atts ) { 65 65 $out = ''; 66 66 foreach ( $atts as $k => $v ) { … … 70 70 } 71 71 72 function _shortcode_hyphen() {72 public function shortcode_hyphen() { 73 73 return __FUNCTION__; 74 74 } 75 75 76 function _shortcode_hyphen_foo() {76 public function shortcode_hyphen_foo() { 77 77 return __FUNCTION__; 78 78 } 79 79 80 function _shortcode_hyphen_foo_bar() {80 public function shortcode_hyphen_foo_bar() { 81 81 return __FUNCTION__; 82 82 } 83 83 84 function _shortcode_url() {84 public function shortcode_url() { 85 85 return 'http://www.wordpress.org/'; 86 86 } 87 87 88 function _shortcode_img( $atts ) {88 public function shortcode_img( $atts ) { 89 89 $out = '<img'; 90 90 foreach ( $atts as $k => $v ) { … … 96 96 } 97 97 98 function test_noatts() {98 public function test_noatts() { 99 99 do_shortcode( '[test-shortcode-tag /]' ); 100 100 $this->assertSame( '', $this->atts ); … … 102 102 } 103 103 104 function test_one_att() {104 public function test_one_att() { 105 105 do_shortcode( '[test-shortcode-tag foo="asdf" /]' ); 106 106 $this->assertSame( array( 'foo' => 'asdf' ), $this->atts ); … … 108 108 } 109 109 110 function test_not_a_tag() {110 public function test_not_a_tag() { 111 111 $out = do_shortcode( '[not-a-shortcode-tag]' ); 112 112 $this->assertSame( '[not-a-shortcode-tag]', $out ); … … 116 116 * @ticket 17657 117 117 */ 118 function test_tag_hyphen_not_tag() {118 public function test_tag_hyphen_not_tag() { 119 119 $out = do_shortcode( '[dumptag-notreal]' ); 120 120 $this->assertSame( '[dumptag-notreal]', $out ); 121 121 } 122 122 123 function test_tag_underscore_not_tag() {123 public function test_tag_underscore_not_tag() { 124 124 $out = do_shortcode( '[dumptag_notreal]' ); 125 125 $this->assertSame( '[dumptag_notreal]', $out ); 126 126 } 127 127 128 function test_tag_not_tag() {128 public function test_tag_not_tag() { 129 129 $out = do_shortcode( '[dumptagnotreal]' ); 130 130 $this->assertSame( '[dumptagnotreal]', $out ); … … 134 134 * @ticket 17657 135 135 */ 136 function test_tag_hyphen() {137 $this->assertSame( ' _shortcode_hyphen', do_shortcode( '[hyphen]' ) );138 $this->assertSame( ' _shortcode_hyphen_foo', do_shortcode( '[hyphen-foo]' ) );139 $this->assertSame( ' _shortcode_hyphen_foo_bar', do_shortcode( '[hyphen-foo-bar]' ) );136 public function test_tag_hyphen() { 137 $this->assertSame( 'shortcode_hyphen', do_shortcode( '[hyphen]' ) ); 138 $this->assertSame( 'shortcode_hyphen_foo', do_shortcode( '[hyphen-foo]' ) ); 139 $this->assertSame( 'shortcode_hyphen_foo_bar', do_shortcode( '[hyphen-foo-bar]' ) ); 140 140 $this->assertSame( '[hyphen-baz]', do_shortcode( '[hyphen-baz]' ) ); 141 141 $this->assertSame( '[hyphen-foo-bar-baz]', do_shortcode( '[hyphen-foo-bar-baz]' ) ); … … 145 145 * @ticket 9405 146 146 */ 147 function test_attr_hyphen() {147 public function test_attr_hyphen() { 148 148 do_shortcode( '[test-shortcode-tag foo="foo" foo-bar="foo-bar" foo-bar-="foo-bar-" -foo-bar="-foo-bar" -foo-bar-="-foo-bar-" foo-bar-baz="foo-bar-baz" -foo-bar-baz="-foo-bar-baz" foo--bar="foo--bar" /]' ); 149 149 $expected_attrs = array( … … 160 160 } 161 161 162 function test_two_atts() {162 public function test_two_atts() { 163 163 do_shortcode( '[test-shortcode-tag foo="asdf" bar="bing" /]' ); 164 164 $this->assertSame( … … 172 172 } 173 173 174 function test_noatts_enclosing() {174 public function test_noatts_enclosing() { 175 175 do_shortcode( '[test-shortcode-tag]content[/test-shortcode-tag]' ); 176 176 $this->assertSame( '', $this->atts ); … … 179 179 } 180 180 181 function test_one_att_enclosing() {181 public function test_one_att_enclosing() { 182 182 do_shortcode( '[test-shortcode-tag foo="bar"]content[/test-shortcode-tag]' ); 183 183 $this->assertSame( array( 'foo' => 'bar' ), $this->atts ); … … 186 186 } 187 187 188 function test_two_atts_enclosing() {188 public function test_two_atts_enclosing() { 189 189 do_shortcode( '[test-shortcode-tag foo="bar" baz="bing"]content[/test-shortcode-tag]' ); 190 190 $this->assertSame( … … 199 199 } 200 200 201 function test_unclosed() {201 public function test_unclosed() { 202 202 $out = do_shortcode( '[test-shortcode-tag]' ); 203 203 $this->assertSame( '', $out ); … … 206 206 } 207 207 208 function test_positional_atts_num() {208 public function test_positional_atts_num() { 209 209 $out = do_shortcode( '[test-shortcode-tag 123]' ); 210 210 $this->assertSame( '', $out ); … … 213 213 } 214 214 215 function test_positional_atts_url() {215 public function test_positional_atts_url() { 216 216 $out = do_shortcode( '[test-shortcode-tag https://www.youtube.com/watch?v=72xdCU__XCk]' ); 217 217 $this->assertSame( '', $out ); … … 220 220 } 221 221 222 function test_positional_atts_quotes() {222 public function test_positional_atts_quotes() { 223 223 $out = do_shortcode( '[test-shortcode-tag "something in quotes" "something else"]' ); 224 224 $this->assertSame( '', $out ); … … 233 233 } 234 234 235 function test_positional_atts_mixed() {235 public function test_positional_atts_mixed() { 236 236 $out = do_shortcode( '[test-shortcode-tag 123 https://wordpress.org/ 0 "foo" bar]' ); 237 237 $this->assertSame( '', $out ); … … 249 249 } 250 250 251 function test_positional_and_named_atts() {251 public function test_positional_and_named_atts() { 252 252 $out = do_shortcode( '[test-shortcode-tag 123 url=https://wordpress.org/ foo bar="baz"]' ); 253 253 $this->assertSame( '', $out ); … … 264 264 } 265 265 266 function test_footag_default() {266 public function test_footag_default() { 267 267 $out = do_shortcode( '[footag]' ); 268 268 $this->assertSame( 'foo = ', $out ); 269 269 } 270 270 271 function test_footag_val() {271 public function test_footag_val() { 272 272 $val = rand_str(); 273 273 $out = do_shortcode( '[footag foo="' . $val . '"]' ); … … 275 275 } 276 276 277 function test_nested_tags() {277 public function test_nested_tags() { 278 278 $out = do_shortcode( '[baztag][dumptag abc="foo" def=123 https://wordpress.org/][/baztag]' ); 279 279 $expected = "content = abc = foo\ndef = 123\n0 = https://wordpress.org\n"; … … 284 284 * @ticket 6518 285 285 */ 286 function test_tag_escaped() {286 public function test_tag_escaped() { 287 287 $out = do_shortcode( '[[footag]] [[bartag foo="bar"]]' ); 288 288 $this->assertSame( '[footag] [bartag foo="bar"]', $out ); … … 299 299 } 300 300 301 function test_tag_not_escaped() {301 public function test_tag_not_escaped() { 302 302 // These have square brackets on either end but aren't actually escaped. 303 303 $out = do_shortcode( '[[footag] [bartag foo="bar"]]' ); … … 317 317 } 318 318 319 function test_mixed_tags() {319 public function test_mixed_tags() { 320 320 $in = <<<EOF 321 321 So this is a post with [footag foo="some stuff"] and a bunch of tags. … … 357 357 * @ticket 6562 358 358 */ 359 function test_utf8_whitespace_1() {359 public function test_utf8_whitespace_1() { 360 360 // NO-BREAK SPACE: U+00A0. 361 361 do_shortcode( "[test-shortcode-tag foo=\"bar\" \xC2\xA0baz=\"123\"]" ); … … 373 373 * @ticket 6562 374 374 */ 375 function test_utf8_whitespace_2() {375 public function test_utf8_whitespace_2() { 376 376 // ZERO WIDTH SPACE: U+200B. 377 377 do_shortcode( "[test-shortcode-tag foo=\"bar\" \xE2\x80\x8Babc=\"def\"]" ); … … 389 389 * @ticket 14050 390 390 */ 391 function test_shortcode_unautop() {391 public function test_shortcode_unautop() { 392 392 // A blank line is added at the end, so test with it already there. 393 393 $test_string = "[footag]\n"; … … 395 395 } 396 396 397 function data_test_strip_shortcodes() {397 public function data_test_strip_shortcodes() { 398 398 return array( 399 399 array( 'before', 'before[gallery]' ), … … 418 418 * @param string $content Content to run strip_shortcodes() on. 419 419 */ 420 function test_strip_shortcodes( $expected, $content ) {420 public function test_strip_shortcodes( $expected, $content ) { 421 421 $this->assertSame( $expected, strip_shortcodes( $content ) ); 422 422 } … … 425 425 * @ticket 37767 426 426 */ 427 function test_strip_shortcodes_filter() {428 add_filter( 'strip_shortcodes_tagnames', array( $this, ' _filter_strip_shortcodes_tagnames' ) );427 public function test_strip_shortcodes_filter() { 428 add_filter( 'strip_shortcodes_tagnames', array( $this, 'filter_strip_shortcodes_tagnames' ) ); 429 429 $this->assertSame( 'beforemiddle [footag]after', strip_shortcodes( 'before[gallery]middle [footag]after' ) ); 430 remove_filter( 'strip_shortcodes_tagnames', array( $this, ' _filter_strip_shortcodes_tagnames' ) );431 } 432 433 function _filter_strip_shortcodes_tagnames() {430 remove_filter( 'strip_shortcodes_tagnames', array( $this, 'filter_strip_shortcodes_tagnames' ) ); 431 } 432 433 public function filter_strip_shortcodes_tagnames() { 434 434 return array( 'gallery' ); 435 435 } 436 436 437 437 // Store passed in shortcode_atts_{$shortcode} args. 438 function _filter_atts( $out, $pairs, $atts ) {438 public function filter_atts( $out, $pairs, $atts ) { 439 439 $this->filter_atts_out = $out; 440 440 $this->filter_atts_pairs = $pairs; … … 444 444 445 445 // Filter shortcode atts in various ways. 446 function _filter_atts2( $out, $pairs, $atts ) {446 public function filter_atts2( $out, $pairs, $atts ) { 447 447 // If foo attribute equals "foo1", change it to be default value. 448 448 if ( isset( $out['foo'] ) && 'foo1' === $out['foo'] ) { … … 459 459 } 460 460 461 function test_shortcode_atts_filter_passes_original_arguments() {462 add_filter( 'shortcode_atts_bartag', array( $this, ' _filter_atts' ), 10, 3 );461 public function test_shortcode_atts_filter_passes_original_arguments() { 462 add_filter( 'shortcode_atts_bartag', array( $this, 'filter_atts' ), 10, 3 ); 463 463 464 464 do_shortcode( '[bartag foo="foo1" /]' ); … … 479 479 $this->assertSame( array( 'foo' => 'foo1' ), $this->filter_atts_atts ); 480 480 481 remove_filter( 'shortcode_atts_bartag', array( $this, ' _filter_atts' ), 10, 3 );482 } 483 484 function test_shortcode_atts_filtering() {485 add_filter( 'shortcode_atts_bartag', array( $this, ' _filter_atts2' ), 10, 3 );481 remove_filter( 'shortcode_atts_bartag', array( $this, 'filter_atts' ), 10, 3 ); 482 } 483 484 public function test_shortcode_atts_filtering() { 485 add_filter( 'shortcode_atts_bartag', array( $this, 'filter_atts2' ), 10, 3 ); 486 486 487 487 $out = do_shortcode( '[bartag foo="foo1" baz="baz1" /]' ); … … 492 492 $this->assertSame( 'foo = foo2', $out ); 493 493 494 remove_filter( 'shortcode_atts_bartag', array( $this, ' _filter_atts2' ), 10, 3 );494 remove_filter( 'shortcode_atts_bartag', array( $this, 'filter_atts2' ), 10, 3 ); 495 495 } 496 496 … … 500 500 * @ticket 22692 501 501 */ 502 function test_spaces_around_shortcodes() {502 public function test_spaces_around_shortcodes() { 503 503 $nbsp = "\xC2\xA0"; 504 504 … … 522 522 * @dataProvider data_escaping 523 523 */ 524 function test_escaping( $input, $output ) {524 public function test_escaping( $input, $output ) { 525 525 return $this->assertSame( $output, do_shortcode( $input ) ); 526 526 } 527 527 528 function data_escaping() {528 public function data_escaping() { 529 529 return array( 530 530 array( … … 600 600 * @dataProvider data_escaping2 601 601 */ 602 function test_escaping2( $input, $output ) {602 public function test_escaping2( $input, $output ) { 603 603 return $this->assertSame( $output, strip_shortcodes( $input ) ); 604 604 } 605 605 606 function data_escaping2() {606 public function data_escaping2() { 607 607 return array( 608 608 array( … … 640 640 * @ticket 26343 641 641 */ 642 function test_has_shortcode() {642 public function test_has_shortcode() { 643 643 $content = 'This is a blob with [gallery] in it'; 644 644 $this->assertTrue( has_shortcode( $content, 'gallery' ) ); … … 656 656 * @expectedIncorrectUsage add_shortcode 657 657 */ 658 function test_registration_bad( $input, $expected ) {659 return$this->sub_registration( $input, $expected );658 public function test_registration_bad( $input, $expected ) { 659 $this->sub_registration( $input, $expected ); 660 660 } 661 661 … … 665 665 * @dataProvider data_registration_good 666 666 */ 667 function test_registration_good( $input, $expected ) {668 return$this->sub_registration( $input, $expected );669 } 670 671 function sub_registration( $input, $expected ) {667 public function test_registration_good( $input, $expected ) { 668 $this->sub_registration( $input, $expected ); 669 } 670 671 private function sub_registration( $input, $expected ) { 672 672 add_shortcode( $input, '' ); 673 673 $actual = shortcode_exists( $input ); 674 $t est = $this->assertSame( $expected, $actual );674 $this->assertSame( $expected, $actual ); 675 675 if ( $actual ) { 676 676 remove_shortcode( $input ); 677 677 } 678 return $test; 679 } 680 681 function data_registration_bad() { 678 } 679 680 public function data_registration_bad() { 682 681 return array( 683 682 array( … … 712 711 } 713 712 714 function data_registration_good() {713 public function data_registration_good() { 715 714 return array( 716 715 array( … … 734 733 * @dataProvider data_whole_posts 735 734 */ 736 function test_pcre_performance( $input ) {735 public function test_pcre_performance( $input ) { 737 736 $regex = '/' . get_shortcode_regex() . '/'; 738 737 $result = benchmark_pcre_backtracking( $regex, $input, 'match_all' ); … … 740 739 } 741 740 742 function data_whole_posts() {741 public function data_whole_posts() { 743 742 require_once DIR_TESTDATA . '/formatting/whole-posts.php'; 744 743 return data_whole_posts(); … … 751 750 * @ticket 51734 752 751 */ 753 function test_php_and_js_shortcode_attribute_regexes_match() {752 public function test_php_and_js_shortcode_attribute_regexes_match() { 754 753 // This test uses the source file by default but will use the built file if it exists. 755 754 // This allows the test to run using either the src or build directory. … … 781 780 * Test the (not recommended) [shortcode=XXX] format 782 781 */ 783 function test_unnamed_attribute() {782 public function test_unnamed_attribute() { 784 783 $out = do_shortcode( '[dumptag=https://wordpress.org/]' ); 785 784 $expected = "0 = =https://wordpress.org\n"; … … 790 789 * @ticket 36306 791 790 */ 792 function test_smilies_arent_converted() {791 public function test_smilies_arent_converted() { 793 792 $out = apply_filters( 'the_content', '[img alt="Hello :-) World"]' ); 794 793 $expected = "<img alt=\"Hello :-) World\" />\n"; … … 802 801 // Does nothing if no filters are set up. 803 802 $str = 'pre_do_shortcode_tag'; 804 add_shortcode( $str, array( $this, ' _shortcode_pre_do_shortcode_tag' ) );803 add_shortcode( $str, array( $this, 'shortcode_pre_do_shortcode_tag' ) ); 805 804 $result_nofilter = do_shortcode( "[{$str}]" ); 806 805 $this->assertSame( 'foo', $result_nofilter ); 807 806 808 807 // Short-circuit with filter. 809 add_filter( 'pre_do_shortcode_tag', array( $this, ' _filter_pre_do_shortcode_tag_bar' ) );808 add_filter( 'pre_do_shortcode_tag', array( $this, 'filter_pre_do_shortcode_tag_bar' ) ); 810 809 $result_filter = do_shortcode( "[{$str}]" ); 811 810 $this->assertSame( 'bar', $result_filter ); 812 811 813 812 // Respect priority. 814 add_filter( 'pre_do_shortcode_tag', array( $this, ' _filter_pre_do_shortcode_tag_p11' ), 11 );813 add_filter( 'pre_do_shortcode_tag', array( $this, 'filter_pre_do_shortcode_tag_p11' ), 11 ); 815 814 $result_priority = do_shortcode( "[{$str}]" ); 816 815 $this->assertSame( 'p11', $result_priority ); … … 834 833 ), 835 834 ); 836 add_filter( 'pre_do_shortcode_tag', array( $this, ' _filter_pre_do_shortcode_tag_attr' ), 12, 4 );835 add_filter( 'pre_do_shortcode_tag', array( $this, 'filter_pre_do_shortcode_tag_attr' ), 12, 4 ); 837 836 $result_atts = do_shortcode( "[{$str} a='b' c='d']" ); 838 837 $this->assertSame( wp_json_encode( $arr ), $result_atts ); 839 838 840 remove_filter( 'pre_do_shortcode_tag', array( $this, ' _filter_pre_do_shortcode_tag_attr' ), 12, 4 );841 remove_filter( 'pre_do_shortcode_tag', array( $this, ' _filter_pre_do_shortcode_tag_p11' ), 11 );842 remove_filter( 'pre_do_shortcode_tag', array( $this, ' _filter_pre_do_shortcode_tag_bar' ) );839 remove_filter( 'pre_do_shortcode_tag', array( $this, 'filter_pre_do_shortcode_tag_attr' ), 12, 4 ); 840 remove_filter( 'pre_do_shortcode_tag', array( $this, 'filter_pre_do_shortcode_tag_p11' ), 11 ); 841 remove_filter( 'pre_do_shortcode_tag', array( $this, 'filter_pre_do_shortcode_tag_bar' ) ); 843 842 remove_shortcode( $str ); 844 843 } 845 844 846 public function _shortcode_pre_do_shortcode_tag( $atts = array(), $content = '' ) {845 public function shortcode_pre_do_shortcode_tag( $atts = array(), $content = '' ) { 847 846 return 'foo'; 848 847 } 849 848 850 public function _filter_pre_do_shortcode_tag_bar() {849 public function filter_pre_do_shortcode_tag_bar() { 851 850 return 'bar'; 852 851 } 853 852 854 public function _filter_pre_do_shortcode_tag_p11() {853 public function filter_pre_do_shortcode_tag_p11() { 855 854 return 'p11'; 856 855 } 857 856 858 public function _filter_pre_do_shortcode_tag_attr( $return, $key, $atts, $m ) {857 public function filter_pre_do_shortcode_tag_attr( $return, $key, $atts, $m ) { 859 858 $arr = array( 860 859 'return' => $return, … … 872 871 // Does nothing if no filters are set up. 873 872 $str = 'do_shortcode_tag'; 874 add_shortcode( $str, array( $this, ' _shortcode_do_shortcode_tag' ) );873 add_shortcode( $str, array( $this, 'shortcode_do_shortcode_tag' ) ); 875 874 $result_nofilter = do_shortcode( "[{$str}]" ); 876 875 $this->assertSame( 'foo', $result_nofilter ); 877 876 878 877 // Modify output with filter. 879 add_filter( 'do_shortcode_tag', array( $this, ' _filter_do_shortcode_tag_replace' ) );878 add_filter( 'do_shortcode_tag', array( $this, 'filter_do_shortcode_tag_replace' ) ); 880 879 $result_filter = do_shortcode( "[{$str}]" ); 881 880 $this->assertSame( 'fee', $result_filter ); 882 881 883 882 // Respect priority. 884 add_filter( 'do_shortcode_tag', array( $this, ' _filter_do_shortcode_tag_generate' ), 11 );883 add_filter( 'do_shortcode_tag', array( $this, 'filter_do_shortcode_tag_generate' ), 11 ); 885 884 $result_priority = do_shortcode( "[{$str}]" ); 886 885 $this->assertSame( 'foobar', $result_priority ); … … 904 903 ), 905 904 ); 906 add_filter( 'do_shortcode_tag', array( $this, ' _filter_do_shortcode_tag_attr' ), 12, 4 );905 add_filter( 'do_shortcode_tag', array( $this, 'filter_do_shortcode_tag_attr' ), 12, 4 ); 907 906 $result_atts = do_shortcode( "[{$str} a='b' c='d']" ); 908 907 $this->assertSame( wp_json_encode( $arr ), $result_atts ); 909 908 910 remove_filter( 'do_shortcode_tag', array( $this, ' _filter_do_shortcode_tag_attr' ), 12 );911 remove_filter( 'do_shortcode_tag', array( $this, ' _filter_do_shortcode_tag_generate' ), 11 );912 remove_filter( 'do_shortcode_tag', array( $this, ' _filter_do_shortcode_tag_replace' ) );909 remove_filter( 'do_shortcode_tag', array( $this, 'filter_do_shortcode_tag_attr' ), 12 ); 910 remove_filter( 'do_shortcode_tag', array( $this, 'filter_do_shortcode_tag_generate' ), 11 ); 911 remove_filter( 'do_shortcode_tag', array( $this, 'filter_do_shortcode_tag_replace' ) ); 913 912 remove_shortcode( $str ); 914 913 } 915 914 916 public function _shortcode_do_shortcode_tag( $atts = array(), $content = '' ) {915 public function shortcode_do_shortcode_tag( $atts = array(), $content = '' ) { 917 916 return 'foo'; 918 917 } 919 918 920 public function _filter_do_shortcode_tag_replace( $return ) {919 public function filter_do_shortcode_tag_replace( $return ) { 921 920 return str_replace( 'oo', 'ee', $return ); 922 921 } 923 922 924 public function _filter_do_shortcode_tag_generate( $return ) {923 public function filter_do_shortcode_tag_generate( $return ) { 925 924 return 'foobar'; 926 925 } 927 926 928 public function _filter_do_shortcode_tag_attr( $return, $key, $atts, $m ) {927 public function filter_do_shortcode_tag_attr( $return, $key, $atts, $m ) { 929 928 $arr = array( 930 929 'return' => $return, … … 941 940 * Test 'value' syntax for empty attributes 942 941 */ 943 function test_empty_single_quote_attribute() {942 public function test_empty_single_quote_attribute() { 944 943 $out = do_shortcode( '[test-shortcode-tag a="foo" b=\'bar\' c=baz foo \'bar\' "baz" ]test empty atts[/test-shortcode-tag]' ); 945 944 $this->assertSame( … … 959 958 * @ticket 37304 960 959 */ 961 function test_positional_atts_single_quotes() {960 public function test_positional_atts_single_quotes() { 962 961 $out = do_shortcode( "[test-shortcode-tag 'something in quotes' 'something else']" ); 963 962 $this->assertSame( '', $out ); … … 975 974 * @ticket 37304 976 975 */ 977 function test_positional_atts_mixed_quotes() {976 public function test_positional_atts_mixed_quotes() { 978 977 $out = do_shortcode( "[test-shortcode-tag 'something in quotes' \"something else\" 123 foo bar='baz' example=\"test\" ]" ); 979 978 $this->assertSame( '', $out );
Note: See TracChangeset
for help on using the changeset viewer.