Changeset 36337
- Timestamp:
- 01/17/2016 11:37:51 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/formatting/Smilies.php
r32178 r36337 21 21 array ( 22 22 '<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>" 24 24 ), 25 25 array ( … … 170 170 array ( 171 171 '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" 173 173 ), 174 174 array ( … … 182 182 array ( 183 183 '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" 185 185 ), 186 186 array ( … … 189 189 ), 190 190 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;\" />" 193 193 ), 194 194 ); … … 273 273 } 274 274 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 :) smile', 285 "test \xf0\x9f\x99\x82 smile" 286 ), 287 array( 288 "test {$nbsp}:){$nbsp}smile", 289 "test {$nbsp}\xf0\x9f\x99\x82{$nbsp}smile" 290 ) 291 ); 292 } 293 275 294 /** 276 295 * Check that $wp_smiliessearch pattern will match smilies … … 281 300 * 282 301 * @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 ) { 287 305 // standard smilies, use_smilies: ON 288 306 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 :) smile'; 298 $output[] = array('test <img ', 'alt=":)"', ' /> 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 ) ); 312 311 313 312 // standard smilies, use_smilies: OFF
Note: See TracChangeset
for help on using the changeset viewer.