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 | } |