WordPress.org

Make WordPress Core

Ticket #14050: t14050-shortcode-unautop-upgrade-tests.diff

File t14050-shortcode-unautop-upgrade-tests.diff, 2.1 KB (added by lkraav, 8 years ago)
  • tests/phpunit/tests/shortcode.php

     
    310310        /**
    311311         * @ticket 14050
    312312         */
     313        function test_shortcode_unautop_xhtml() {
     314                // a blank line is added at the end, so test with it already there
     315                $test_string = "[footag /]\n";
     316                $this->assertEquals( $test_string, shortcode_unautop( wpautop( $test_string ) ) );
     317        }
     318
     319        /**
     320         * @ticket 14050
     321         */
    313322        function test_multiple_shortcode_unautop() {
    314323                // a blank line is added at the end, so test with it already there
    315324                $test_string = "[footag]\n[footag]\n";
     
    318327        }
    319328
    320329        /**
     330         * @ticket 14050
     331         */
     332        function test_shortcode_unautop_multiline() {
     333                // test a sample html structure
     334                $test_string = <<<EOF
     335<h1>Fun, safe, small group tours &amp; no roughing it</h1>
     336[footag]
     337<p>Enjoy guided day walks in extraordinary natural areas. Return to comfortable accommodation and delicious meals each evening. No heavy backpack, no camping.</p>
     338[/footag]
     339
     340EOF;
     341                $actual = shortcode_unautop( wpautop( $test_string ) );
     342                $this->assertEquals( $test_string, $actual );
     343        }
     344
     345        /**
     346         * @ticket 14050
     347         */
     348        function test_shortcode_unautop_attributes() {
     349                // a blank line is added at the end, so test with it already there
     350                $test_string = "[footag id=\"2\" class=\"bar\"]\n";
     351                $actual = shortcode_unautop( wpautop( $test_string ) );
     352                $this->assertEquals( $test_string, $actual );
     353        }
     354
     355        /**
     356         * @ticket 14050
     357         */
     358        function test_shortcode_unautop_attributes_multiline() {
     359                // a blank line is added at the end, so test with it already there
     360                $test_string = <<<EOF
     361[footag id="2" class="bar"]
     362<p>Enjoy guided day walks in extraordinary natural areas. Return to comfortable accommodation and delicious meals each evening. No heavy backpack, no camping.</p>
     363[/footag]
     364
     365EOF;
     366                $actual = shortcode_unautop( wpautop( $test_string ) );
     367                $this->assertEquals( $test_string, $actual );
     368        }
     369
     370        /**
    321371         * @ticket 10326
    322372         */
    323373        function test_strip_shortcodes() {