- Timestamp:
- 11/04/2021 03:22:47 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/formatting/sanitizeTitleWithDashes.php
r51984 r52010 5 5 */ 6 6 class Tests_Formatting_SanitizeTitleWithDashes extends WP_UnitTestCase { 7 function test_strips_html() {7 public function test_strips_html() { 8 8 $input = 'Captain <strong>Awesome</strong>'; 9 9 $expected = 'captain-awesome'; … … 11 11 } 12 12 13 function test_strips_unencoded_percent_signs() {13 public function test_strips_unencoded_percent_signs() { 14 14 $this->assertSame( 'fran%c3%a7ois', sanitize_title_with_dashes( 'fran%c3%a7%ois' ) ); 15 15 } 16 16 17 function test_makes_title_lowercase() {17 public function test_makes_title_lowercase() { 18 18 $this->assertSame( 'abc', sanitize_title_with_dashes( 'ABC' ) ); 19 19 } 20 20 21 function test_replaces_any_amount_of_whitespace_with_one_hyphen() {21 public function test_replaces_any_amount_of_whitespace_with_one_hyphen() { 22 22 $this->assertSame( 'a-t', sanitize_title_with_dashes( 'a t' ) ); 23 23 $this->assertSame( 'a-t', sanitize_title_with_dashes( "a \n\n\nt" ) ); 24 24 } 25 25 26 function test_replaces_any_number_of_hyphens_with_one_hyphen() {26 public function test_replaces_any_number_of_hyphens_with_one_hyphen() { 27 27 $this->assertSame( 'a-t-t', sanitize_title_with_dashes( 'a----t----t' ) ); 28 28 } 29 29 30 function test_trims_trailing_hyphens() {30 public function test_trims_trailing_hyphens() { 31 31 $this->assertSame( 'a-t-t', sanitize_title_with_dashes( 'a----t----t----' ) ); 32 32 } 33 33 34 function test_handles_non_entity_ampersands() {34 public function test_handles_non_entity_ampersands() { 35 35 $this->assertSame( 'penn-teller-bull', sanitize_title_with_dashes( 'penn & teller bull' ) ); 36 36 } … … 60 60 } 61 61 62 function test_replaces_nbsp() {62 public function test_replaces_nbsp() { 63 63 $this->assertSame( 'dont-break-the-space', sanitize_title_with_dashes( "don't break the space", '', 'save' ) ); 64 64 } … … 67 67 * @ticket 31790 68 68 */ 69 function test_replaces_nbsp_entities() {69 public function test_replaces_nbsp_entities() { 70 70 $this->assertSame( 'dont-break-the-space', sanitize_title_with_dashes( "don't break the space", '', 'save' ) ); 71 71 } 72 72 73 function test_replaces_ndash_mdash() {73 public function test_replaces_ndash_mdash() { 74 74 $this->assertSame( 'do-the-dash', sanitize_title_with_dashes( 'Do – the Dash', '', 'save' ) ); 75 75 $this->assertSame( 'do-the-dash', sanitize_title_with_dashes( 'Do the — Dash', '', 'save' ) ); … … 79 79 * @ticket 31790 80 80 */ 81 function test_replaces_ndash_mdash_entities() {81 public function test_replaces_ndash_mdash_entities() { 82 82 $this->assertSame( 'do-the-dash', sanitize_title_with_dashes( 'Do – the – Dash', '', 'save' ) ); 83 83 $this->assertSame( 'do-the-dash', sanitize_title_with_dashes( 'Do — the — Dash', '', 'save' ) ); 84 84 } 85 85 86 function test_replaces_iexcel_iquest() {86 public function test_replaces_iexcel_iquest() { 87 87 $this->assertSame( 'just-a-slug', sanitize_title_with_dashes( 'Just ¡a Slug', '', 'save' ) ); 88 88 $this->assertSame( 'just-a-slug', sanitize_title_with_dashes( 'Just a Slug¿', '', 'save' ) ); 89 89 } 90 90 91 function test_replaces_angle_quotes() {91 public function test_replaces_angle_quotes() { 92 92 $this->assertSame( 'just-a-slug', sanitize_title_with_dashes( '‹Just a Slug›', '', 'save' ) ); 93 93 $this->assertSame( 'just-a-slug', sanitize_title_with_dashes( '«Just a Slug»', '', 'save' ) ); 94 94 } 95 95 96 function test_replaces_curly_quotes() {96 public function test_replaces_curly_quotes() { 97 97 $this->assertSame( 'hey-its-curly-joe', sanitize_title_with_dashes( 'Hey its “Curly Joe”', '', 'save' ) ); 98 98 $this->assertSame( 'hey-its-curly-joe', sanitize_title_with_dashes( 'Hey its ‘Curly Joe’', '', 'save' ) ); … … 105 105 * @ticket 49791 106 106 */ 107 function test_replaces_bullet() {107 public function test_replaces_bullet() { 108 108 $this->assertSame( 'fancy-title-amazing', sanitize_title_with_dashes( 'Fancy Title • Amazing', '', 'save' ) ); 109 109 } 110 110 111 function test_replaces_copy_reg_deg_trade() {111 public function test_replaces_copy_reg_deg_trade() { 112 112 $this->assertSame( 'just-a-slug', sanitize_title_with_dashes( 'Just © a Slug', '', 'save' ) ); 113 113 $this->assertSame( 'just-a-slug', sanitize_title_with_dashes( '® Just a Slug', '', 'save' ) ); … … 119 119 * @ticket 10792 120 120 */ 121 function test_replaces_forward_slash() {121 public function test_replaces_forward_slash() { 122 122 $this->assertSame( 'songs-by-lennon-mccartney', sanitize_title_with_dashes( 'songs by Lennon/McCartney', '', 'save' ) ); 123 123 $this->assertSame( 'songs-by-lennon-mccartney', sanitize_title_with_dashes( 'songs by Lennon//McCartney', '', 'save' ) ); … … 130 130 * @ticket 19820 131 131 */ 132 function test_replaces_multiply_sign() {132 public function test_replaces_multiply_sign() { 133 133 $this->assertSame( '6x7-is-42', sanitize_title_with_dashes( '6×7 is 42', '', 'save' ) ); 134 134 } … … 137 137 * @ticket 20772 138 138 */ 139 function test_replaces_standalone_diacritic() {139 public function test_replaces_standalone_diacritic() { 140 140 $this->assertSame( 'aaaa', sanitize_title_with_dashes( 'āáǎà', '', 'save' ) ); 141 141 } … … 144 144 * @ticket 22395 145 145 */ 146 function test_replaces_acute_accents() {146 public function test_replaces_acute_accents() { 147 147 $this->assertSame( 'aaaa', sanitize_title_with_dashes( 'ááa´aˊ', '', 'save' ) ); 148 148 }
Note: See TracChangeset
for help on using the changeset viewer.