WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/02/2020 12:35:36 AM (17 months ago)
Author:
SergeyBiryukov
Message:

Tests: First pass at using assertSame() instead of assertEquals() in most of the unit tests.

This ensures that not only the return values match the expected results, but also that their type is the same.

Going forward, stricter type checking by using assertSame() should generally be preferred to assertEquals() where appropriate, to make the tests more reliable.

Props johnbillion, jrf, SergeyBiryukov.
See #38266.

File:
1 edited

Legend:

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

    r47198 r48937  
    66class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
    77    function test_dashes() {
    8         $this->assertEquals( 'Hey — boo?', wptexturize( 'Hey -- boo?' ) );
    9         $this->assertEquals( '<a href="http://xx--xx">Hey &#8212; boo?</a>', wptexturize( '<a href="http://xx--xx">Hey -- boo?</a>' ) );
     8        $this->assertSame( 'Hey &#8212; boo?', wptexturize( 'Hey -- boo?' ) );
     9        $this->assertSame( '<a href="http://xx--xx">Hey &#8212; boo?</a>', wptexturize( '<a href="http://xx--xx">Hey -- boo?</a>' ) );
    1010    }
    1111
    1212    function test_disable() {
    13         $this->assertEquals( '<pre>---&</pre>', wptexturize( '<pre>---&</pre>' ) );
    14         $this->assertEquals( '<pre><code></code>--&</pre>', wptexturize( '<pre><code></code>--&</pre>' ) );
    15 
    16         $this->assertEquals( '<code>---&</code>', wptexturize( '<code>---&</code>' ) );
    17         $this->assertEquals( '<kbd>---&</kbd>', wptexturize( '<kbd>---&</kbd>' ) );
    18         $this->assertEquals( '<style>---&</style>', wptexturize( '<style>---&</style>' ) );
    19         $this->assertEquals( '<script>---&</script>', wptexturize( '<script>---&</script>' ) );
    20         $this->assertEquals( '<tt>---&</tt>', wptexturize( '<tt>---&</tt>' ) );
    21 
    22         $this->assertEquals( '<code>href="baba"</code> &#8220;baba&#8221;', wptexturize( '<code>href="baba"</code> "baba"' ) );
     13        $this->assertSame( '<pre>---&</pre>', wptexturize( '<pre>---&</pre>' ) );
     14        $this->assertSame( '<pre><code></code>--&</pre>', wptexturize( '<pre><code></code>--&</pre>' ) );
     15
     16        $this->assertSame( '<code>---&</code>', wptexturize( '<code>---&</code>' ) );
     17        $this->assertSame( '<kbd>---&</kbd>', wptexturize( '<kbd>---&</kbd>' ) );
     18        $this->assertSame( '<style>---&</style>', wptexturize( '<style>---&</style>' ) );
     19        $this->assertSame( '<script>---&</script>', wptexturize( '<script>---&</script>' ) );
     20        $this->assertSame( '<tt>---&</tt>', wptexturize( '<tt>---&</tt>' ) );
     21
     22        $this->assertSame( '<code>href="baba"</code> &#8220;baba&#8221;', wptexturize( '<code>href="baba"</code> "baba"' ) );
    2323
    2424        $enabled_tags_inside_code = '<code>curl -s <a href="http://x/">baba</a> | grep sfive | cut -d "\"" -f 10 &gt; topmp3.txt</code>';
    25         $this->assertEquals( $enabled_tags_inside_code, wptexturize( $enabled_tags_inside_code ) );
     25        $this->assertSame( $enabled_tags_inside_code, wptexturize( $enabled_tags_inside_code ) );
    2626
    2727        $double_nest = '<pre>"baba"<code>"baba"<pre></pre></code>"baba"</pre>';
    28         $this->assertEquals( $double_nest, wptexturize( $double_nest ) );
     28        $this->assertSame( $double_nest, wptexturize( $double_nest ) );
    2929
    3030        $invalid_nest = '<pre></code>"baba"</pre>';
    31         $this->assertEquals( $invalid_nest, wptexturize( $invalid_nest ) );
     31        $this->assertSame( $invalid_nest, wptexturize( $invalid_nest ) );
    3232
    3333    }
     
    3737     */
    3838    function test_bracketed_quotes_1418() {
    39         $this->assertEquals( '(&#8220;test&#8221;)', wptexturize( '("test")' ) );
    40         $this->assertEquals( '(&#8216;test&#8217;)', wptexturize( "('test')" ) );
    41         $this->assertEquals( '(&#8217;twas)', wptexturize( "('twas)" ) );
     39        $this->assertSame( '(&#8220;test&#8221;)', wptexturize( '("test")' ) );
     40        $this->assertSame( '(&#8216;test&#8217;)', wptexturize( "('test')" ) );
     41        $this->assertSame( '(&#8217;twas)', wptexturize( "('twas)" ) );
    4242    }
    4343
     
    4646     */
    4747    function test_bracketed_quotes_3810() {
    48         $this->assertEquals( 'A dog (&#8220;Hubertus&#8221;) was sent out.', wptexturize( 'A dog ("Hubertus") was sent out.' ) );
     48        $this->assertSame( 'A dog (&#8220;Hubertus&#8221;) was sent out.', wptexturize( 'A dog ("Hubertus") was sent out.' ) );
    4949    }
    5050
     
    5353     */
    5454    function test_basic_quotes() {
    55         $this->assertEquals( 'test&#8217;s', wptexturize( 'test\'s' ) );
    56 
    57         $this->assertEquals( '&#8216;quoted&#8217;', wptexturize( '\'quoted\'' ) );
    58         $this->assertEquals( '&#8220;quoted&#8221;', wptexturize( '"quoted"' ) );
    59 
    60         $this->assertEquals( 'space before &#8216;quoted&#8217; space after', wptexturize( 'space before \'quoted\' space after' ) );
    61         $this->assertEquals( 'space before &#8220;quoted&#8221; space after', wptexturize( 'space before "quoted" space after' ) );
    62 
    63         $this->assertEquals( '(&#8216;quoted&#8217;)', wptexturize( '(\'quoted\')' ) );
    64         $this->assertEquals( '{&#8220;quoted&#8221;}', wptexturize( '{"quoted"}' ) );
    65 
    66         $this->assertEquals( '&#8216;qu(ot)ed&#8217;', wptexturize( '\'qu(ot)ed\'' ) );
    67         $this->assertEquals( '&#8220;qu{ot}ed&#8221;', wptexturize( '"qu{ot}ed"' ) );
    68 
    69         $this->assertEquals( ' &#8216;test&#8217;s quoted&#8217; ', wptexturize( ' \'test\'s quoted\' ' ) );
    70         $this->assertEquals( ' &#8220;test&#8217;s quoted&#8221; ', wptexturize( ' "test\'s quoted" ' ) );
     55        $this->assertSame( 'test&#8217;s', wptexturize( 'test\'s' ) );
     56
     57        $this->assertSame( '&#8216;quoted&#8217;', wptexturize( '\'quoted\'' ) );
     58        $this->assertSame( '&#8220;quoted&#8221;', wptexturize( '"quoted"' ) );
     59
     60        $this->assertSame( 'space before &#8216;quoted&#8217; space after', wptexturize( 'space before \'quoted\' space after' ) );
     61        $this->assertSame( 'space before &#8220;quoted&#8221; space after', wptexturize( 'space before "quoted" space after' ) );
     62
     63        $this->assertSame( '(&#8216;quoted&#8217;)', wptexturize( '(\'quoted\')' ) );
     64        $this->assertSame( '{&#8220;quoted&#8221;}', wptexturize( '{"quoted"}' ) );
     65
     66        $this->assertSame( '&#8216;qu(ot)ed&#8217;', wptexturize( '\'qu(ot)ed\'' ) );
     67        $this->assertSame( '&#8220;qu{ot}ed&#8221;', wptexturize( '"qu{ot}ed"' ) );
     68
     69        $this->assertSame( ' &#8216;test&#8217;s quoted&#8217; ', wptexturize( ' \'test\'s quoted\' ' ) );
     70        $this->assertSame( ' &#8220;test&#8217;s quoted&#8221; ', wptexturize( ' "test\'s quoted" ' ) );
    7171    }
    7272
     
    7676     */
    7777    function test_full_sentences_with_unmatched_single_quotes() {
    78         $this->assertEquals(
     78        $this->assertSame(
    7979            'That means every moment you&#8217;re working on something without it being in the public it&#8217;s actually dying.',
    8080            wptexturize( "That means every moment you're working on something without it being in the public it's actually dying." )
     
    8686     */
    8787    function test_quotes() {
    88         $this->assertEquals( '&#8220;Quoted String&#8221;', wptexturize( '"Quoted String"' ) );
    89         // $this->assertEquals( 'Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221;', wptexturize( 'Here is "<a href="http://example.com">a test with a link</a>"' ) );
    90         // $this->assertEquals( 'Here is &#8220;<a href="http://example.com">a test with a link and a period</a>&#8221;.', wptexturize( 'Here is "<a href="http://example.com">a test with a link and a period</a>".' ) );
    91         $this->assertEquals( 'Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221; and a space.', wptexturize( 'Here is "<a href="http://example.com">a test with a link</a>" and a space.' ) );
    92         $this->assertEquals( 'Here is &#8220;<a href="http://example.com">a test with a link</a> and some text quoted&#8221;', wptexturize( 'Here is "<a href="http://example.com">a test with a link</a> and some text quoted"' ) );
    93         // $this->assertEquals( 'Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221;, and a comma.', wptexturize( 'Here is "<a href="http://example.com">a test with a link</a>", and a comma.' ) );
    94         // $this->assertEquals( 'Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221;; and a semi-colon.', wptexturize( 'Here is "<a href="http://example.com">a test with a link</a>"; and a semi-colon.' ) );
    95         // $this->assertEquals( 'Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221;- and a dash.', wptexturize( 'Here is "<a href="http://example.com">a test with a link</a>"- and a dash.' ) );
    96         // $this->assertEquals( 'Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221;&#8230; and ellipses.', wptexturize( 'Here is "<a href="http://example.com">a test with a link</a>"... and ellipses.' ) );
    97         // $this->assertEquals( 'Here is &#8220;a test <a href="http://example.com">with a link</a>&#8221;.', wptexturize( 'Here is "a test <a href="http://example.com">with a link</a>".' ) );
    98         // $this->assertEquals( 'Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221;and a work stuck to the end.', wptexturize( 'Here is "<a href="http://example.com">a test with a link</a>"and a work stuck to the end.' ) );
    99         $this->assertEquals( 'A test with a finishing number, &#8220;like 23&#8221;.', wptexturize( 'A test with a finishing number, "like 23".' ) );
    100         $this->assertEquals( 'A test with a number, &#8220;like 62&#8221;, is nice to have.', wptexturize( 'A test with a number, "like 62", is nice to have.' ) );
     88        $this->assertSame( '&#8220;Quoted String&#8221;', wptexturize( '"Quoted String"' ) );
     89        // $this->assertSame( 'Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221;', wptexturize( 'Here is "<a href="http://example.com">a test with a link</a>"' ) );
     90        // $this->assertSame( 'Here is &#8220;<a href="http://example.com">a test with a link and a period</a>&#8221;.', wptexturize( 'Here is "<a href="http://example.com">a test with a link and a period</a>".' ) );
     91        $this->assertSame( 'Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221; and a space.', wptexturize( 'Here is "<a href="http://example.com">a test with a link</a>" and a space.' ) );
     92        $this->assertSame( 'Here is &#8220;<a href="http://example.com">a test with a link</a> and some text quoted&#8221;', wptexturize( 'Here is "<a href="http://example.com">a test with a link</a> and some text quoted"' ) );
     93        // $this->assertSame( 'Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221;, and a comma.', wptexturize( 'Here is "<a href="http://example.com">a test with a link</a>", and a comma.' ) );
     94        // $this->assertSame( 'Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221;; and a semi-colon.', wptexturize( 'Here is "<a href="http://example.com">a test with a link</a>"; and a semi-colon.' ) );
     95        // $this->assertSame( 'Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221;- and a dash.', wptexturize( 'Here is "<a href="http://example.com">a test with a link</a>"- and a dash.' ) );
     96        // $this->assertSame( 'Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221;&#8230; and ellipses.', wptexturize( 'Here is "<a href="http://example.com">a test with a link</a>"... and ellipses.' ) );
     97        // $this->assertSame( 'Here is &#8220;a test <a href="http://example.com">with a link</a>&#8221;.', wptexturize( 'Here is "a test <a href="http://example.com">with a link</a>".' ) );
     98        // $this->assertSame( 'Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221;and a work stuck to the end.', wptexturize( 'Here is "<a href="http://example.com">a test with a link</a>"and a work stuck to the end.' ) );
     99        $this->assertSame( 'A test with a finishing number, &#8220;like 23&#8221;.', wptexturize( 'A test with a finishing number, "like 23".' ) );
     100        $this->assertSame( 'A test with a number, &#8220;like 62&#8221;, is nice to have.', wptexturize( 'A test with a number, "like 62", is nice to have.' ) );
    101101    }
    102102
     
    105105     */
    106106    function test_quotes_before_s() {
    107         $this->assertEquals( 'test&#8217;s', wptexturize( "test's" ) );
    108         $this->assertEquals( '&#8216;test&#8217;s', wptexturize( "'test's" ) );
    109         $this->assertEquals( '&#8216;test&#8217;s&#8217;', wptexturize( "'test's'" ) );
    110         $this->assertEquals( '&#8216;string&#8217;', wptexturize( "'string'" ) );
    111         $this->assertEquals( '&#8216;string&#8217;s&#8217;', wptexturize( "'string's'" ) );
     107        $this->assertSame( 'test&#8217;s', wptexturize( "test's" ) );
     108        $this->assertSame( '&#8216;test&#8217;s', wptexturize( "'test's" ) );
     109        $this->assertSame( '&#8216;test&#8217;s&#8217;', wptexturize( "'test's'" ) );
     110        $this->assertSame( '&#8216;string&#8217;', wptexturize( "'string'" ) );
     111        $this->assertSame( '&#8216;string&#8217;s&#8217;', wptexturize( "'string's'" ) );
    112112    }
    113113
     
    116116     */
    117117    function test_quotes_before_numbers() {
    118         $this->assertEquals( 'Class of &#8217;99', wptexturize( "Class of '99" ) );
    119         $this->assertEquals( 'Class of &#8217;99&#8217;s', wptexturize( "Class of '99's" ) );
    120         $this->assertEquals( '&#8216;Class of &#8217;99&#8217;', wptexturize( "'Class of '99'" ) );
    121         $this->assertEquals( '&#8216;Class of &#8217;99&#8217; ', wptexturize( "'Class of '99' " ) );
    122         $this->assertEquals( '&#8216;Class of &#8217;99&#8217;.', wptexturize( "'Class of '99'." ) );
    123         $this->assertEquals( '&#8216;Class of &#8217;99&#8217;, she said', wptexturize( "'Class of '99', she said" ) );
    124         $this->assertEquals( '&#8216;Class of &#8217;99&#8217;:', wptexturize( "'Class of '99':" ) );
    125         $this->assertEquals( '&#8216;Class of &#8217;99&#8217;;', wptexturize( "'Class of '99';" ) );
    126         $this->assertEquals( '&#8216;Class of &#8217;99&#8217;!', wptexturize( "'Class of '99'!" ) );
    127         $this->assertEquals( '&#8216;Class of &#8217;99&#8217;?', wptexturize( "'Class of '99'?" ) );
    128         $this->assertEquals( '&#8216;Class of &#8217;99&#8217;s&#8217;', wptexturize( "'Class of '99's'" ) );
    129         $this->assertEquals( '&#8216;Class of &#8217;99&#8217;s&#8217;', wptexturize( "'Class of '99&#8217;s'" ) );
    130         $this->assertEquals( '&#8220;Class of 99&#8221;', wptexturize( '"Class of 99"' ) );
    131         $this->assertEquals( '&#8220;Class of &#8217;99&#8221;', wptexturize( "\"Class of '99\"" ) );
    132         $this->assertEquals( '{&#8220;Class of &#8217;99&#8221;}', wptexturize( "{\"Class of '99\"}" ) );
    133         $this->assertEquals( ' &#8220;Class of &#8217;99&#8221; ', wptexturize( " \"Class of '99\" " ) );
    134         $this->assertEquals( ' &#8220;Class of &#8217;99&#8221;.', wptexturize( " \"Class of '99\"." ) );
    135         $this->assertEquals( ' &#8220;Class of &#8217;99&#8221;, she said', wptexturize( " \"Class of '99\", she said" ) );
    136         $this->assertEquals( ' &#8220;Class of &#8217;99&#8221;:', wptexturize( " \"Class of '99\":" ) );
    137         $this->assertEquals( ' &#8220;Class of &#8217;99&#8221;;', wptexturize( " \"Class of '99\";" ) );
    138         $this->assertEquals( ' &#8220;Class of &#8217;99&#8221;!', wptexturize( " \"Class of '99\"!" ) );
    139         $this->assertEquals( ' &#8220;Class of &#8217;99&#8221;?', wptexturize( " \"Class of '99\"?" ) );
     118        $this->assertSame( 'Class of &#8217;99', wptexturize( "Class of '99" ) );
     119        $this->assertSame( 'Class of &#8217;99&#8217;s', wptexturize( "Class of '99's" ) );
     120        $this->assertSame( '&#8216;Class of &#8217;99&#8217;', wptexturize( "'Class of '99'" ) );
     121        $this->assertSame( '&#8216;Class of &#8217;99&#8217; ', wptexturize( "'Class of '99' " ) );
     122        $this->assertSame( '&#8216;Class of &#8217;99&#8217;.', wptexturize( "'Class of '99'." ) );
     123        $this->assertSame( '&#8216;Class of &#8217;99&#8217;, she said', wptexturize( "'Class of '99', she said" ) );
     124        $this->assertSame( '&#8216;Class of &#8217;99&#8217;:', wptexturize( "'Class of '99':" ) );
     125        $this->assertSame( '&#8216;Class of &#8217;99&#8217;;', wptexturize( "'Class of '99';" ) );
     126        $this->assertSame( '&#8216;Class of &#8217;99&#8217;!', wptexturize( "'Class of '99'!" ) );
     127        $this->assertSame( '&#8216;Class of &#8217;99&#8217;?', wptexturize( "'Class of '99'?" ) );
     128        $this->assertSame( '&#8216;Class of &#8217;99&#8217;s&#8217;', wptexturize( "'Class of '99's'" ) );
     129        $this->assertSame( '&#8216;Class of &#8217;99&#8217;s&#8217;', wptexturize( "'Class of '99&#8217;s'" ) );
     130        $this->assertSame( '&#8220;Class of 99&#8221;', wptexturize( '"Class of 99"' ) );
     131        $this->assertSame( '&#8220;Class of &#8217;99&#8221;', wptexturize( "\"Class of '99\"" ) );
     132        $this->assertSame( '{&#8220;Class of &#8217;99&#8221;}', wptexturize( "{\"Class of '99\"}" ) );
     133        $this->assertSame( ' &#8220;Class of &#8217;99&#8221; ', wptexturize( " \"Class of '99\" " ) );
     134        $this->assertSame( ' &#8220;Class of &#8217;99&#8221;.', wptexturize( " \"Class of '99\"." ) );
     135        $this->assertSame( ' &#8220;Class of &#8217;99&#8221;, she said', wptexturize( " \"Class of '99\", she said" ) );
     136        $this->assertSame( ' &#8220;Class of &#8217;99&#8221;:', wptexturize( " \"Class of '99\":" ) );
     137        $this->assertSame( ' &#8220;Class of &#8217;99&#8221;;', wptexturize( " \"Class of '99\";" ) );
     138        $this->assertSame( ' &#8220;Class of &#8217;99&#8221;!', wptexturize( " \"Class of '99\"!" ) );
     139        $this->assertSame( ' &#8220;Class of &#8217;99&#8221;?', wptexturize( " \"Class of '99\"?" ) );
    140140        // Not a quotation, may be between two other quotations.
    141         $this->assertEquals( '}&#8221;Class of &#8217;99&#8243;{', wptexturize( "}\"Class of '99\"{" ) );
     141        $this->assertSame( '}&#8221;Class of &#8217;99&#8243;{', wptexturize( "}\"Class of '99\"{" ) );
    142142    }
    143143
    144144    function test_quotes_after_numbers() {
    145         $this->assertEquals( 'Class of &#8217;99', wptexturize( "Class of '99" ) );
     145        $this->assertSame( 'Class of &#8217;99', wptexturize( "Class of '99" ) );
    146146    }
    147147
     
    151151     */
    152152    function test_other_html() {
    153         $this->assertEquals( '&#8216;<strong>', wptexturize( "'<strong>" ) );
    154         // $this->assertEquals( '&#8216;<strong>Quoted Text</strong>&#8217;,', wptexturize( "'<strong>Quoted Text</strong>'," ) );
    155         // $this->assertEquals( '&#8220;<strong>Quoted Text</strong>&#8221;,', wptexturize( '"<strong>Quoted Text</strong>",' ) );
     153        $this->assertSame( '&#8216;<strong>', wptexturize( "'<strong>" ) );
     154        // $this->assertSame( '&#8216;<strong>Quoted Text</strong>&#8217;,', wptexturize( "'<strong>Quoted Text</strong>'," ) );
     155        // $this->assertSame( '&#8220;<strong>Quoted Text</strong>&#8221;,', wptexturize( '"<strong>Quoted Text</strong>",' ) );
    156156    }
    157157
    158158    function test_x() {
    159         $this->assertEquals( '14&#215;24', wptexturize( '14x24' ) );
     159        $this->assertSame( '14&#215;24', wptexturize( '14x24' ) );
    160160    }
    161161
    162162    function test_minutes_seconds() {
    163         $this->assertEquals( '9&#8242;', wptexturize( '9\'' ) );
    164         $this->assertEquals( '9&#8243;', wptexturize( '9"' ) );
    165 
    166         $this->assertEquals( 'a 9&#8242; b', wptexturize( 'a 9\' b' ) );
    167         $this->assertEquals( 'a 9&#8243; b', wptexturize( 'a 9" b' ) );
    168 
    169         $this->assertEquals( '&#8220;a 9&#8242; b&#8221;', wptexturize( '"a 9\' b"' ) );
    170         $this->assertEquals( '&#8216;a 9&#8243; b&#8217;', wptexturize( "'a 9\" b'" ) );
     163        $this->assertSame( '9&#8242;', wptexturize( '9\'' ) );
     164        $this->assertSame( '9&#8243;', wptexturize( '9"' ) );
     165
     166        $this->assertSame( 'a 9&#8242; b', wptexturize( 'a 9\' b' ) );
     167        $this->assertSame( 'a 9&#8243; b', wptexturize( 'a 9" b' ) );
     168
     169        $this->assertSame( '&#8220;a 9&#8242; b&#8221;', wptexturize( '"a 9\' b"' ) );
     170        $this->assertSame( '&#8216;a 9&#8243; b&#8217;', wptexturize( "'a 9\" b'" ) );
    171171    }
    172172
     
    175175     */
    176176    function test_wptexturize_quotes_around_numbers() {
    177         $this->assertEquals( '&#8220;12345&#8221;', wptexturize( '"12345"' ) );
    178         $this->assertEquals( '&#8216;12345&#8217;', wptexturize( '\'12345\'' ) );
    179         $this->assertEquals( '&#8220;a 9&#8242; plus a &#8216;9&#8217;, maybe a 9&#8242; &#8216;9&#8217;&#8221;', wptexturize( '"a 9\' plus a \'9\', maybe a 9\' \'9\'"' ) );
    180         $this->assertEquals( '<p>&#8217;99<br />&#8216;123&#8217;<br />&#8217;tis<br />&#8216;s&#8217;</p>', wptexturize( '<p>\'99<br />\'123\'<br />\'tis<br />\'s\'</p>' ) );
     177        $this->assertSame( '&#8220;12345&#8221;', wptexturize( '"12345"' ) );
     178        $this->assertSame( '&#8216;12345&#8217;', wptexturize( '\'12345\'' ) );
     179        $this->assertSame( '&#8220;a 9&#8242; plus a &#8216;9&#8217;, maybe a 9&#8242; &#8216;9&#8217;&#8221;', wptexturize( '"a 9\' plus a \'9\', maybe a 9\' \'9\'"' ) );
     180        $this->assertSame( '<p>&#8217;99<br />&#8216;123&#8217;<br />&#8217;tis<br />&#8216;s&#8217;</p>', wptexturize( '<p>\'99<br />\'123\'<br />\'tis<br />\'s\'</p>' ) );
    181181    }
    182182
     
    185185     */
    186186    function test_wptexturize_html_comments() {
    187         $this->assertEquals( '<!--[if !IE]>--><!--<![endif]-->', wptexturize( '<!--[if !IE]>--><!--<![endif]-->' ) );
    188         $this->assertEquals( '<!--[if !IE]>"a 9\' plus a \'9\', maybe a 9\' \'9\' "<![endif]-->', wptexturize( '<!--[if !IE]>"a 9\' plus a \'9\', maybe a 9\' \'9\' "<![endif]-->' ) );
    189         $this->assertEquals( '<ul><li>Hello.</li><!--<li>Goodbye.</li>--></ul>', wptexturize( '<ul><li>Hello.</li><!--<li>Goodbye.</li>--></ul>' ) );
     187        $this->assertSame( '<!--[if !IE]>--><!--<![endif]-->', wptexturize( '<!--[if !IE]>--><!--<![endif]-->' ) );
     188        $this->assertSame( '<!--[if !IE]>"a 9\' plus a \'9\', maybe a 9\' \'9\' "<![endif]-->', wptexturize( '<!--[if !IE]>"a 9\' plus a \'9\', maybe a 9\' \'9\' "<![endif]-->' ) );
     189        $this->assertSame( '<ul><li>Hello.</li><!--<li>Goodbye.</li>--></ul>', wptexturize( '<ul><li>Hello.</li><!--<li>Goodbye.</li>--></ul>' ) );
    190190    }
    191191
     
    195195     */
    196196    function test_entity_quote_cuddling() {
    197         $this->assertEquals( '&nbsp;&#8220;Testing&#8221;', wptexturize( '&nbsp;"Testing"' ) );
    198         // $this->assertEquals( '&#38;&#8220;Testing&#8221;', wptexturize( '&#38;"Testing"' ) );
     197        $this->assertSame( '&nbsp;&#8220;Testing&#8221;', wptexturize( '&nbsp;"Testing"' ) );
     198        // $this->assertSame( '&#38;&#8220;Testing&#8221;', wptexturize( '&#38;"Testing"' ) );
    199199    }
    200200
     
    203203     */
    204204    function test_apostrophes_before_primes() {
    205         $this->assertEquals( 'WordPress 3.5&#8217;s release date', wptexturize( "WordPress 3.5's release date" ) );
     205        $this->assertSame( 'WordPress 3.5&#8217;s release date', wptexturize( "WordPress 3.5's release date" ) );
    206206    }
    207207
     
    212212        $nbsp = "\xC2\xA0";
    213213
    214         $this->assertEquals( ' &#8211; ', wptexturize( ' - ' ) );
    215         $this->assertEquals( '&nbsp;&#8211;&nbsp;', wptexturize( '&nbsp;-&nbsp;' ) );
    216         $this->assertEquals( ' &#8211;&nbsp;', wptexturize( ' -&nbsp;' ) );
    217         $this->assertEquals( '&nbsp;&#8211; ', wptexturize( '&nbsp;- ' ) );
    218         $this->assertEquals( "$nbsp&#8211;$nbsp", wptexturize( "$nbsp-$nbsp" ) );
    219         $this->assertEquals( " &#8211;$nbsp", wptexturize( " -$nbsp" ) );
    220         $this->assertEquals( "$nbsp&#8211; ", wptexturize( "$nbsp- " ) );
    221 
    222         $this->assertEquals( ' &#8212; ', wptexturize( ' -- ' ) );
    223         $this->assertEquals( '&nbsp;&#8212;&nbsp;', wptexturize( '&nbsp;--&nbsp;' ) );
    224         $this->assertEquals( ' &#8212;&nbsp;', wptexturize( ' --&nbsp;' ) );
    225         $this->assertEquals( '&nbsp;&#8212; ', wptexturize( '&nbsp;-- ' ) );
    226         $this->assertEquals( "$nbsp&#8212;$nbsp", wptexturize( "$nbsp--$nbsp" ) );
    227         $this->assertEquals( " &#8212;$nbsp", wptexturize( " --$nbsp" ) );
    228         $this->assertEquals( "$nbsp&#8212; ", wptexturize( "$nbsp-- " ) );
     214        $this->assertSame( ' &#8211; ', wptexturize( ' - ' ) );
     215        $this->assertSame( '&nbsp;&#8211;&nbsp;', wptexturize( '&nbsp;-&nbsp;' ) );
     216        $this->assertSame( ' &#8211;&nbsp;', wptexturize( ' -&nbsp;' ) );
     217        $this->assertSame( '&nbsp;&#8211; ', wptexturize( '&nbsp;- ' ) );
     218        $this->assertSame( "$nbsp&#8211;$nbsp", wptexturize( "$nbsp-$nbsp" ) );
     219        $this->assertSame( " &#8211;$nbsp", wptexturize( " -$nbsp" ) );
     220        $this->assertSame( "$nbsp&#8211; ", wptexturize( "$nbsp- " ) );
     221
     222        $this->assertSame( ' &#8212; ', wptexturize( ' -- ' ) );
     223        $this->assertSame( '&nbsp;&#8212;&nbsp;', wptexturize( '&nbsp;--&nbsp;' ) );
     224        $this->assertSame( ' &#8212;&nbsp;', wptexturize( ' --&nbsp;' ) );
     225        $this->assertSame( '&nbsp;&#8212; ', wptexturize( '&nbsp;-- ' ) );
     226        $this->assertSame( "$nbsp&#8212;$nbsp", wptexturize( "$nbsp--$nbsp" ) );
     227        $this->assertSame( " &#8212;$nbsp", wptexturize( " --$nbsp" ) );
     228        $this->assertSame( "$nbsp&#8212; ", wptexturize( "$nbsp-- " ) );
    229229    }
    230230
     
    233233     */
    234234    function test_hyphens_at_start_and_end() {
    235         $this->assertEquals( '&#8211; ', wptexturize( '- ' ) );
    236         $this->assertEquals( '&#8211; &#8211;', wptexturize( '- -' ) );
    237         $this->assertEquals( ' &#8211;', wptexturize( ' -' ) );
    238 
    239         $this->assertEquals( '&#8212; ', wptexturize( '-- ' ) );
    240         $this->assertEquals( '&#8212; &#8212;', wptexturize( '-- --' ) );
    241         $this->assertEquals( ' &#8212;', wptexturize( ' --' ) );
     235        $this->assertSame( '&#8211; ', wptexturize( '- ' ) );
     236        $this->assertSame( '&#8211; &#8211;', wptexturize( '- -' ) );
     237        $this->assertSame( ' &#8211;', wptexturize( ' -' ) );
     238
     239        $this->assertSame( '&#8212; ', wptexturize( '-- ' ) );
     240        $this->assertSame( '&#8212; &#8212;', wptexturize( '-- --' ) );
     241        $this->assertSame( ' &#8212;', wptexturize( ' --' ) );
    242242    }
    243243
     
    267267     */
    268268    function test_spaces_around_quotes( $input, $output ) {
    269         return $this->assertEquals( $output, wptexturize( $input ) );
     269        return $this->assertSame( $output, wptexturize( $input ) );
    270270    }
    271271
     
    323323     */
    324324    function test_apos_before_digits( $input, $output ) {
    325         return $this->assertEquals( $output, wptexturize( $input ) );
     325        return $this->assertSame( $output, wptexturize( $input ) );
    326326    }
    327327
     
    364364     */
    365365    function test_opening_single_quote( $input, $output ) {
    366         return $this->assertEquals( $output, wptexturize( $input ) );
     366        return $this->assertSame( $output, wptexturize( $input ) );
    367367    }
    368368
     
    493493     */
    494494    function test_double_prime( $input, $output ) {
    495         return $this->assertEquals( $output, wptexturize( $input ) );
     495        return $this->assertSame( $output, wptexturize( $input ) );
    496496    }
    497497
     
    526526     */
    527527    function test_single_prime( $input, $output ) {
    528         return $this->assertEquals( $output, wptexturize( $input ) );
     528        return $this->assertSame( $output, wptexturize( $input ) );
    529529    }
    530530
     
    559559     */
    560560    function test_contractions( $input, $output ) {
    561         return $this->assertEquals( $output, wptexturize( $input ) );
     561        return $this->assertSame( $output, wptexturize( $input ) );
    562562    }
    563563
     
    600600     */
    601601    function test_opening_quote( $input, $output ) {
    602         return $this->assertEquals( $output, wptexturize( $input ) );
     602        return $this->assertSame( $output, wptexturize( $input ) );
    603603    }
    604604
     
    677677     */
    678678    function test_closing_quote( $input, $output ) {
    679         return $this->assertEquals( $output, wptexturize( $input ) );
     679        return $this->assertSame( $output, wptexturize( $input ) );
    680680    }
    681681
     
    766766     */
    767767    function test_closing_single_quote( $input, $output ) {
    768         return $this->assertEquals( $output, wptexturize( $input ) );
     768        return $this->assertSame( $output, wptexturize( $input ) );
    769769    }
    770770
     
    856856     */
    857857    function test_multiplication( $input, $output ) {
    858         return $this->assertEquals( $output, wptexturize( $input ) );
     858        return $this->assertSame( $output, wptexturize( $input ) );
    859859    }
    860860
     
    906906     */
    907907    function test_ampersand( $input, $output ) {
    908         return $this->assertEquals( $output, wptexturize( $input ) );
     908        return $this->assertSame( $output, wptexturize( $input ) );
    909909    }
    910910
     
    971971     */
    972972    function test_cockney( $input, $output ) {
    973         return $this->assertEquals( $output, wptexturize( $input ) );
     973        return $this->assertSame( $output, wptexturize( $input ) );
    974974    }
    975975
     
    10321032     */
    10331033    function test_smart_dashes( $input, $output ) {
    1034         return $this->assertEquals( $output, wptexturize( $input ) );
     1034        return $this->assertSame( $output, wptexturize( $input ) );
    10351035    }
    10361036
     
    10851085     */
    10861086    function test_misc_static_replacements( $input, $output ) {
    1087         return $this->assertEquals( $output, wptexturize( $input ) );
     1087        return $this->assertSame( $output, wptexturize( $input ) );
    10881088    }
    10891089
     
    11401140     */
    11411141    function test_quoted_numbers( $input, $output ) {
    1142         return $this->assertEquals( $output, wptexturize( $input ) );
     1142        return $this->assertSame( $output, wptexturize( $input ) );
    11431143    }
    11441144
     
    11911191     */
    11921192    function test_quotes_and_dashes( $input, $output ) {
    1193         return $this->assertEquals( $output, wptexturize( $input ) );
     1193        return $this->assertSame( $output, wptexturize( $input ) );
    11941194    }
    11951195
     
    12541254     */
    12551255    function test_tag_avoidance( $input, $output ) {
    1256         return $this->assertEquals( $output, wptexturize( $input ) );
     1256        return $this->assertSame( $output, wptexturize( $input ) );
    12571257    }
    12581258
     
    14771477     */
    14781478    function test_year_abbr( $input, $output ) {
    1479         return $this->assertEquals( $output, wptexturize( $input ) );
     1479        return $this->assertSame( $output, wptexturize( $input ) );
    14801480    }
    14811481
     
    15731573        wptexturize( 'reset', true );
    15741574
    1575         return $this->assertEquals( $output, $result );
     1575        return $this->assertSame( $output, $result );
    15761576    }
    15771577
     
    17931793     */
    17941794    function test_element_stack( $input, $output ) {
    1795         return $this->assertEquals( $output, wptexturize( $input ) );
     1795        return $this->assertSame( $output, wptexturize( $input ) );
    17961796    }
    17971797
     
    18461846        add_filter( 'no_texturize_shortcodes', array( $this, 'filter_shortcodes' ), 10, 1 );
    18471847
    1848         $output = $this->assertEquals( $output, wptexturize( $input ) );
     1848        $output = $this->assertSame( $output, wptexturize( $input ) );
    18491849
    18501850        remove_filter( 'no_texturize_shortcodes', array( $this, 'filter_shortcodes' ), 10, 1 );
     
    19291929     */
    19301930    function test_primes_vs_quotes( $input, $output ) {
    1931         return $this->assertEquals( $output, wptexturize( $input ) );
     1931        return $this->assertSame( $output, wptexturize( $input ) );
    19321932    }
    19331933
     
    19981998        wptexturize( 'reset', true );
    19991999
    2000         return $this->assertEquals( $output, $result );
     2000        return $this->assertSame( $output, $result );
    20012001    }
    20022002
     
    21042104     */
    21052105    function test_trailing_less_than() {
    2106         $this->assertEquals( 'F&#8211;oo<', wptexturize( 'F--oo<', true ) );
     2106        $this->assertSame( 'F&#8211;oo<', wptexturize( 'F--oo<', true ) );
    21072107    }
    21082108
Note: See TracChangeset for help on using the changeset viewer.