Make WordPress Core

Changeset 36337


Ignore:
Timestamp:
01/17/2016 11:37:51 PM (9 years ago)
Author:
iseulde
Message:

Fix unit tests after [36336]

File:
1 edited

Legend:

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

    r32178 r36337  
    2121            array (
    2222                '<strong>Welcome to the jungle!</strong> We got fun n games! :) We got everything you want 8-) <em>Honey we know the names :)</em>',
    23                 "<strong>Welcome to the jungle!</strong> We got fun n games! <img src=\"${includes_path}simple-smile.png\" alt=\":)\" class=\"wp-smiley\" style=\"height: 1em; max-height: 1em;\" /> We got everything you want \xf0\x9f\x98\x8e <em>Honey we know the names <img src=\"${includes_path}simple-smile.png\" alt=\":)\" class=\"wp-smiley\" style=\"height: 1em; max-height: 1em;\" /></em>"
     23                "<strong>Welcome to the jungle!</strong> We got fun n games! \xf0\x9f\x99\x82 We got everything you want \xf0\x9f\x98\x8e <em>Honey we know the names \xf0\x9f\x99\x82</em>"
    2424            ),
    2525            array (
     
    170170            array (
    171171                '8-O :-(',
    172                 "\xf0\x9f\x98\xaf <img src=\"{$includes_path}frownie.png\" alt=\":-(\" class=\"wp-smiley\" style=\"height: 1em; max-height: 1em;\" />"
     172                "\xf0\x9f\x98\xaf \xf0\x9f\x99\x81"
    173173            ),
    174174            array (
     
    182182            array (
    183183                '8-) :-(',
    184                 "\xf0\x9f\x98\x8e <img src=\"{$includes_path}frownie.png\" alt=\":-(\" class=\"wp-smiley\" style=\"height: 1em; max-height: 1em;\" />"
     184                "\xf0\x9f\x98\x8e \xf0\x9f\x99\x81"
    185185            ),
    186186            array (
     
    189189            ),
    190190            array (
    191                 '8O :twisted: :( :? :(',
    192                 "\xf0\x9f\x98\xaf \xf0\x9f\x98\x88 <img src=\"{$includes_path}frownie.png\" alt=\":(\" class=\"wp-smiley\" style=\"height: 1em; max-height: 1em;\" /> \xf0\x9f\x98\x95 <img src=\"{$includes_path}frownie.png\" alt=\":(\" class=\"wp-smiley\" style=\"height: 1em; max-height: 1em;\" />"
     191                '8O :twisted: :( :? :roll:',
     192                "\xf0\x9f\x98\xaf \xf0\x9f\x98\x88 \xf0\x9f\x99\x81 \xf0\x9f\x98\x95 <img src=\"{$includes_path}rolleyes.png\" alt=\":roll:\" class=\"wp-smiley\" style=\"height: 1em; max-height: 1em;\" />"
    193193            ),
    194194        );
     
    273273    }
    274274
     275    public function get_spaces_around_smilies() {
     276        $nbsp = "\xC2\xA0";
     277
     278        return array(
     279            array(
     280                'test :) smile',
     281                "test \xf0\x9f\x99\x82 smile"
     282            ),
     283            array(
     284                'test &nbsp;:)&nbsp;smile',
     285                "test &nbsp;\xf0\x9f\x99\x82&nbsp;smile"
     286            ),
     287            array(
     288                "test {$nbsp}:){$nbsp}smile",
     289                "test {$nbsp}\xf0\x9f\x99\x82{$nbsp}smile"
     290            )
     291        );
     292    }
     293
    275294    /**
    276295     * Check that $wp_smiliessearch pattern will match smilies
     
    281300     *
    282301     * @ticket 22692
    283      */
    284     function test_spaces_around_smilies() {
    285         $nbsp = "\xC2\xA0";
    286 
     302     * @dataProvider get_spaces_around_smilies
     303     */
     304    function test_spaces_around_smilies( $in_txt, $converted_txt ) {
    287305        // standard smilies, use_smilies: ON
    288306        update_option( 'use_smilies', 1 );
    289         smilies_init();
    290 
    291         $input  = array();
    292         $output = array();
    293 
    294         $input[]  = 'My test :) smile';
    295         $output[] = array('test <img ', 'alt=":)"', ' /> smile');
    296 
    297         $input[]  = 'My test &nbsp;:)&nbsp;smile';
    298         $output[] = array('test &nbsp;<img ', 'alt=":)"', ' />&nbsp;smile');
    299 
    300         $input[]  = "My test {$nbsp}:){$nbsp}smile";
    301         $output[] = array("test {$nbsp}<img ", 'alt=":)"', " />{$nbsp}smile");
    302 
    303         foreach($input as $key => $in) {
    304             $result = convert_smilies( $in );
    305             foreach($output[$key] as $out) {
    306 
    307                 // Each output element must appear in the results.
    308                 $this->assertContains( $out, $result );
    309 
    310             }
    311         }
     307
     308        smilies_init();
     309
     310        $this->assertEquals( $converted_txt, convert_smilies( $in_txt ) );
    312311
    313312        // standard smilies, use_smilies: OFF
Note: See TracChangeset for help on using the changeset viewer.