Make WordPress Core


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

Add unit tests to confirm that --- is properly converted to — by wptexturize() where appropriate.

Props miqrogroove.
Fixes #28483.

File:
1 edited

Legend:

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

    r28762 r28763  
    11791179                        ),
    11801180                        array(
    1181                                 '[[code]...[/code]...', // These are potentially usable shortcodes.  Unfortunately, the meaning of [[/code] is ambiguous unless we run the entire shortcode regexp.
    1182                                 '[[code]…[/code]...', // Same behavior as 3.9 due to buggy logic in _wptexturize_pushpop_element().  See ticket #28483.
     1181                                '[[code]...[/code]...', // These are potentially usable shortcodes.  Unfortunately, the meaning of [[code] is ambiguous unless we run the entire shortcode regexp.
     1182                                '[[code]…[/code]…',
    11831183                        ),
    11841184                        array(
    … …  
    15861586                );
    15871587        }
     1588
     1589        /**
     1590         * Extra sanity checks for _wptexturize_pushpop_element()
     1591         *
     1592         * @ticket 28483
     1593         * @dataProvider data_quotes_and_dashes
     1594         */
     1595        function test_element_stack( $input, $output ) {
     1596                return $this->assertEquals( $output, wptexturize( $input ) );
     1597        }
     1598
     1599        function data_element_stack() {
     1600                return array(
     1601                        array(
     1602                                '<span>hello</code>---</span>',
     1603                                '<span>hello</code>&#8212;</span>',
     1604                        ),
     1605                        array(
     1606                                '</code>hello<span>---</span>',
     1607                                '</code>hello<span>&#8212;</span>',
     1608                        ),
     1609                        array(
     1610                                '<code>hello</code>---</span>',
     1611                                '<code>hello</code>&#8212;</span>',
     1612                        ),
     1613                        array(
     1614                                '<span>hello</span>---<code>',
     1615                                '<span>hello</span>&#8212;<code>',
     1616                        ),
     1617                        array(
     1618                                '<span>hello<code>---</span>',
     1619                                '<span>hello<code>---</span>',
     1620                        ),
     1621                        array(
     1622                                '<code>hello<span>---</span>',
     1623                                '<code>hello<span>---</span>',
     1624                        ),
     1625                        array(
     1626                                '<code>hello</span>---</span>',
     1627                                '<code>hello</span>---</span>',
     1628                        ),
     1629                        array(
     1630                                '<span>hello[/code]---</span>',
     1631                                '<span>hello[/code]&#8212;</span>',
     1632                        ),
     1633                        array(
     1634                                '[/code]hello<span>---</span>',
     1635                                '[/code]hello<span>&#8212;</span>',
     1636                        ),
     1637                        array(
     1638                                '[code]hello[/code]---</span>',
     1639                                '[code]hello[/code]&#8212;</span>',
     1640                        ),
     1641                        array(
     1642                                '<span>hello</span>---[code]',
     1643                                '<span>hello</span>&#8212;[code]',
     1644                        ),
     1645                        array(
     1646                                '<span>hello[code]---</span>',
     1647                                '<span>hello[code]---</span>',
     1648                        ),
     1649                        array(
     1650                                '[code]hello<span>---</span>',
     1651                                '[code]hello<span>---</span>',
     1652                        ),
     1653                        array(
     1654                                '[code]hello</span>---</span>',
     1655                                '[code]hello</span>---</span>',
     1656                        ),
     1657                );
     1658        }
    15881659}
Note: See TracChangeset for help on using the changeset viewer.