Changeset 32850 for trunk/tests/phpunit/tests/formatting/WPSpecialchars.php
- Timestamp:
- 06/18/2015 09:59:10 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/formatting/WPSpecialchars.php
r25002 r32850 18 18 // Allowed entities should be unchanged 19 19 foreach ( $allowedentitynames as $ent ) { 20 if ( 'apos' == $ent ) { 21 // But for some reason, PHP doesn't allow ' 22 continue; 23 } 20 24 $ent = '&' . $ent . ';'; 21 25 $this->assertEquals( $ent, _wp_specialchars( $ent ) ); … … 40 44 $this->assertEquals( $source, _wp_specialchars($source) ); 41 45 } 46 47 /** 48 * Check some of the double-encoding features for entity references. 49 * 50 * @ticket 17780 51 * @dataProvider data_double_encoding 52 */ 53 function test_double_encoding( $input, $output ) { 54 return $this->assertEquals( $output, _wp_specialchars( $input, ENT_NOQUOTES, false, true ) ); 55 } 56 57 function data_double_encoding() { 58 return array( 59 array( 60 'This & that, this & that, — " " Ú " " " " " $ ×', 61 'This & that, this & that, — " " Ú   " " " " " $ ×', 62 ), 63 array( 64 '&& && && &;', 65 '&& && && &;', 66 ), 67 array( 68 '&garbage; &***; &aaaa; &0000; &####; &;;', 69 '&garbage; &***; &aaaa; &0000; &####; &;;', 70 ), 71 ); 72 } 73 74 /** 75 * Check some of the double-encoding features for entity references. 76 * 77 * @ticket 17780 78 * @dataProvider data_no_double_encoding 79 */ 80 function test_no_double_encoding( $input, $output ) { 81 return $this->assertEquals( $output, _wp_specialchars( $input, ENT_NOQUOTES, false, false ) ); 82 } 83 84 function data_no_double_encoding() { 85 return array( 86 array( 87 'This & that, this & that, — " " Ú " " " " " $ ×', 88 'This & that, this & that, — " " Ú " " " " " $ ×', 89 ), 90 array( 91 '&& && && &;', 92 '&& && && &;', 93 ), 94 array( 95 '&garbage; &***; &aaaa; &0000; &####; &;;', 96 '&garbage; &***; &aaaa; &0000; &####; &;;', 97 ), 98 ); 99 } 42 100 }
Note: See TracChangeset
for help on using the changeset viewer.