WordPress.org

Make WordPress Core

Ticket #22692: miqro-22692-tests.diff

File miqro-22692-tests.diff, 1.2 KB (added by miqrogroove, 7 years ago)
  • tests/formatting/WPTexturize.php

     
    194194                $this->assertEquals( ' — ', wptexturize( ' -- ' ) );
    195195                $this->assertEquals( ' — ', wptexturize( ' -- ') );
    196196        }
     197
     198        /**
     199         * @ticket 22692
     200         */
     201        function test_spaces_around_quotes() {
     202                $nbsp = "\xC2\xA0";
     203
     204                // This should never happen, even if the desired output changes some day.
     205
     206                $problem_input = "$nbsp\"A";
     207                $problem_output = "$nbsp”A";
     208
     209                $this->assertNotEquals( $problem_output, wptexturize( $problem_input ) );
     210
     211                // These are desirable outputs for the current design.
     212
     213                $input1 = "A sentence. $nbsp\"A quote after 2 spaces.\"";
     214                $input2 = "A sentence.$nbsp$nbsp\"A quote after 2 spaces.\"";
     215
     216                $output1 = "A sentence. $nbsp“A quote after 2 spaces.”";
     217                $output2 = "A sentence.$nbsp$nbsp“A quote after 2 spaces.”";
     218
     219                $this->assertEquals( $output1, wptexturize( $input1 ) );
     220                $this->assertEquals( $output2, wptexturize( $input2 ) );
     221        }
    197222}