Ticket #22692: miqro-22692-tests.4.diff
| File miqro-22692-tests.4.diff, 4.5 KB (added by , 13 years ago) |
|---|
-
tests/formatting/Smilies.php
81 81 $this->assertEquals( $outputs[$k], convert_smilies($input) ); 82 82 } 83 83 } 84 85 /** 86 * Check that $wp_smiliessearch pattern will match smilies 87 * between spaces, but never capture those spaces. 88 * 89 * Further check that spaces aren't randomly deleted 90 * or added when replacing the text with an image. 91 * 92 * @ticket 22692 / 26842 93 */ 94 function test_spaces_around_smilies() { 95 $nbsp = "\xC2\xA0"; 96 97 $input = array(); 98 $output = array(); 99 100 $input[] = 'My test :) smile'; 101 $output[] = array('test <img ', 'alt=":)"', ' /> smile'); 102 103 $input[] = 'My test ;) smile'; 104 $output[] = array('test <img ', 'alt=";)"', ' /> smile'); 105 106 $input[] = 'My test :) smile'; 107 $output[] = array('test <img ', 'alt=":)"', ' /> smile'); 108 109 $input[] = 'My test ;) smile'; 110 $output[] = array('test <img ', 'alt=";)"', ' /> smile'); 111 112 $input[] = "My test {$nbsp}:){$nbsp}smile"; 113 $output[] = array("test {$nbsp}<img ", 'alt=":)"', " />{$nbsp}smile"); 114 115 $input[] = "My test {$nbsp};){$nbsp}smile"; 116 $output[] = array("test {$nbsp}<img ", 'alt=";)"', " />{$nbsp}smile"); 117 118 foreach($input as $key => $in) { 119 $result = convert_smilies( $in ); 120 foreach($output[$key] as $k => $out) { 121 122 // Each output element must appear in the results. 123 $this->assertContains( $out[$k], $result ); 124 125 } 126 } 127 } 84 128 } -
tests/formatting/WPTexturize.php
194 194 $this->assertEquals( ' — ', wptexturize( ' -- ' ) ); 195 195 $this->assertEquals( ' — ', wptexturize( ' -- ') ); 196 196 } 197 198 /** 199 * @ticket 22692 200 */ 201 function test_spaces_around_quotes() { 202 $nbsp = "\xC2\xA0"; 203 $pi = "\xCE\xA0"; 204 205 // This should never happen, even if the desired output changes some day. 206 207 $problem_input = "$nbsp\"A"; 208 $problem_output = "$nbsp”A"; 209 210 $this->assertNotEquals( $problem_output, wptexturize( $problem_input ) ); 211 212 // These are desirable outputs for the current design. 213 214 $input = array(); 215 $output = array(); 216 217 $input[] = "stop. $nbsp\"A quote after 2 spaces.\""; 218 $output[] = "stop. $nbsp“A quote after 2 spaces.”"; 219 220 $input[] = "stop.$nbsp$nbsp\"A quote after 2 spaces.\""; 221 $output[] = "stop.$nbsp$nbsp“A quote after 2 spaces.”"; 222 223 $input[] = "stop. $nbsp'A quote after 2 spaces.'"; 224 $output[] = "stop. $nbsp‘A quote after 2 spaces.’"; 225 226 $input[] = "stop.$nbsp$nbsp'A quote after 2 spaces.'"; 227 $output[] = "stop.$nbsp$nbsp‘A quote after 2 spaces.’"; 228 229 $input[] = "stop. \"A quote after 2 spaces.\""; 230 $output[] = "stop. “A quote after 2 spaces.”"; 231 232 $input[] = "stop. \"A quote after 2 spaces.\""; 233 $output[] = "stop. “A quote after 2 spaces.”"; 234 235 $input[] = "stop. 'A quote after 2 spaces.'"; 236 $output[] = "stop. ‘A quote after 2 spaces.’"; 237 238 $input[] = "stop. 'A quote after 2 spaces.'"; 239 $output[] = "stop. ‘A quote after 2 spaces.’"; 240 241 $input[] = "Contraction: $pi's"; 242 $output[] = "Contraction: $pi’s"; 243 244 foreach($input as $key => $in) { 245 $this->assertEquals( $output[$key], wptexturize( $in ) ); 246 } 247 } 197 248 } -
tests/shortcode.php
373 373 remove_filter( 'shortcode_atts_bartag', array( $this, '_filter_atts2' ), 10, 3 ); 374 374 } 375 375 376 /** 377 * Check that shortcode_unautop() will always recognize spaces around shortcodes. 378 * 379 * @ticket 22692 380 */ 381 function test_spaces_around_shortcodes() { 382 $nbsp = "\xC2\xA0"; 383 384 $input = array(); 385 386 $input[] = "<p>[gallery ids=\"37,15,11\"]</p>"; 387 $input[] = "<p> [gallery ids=\"37,15,11\"] </p>"; 388 $input[] = "<p> $nbsp[gallery ids=\"37,15,11\"] $nbsp</p>"; 389 $input[] = "<p> [gallery ids=\"37,15,11\"] </p>"; 390 391 $output = "[gallery ids=\"37,15,11\"]"; 392 393 foreach($input as $in) { 394 $this->assertEquals( $output, shortcode_unautop( $in ) ); 395 } 396 } 376 397 }
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)