Make WordPress Core

Ticket #10082: ut_10082.diff

File ut_10082.diff, 1.1 KB (added by mdbitz, 11 years ago)

PHPUnit Test Cases for validition

  • shortcode.php

     
    373373                remove_filter( 'shortcode_atts_bartag', array( $this, '_filter_atts2' ), 10, 3 );
    374374        }
    375375
     376        /**
     377         * @ticket 10082
     378         *
     379         * Validate ShortCode Regex identifies tags without spacing
     380         *
     381         */
     382        function test_shortcodes_without_spacing_simple() {
     383               
     384                $test_content = '[footag foo="3X"][footag foo="7X"/]';
     385                $expected = 'foo = 3Xfoo = 7X';
     386       
     387                $this->assertEquals($expected, do_shortcode($test_content));
     388       
     389        }
     390       
     391        /**
     392         * @ticket 10082
     393         *
     394         * Validate ShortCode Regex correctly identifies complex content
     395         * that contains tags without spacing
     396         */
     397        function test_shortcodes_without_spacing_complex() {
     398               
     399                $test_content = '[bartag foo=1][baztag][footag foo="2"][/footag] [baztag/]
     400[baztag]AZTEXT[baztag][footag foo="2"][/baztag]';
     401
     402                $expected = 'foo = 1content = foo = 2 content =
     403content = AZTEXTcontent = foo = 2';
     404               
     405                $this->assertEquals($expected, do_shortcode($test_content));
     406        }
    376407}