WordPress.org

Make WordPress Core

Ticket #29882: 29882_test.diff

File 29882_test.diff, 2.6 KB (added by gitlost, 4 years ago)

Refresh/expansion of @iseulde test patch for 4.4.

  • tests/phpunit/tests/formatting/WPTexturize.php

     
    471471                        ),
    472472                        array(
    473473                                "word\"' word word",
    474                                 "word”‘ word word", // Closing quote, then opening quote
     474                                "word”’ word word", // Incompatibility: was closing quote, then opening quote - now: two closing quotes.
    475475                        ),
    476476                );
    477477        }
     
    18241824         */
    18251825        function test_unregistered_shortcodes( $input, $output ) {
    18261826                add_filter( 'no_texturize_shortcodes', array( $this, 'filter_shortcodes' ), 10, 1 );
    1827        
     1827
    18281828                $output = $this->assertEquals( $output, wptexturize( $input ) );
    1829        
     1829
    18301830                remove_filter( 'no_texturize_shortcodes', array( $this, 'filter_shortcodes' ), 10, 1 );
    18311831                return $output;
    18321832        }
    1833        
     1833
    18341834        function filter_shortcodes( $disabled ) {
    18351835                $disabled[] = 'audio';
    18361836                return $disabled;
     
    20482048                        ),
    20492049                );
    20502050        }
    2051 }
    2052  No newline at end of file
     2051
     2052        /**
     2053         * Test nested quotations.
     2054         *
     2055         * @ticket 29882
     2056         * @dataProvider test_nested_quotations_data
     2057         */
     2058        function test_nested_quotations( $input, $output ) {
     2059                return $this->assertEquals( $output, wptexturize( $input ) );
     2060        }
     2061
     2062        function test_nested_quotations_data() {
     2063                $so = '‘';
     2064                $sc = $apos = '’';
     2065                $do = '“';
     2066                $dc = '”';
     2067
     2068                return array(
     2069                        array( "She said, \"'I'm tired,' he mumbled.\"", "She said, {$do}{$so}I{$apos}m tired,{$sc} he mumbled.{$dc}" ),
     2070                        array( "She said, \"He mumbled, 'I'm tired.'\"", "She said, {$do}He mumbled, {$so}I{$apos}m tired.{$sc}{$dc}" ),
     2071                        array( "He said, '\"I'm tired,\" she mumbled.'", "He said, {$so}{$do}I{$apos}m tired,{$dc} she mumbled.{$sc}" ),
     2072                        array( "He said, 'She mumbled, \"I'm tired.\"'", "He said, {$so}She mumbled, {$do}I{$apos}m tired.{$dc}{$sc}" ),
     2073
     2074                        array( "She said, \"'I'm tired', he mumbled\".", "She said, {$do}{$so}I{$apos}m tired{$sc}, he mumbled{$dc}." ), // Punctuation outside quotes.
     2075                        array( "She said, \"He mumbled, 'I'm tired'\".", "She said, {$do}He mumbled, {$so}I{$apos}m tired{$sc}{$dc}." ),
     2076                        array( "He said, '\"I'm tired\", she mumbled'.", "He said, {$so}{$do}I{$apos}m tired{$dc}, she mumbled{$sc}." ),
     2077                        array( "He said, 'She mumbled, \"I'm tired\"'.", "He said, {$so}She mumbled, {$do}I{$apos}m tired{$dc}{$sc}." ),
     2078
     2079                        array( "She said, \"'99', he mumbled.\"", "She said, {$do}{$so}99{$sc}, he mumbled.{$dc}" ),
     2080                        array( "He said, '\"99\", she mumbled.'", "He said, {$so}{$do}99{$dc}, she mumbled.{$sc}" ),
     2081                );
     2082        }
     2083}