Make WordPress Core


Ignore:
Timestamp:
06/17/2014 05:40:07 PM (12 years ago)
Author:
wonderboymusic
Message:

wptexturize() adjustments:

  • Only place an apostrophe before a number when it has exactly two digits.
  • Never match '99' with the single prime pattern.
  • Always assume '99' is an abbreviated year at the end of a quotation.
  • Add unit tests.
  • Resolves the unit test broken in [28721] for #8775.

See #26850.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/formatting/WPTexturize.php

    r28727 r28761  
    12801280                );
    12811281        }
     1282
     1283        /**
     1284         * Year abbreviations consist of exactly two digits.
     1285         *
     1286         * @ticket 26850
     1287         * @dataProvider data_quotes_and_dashes
     1288         */
     1289        function test_year_abbr( $input, $output ) {
     1290                return $this->assertEquals( $output, wptexturize( $input ) );
     1291        }
     1292
     1293        function data_year_abbr() {
     1294                return array(
     1295                        array(
     1296                                "word '99 word",
     1297                                "word ’99 word",
     1298                        ),
     1299                        array(
     1300                                "word '99. word",
     1301                                "word ’99. word",
     1302                        ),
     1303                        array(
     1304                                "word '99, word",
     1305                                "word ’99, word",
     1306                        ),
     1307                        array(
     1308                                "word '99; word",
     1309                                "word ’99; word",
     1310                        ),
     1311                        array(
     1312                                "word '99' word", // For this pattern, prime doesn't make sense.  Should get apos and a closing quote.
     1313                                "word ’99’ word",
     1314                        ),
     1315                        array(
     1316                                "word '99'. word",
     1317                                "word ’99’. word",
     1318                        ),
     1319                        array(
     1320                                "word '99', word",
     1321                                "word ’99’, word",
     1322                        ),
     1323                        array(
     1324                                "word '99.' word",
     1325                                "word ’99.’ word",
     1326                        ),
     1327                        array(
     1328                                "word '99",
     1329                                "word ’99",
     1330                        ),
     1331                        array(
     1332                                "'99 word",
     1333                                "’99 word",
     1334                        ),
     1335                        array(
     1336                                "word '999 word", // Does not match the apos pattern, should be opening quote.
     1337                                "word ‘999 word",
     1338                        ),
     1339                        array(
     1340                                "word '9 word",
     1341                                "word ‘9 word",
     1342                        ),
     1343                        array(
     1344                                "word '99.9 word",
     1345                                "word ‘99.9 word",
     1346                        ),
     1347                        array(
     1348                                "word '999",
     1349                                "word ‘999",
     1350                        ),
     1351                        array(
     1352                                "word '9",
     1353                                "word ‘9",
     1354                        ),
     1355                        array(
     1356                                "in '4 years, 3 months,' Obama cut the deficit",
     1357                                "in ‘4 years, 3 months,’ Obama cut the deficit",
     1358                        ),
     1359                        array(
     1360                                "testing's '4' through 'quotes'",
     1361                                "testing’s ‘4’ through ‘quotes’",
     1362                        ),
     1363                );
     1364        }
    12821365}
Note: See TracChangeset for help on using the changeset viewer.