- Timestamp:
- 09/02/2020 12:35:36 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php
r48593 r48937 8 8 $input = 'Captain <strong>Awesome</strong>'; 9 9 $expected = 'captain-awesome'; 10 $this->assert Equals( $expected, sanitize_title( $input ) );10 $this->assertSame( $expected, sanitize_title( $input ) ); 11 11 } 12 12 13 13 function test_strips_unencoded_percent_signs() { 14 $this->assert Equals( 'fran%c3%a7ois', sanitize_title_with_dashes( 'fran%c3%a7%ois' ) );14 $this->assertSame( 'fran%c3%a7ois', sanitize_title_with_dashes( 'fran%c3%a7%ois' ) ); 15 15 } 16 16 17 17 function test_makes_title_lowercase() { 18 $this->assert Equals( 'abc', sanitize_title_with_dashes( 'ABC' ) );18 $this->assertSame( 'abc', sanitize_title_with_dashes( 'ABC' ) ); 19 19 } 20 20 21 21 function test_replaces_any_amount_of_whitespace_with_one_hyphen() { 22 $this->assert Equals( 'a-t', sanitize_title_with_dashes( 'a t' ) );23 $this->assert Equals( 'a-t', sanitize_title_with_dashes( "a \n\n\nt" ) );22 $this->assertSame( 'a-t', sanitize_title_with_dashes( 'a t' ) ); 23 $this->assertSame( 'a-t', sanitize_title_with_dashes( "a \n\n\nt" ) ); 24 24 } 25 25 26 26 function test_replaces_any_number_of_hyphens_with_one_hyphen() { 27 $this->assert Equals( 'a-t-t', sanitize_title_with_dashes( 'a----t----t' ) );27 $this->assertSame( 'a-t-t', sanitize_title_with_dashes( 'a----t----t' ) ); 28 28 } 29 29 30 30 function test_trims_trailing_hyphens() { 31 $this->assert Equals( 'a-t-t', sanitize_title_with_dashes( 'a----t----t----' ) );31 $this->assertSame( 'a-t-t', sanitize_title_with_dashes( 'a----t----t----' ) ); 32 32 } 33 33 34 34 function test_handles_non_entity_ampersands() { 35 $this->assert Equals( 'penn-teller-bull', sanitize_title_with_dashes( 'penn & teller bull' ) );35 $this->assertSame( 'penn-teller-bull', sanitize_title_with_dashes( 'penn & teller bull' ) ); 36 36 } 37 37 38 38 public function test_strips_nbsp_ndash_and_amp() { 39 $this->assert Equals( 'no-entities-here', sanitize_title_with_dashes( 'No Entities – Here &' ) );39 $this->assertSame( 'no-entities-here', sanitize_title_with_dashes( 'No Entities – Here &' ) ); 40 40 } 41 41 42 42 public function test_strips_encoded_ampersand() { 43 $this->assert Equals( 'one-two', sanitize_title_with_dashes( 'One & Two', '', 'save' ) );43 $this->assertSame( 'one-two', sanitize_title_with_dashes( 'One & Two', '', 'save' ) ); 44 44 } 45 45 46 46 public function test_strips_url_encoded_ampersand() { 47 $this->assert Equals( 'one-two', sanitize_title_with_dashes( 'One { Two;', '', 'save' ) );47 $this->assertSame( 'one-two', sanitize_title_with_dashes( 'One { Two;', '', 'save' ) ); 48 48 } 49 49 50 50 public function test_strips_trademark_symbol() { 51 $this->assert Equals( 'one-two', sanitize_title_with_dashes( 'One Two™;', '', 'save' ) );51 $this->assertSame( 'one-two', sanitize_title_with_dashes( 'One Two™;', '', 'save' ) ); 52 52 } 53 53 54 54 public function test_strips_unencoded_ampersand_followed_by_encoded_ampersand() { 55 $this->assert Equals( 'one-two', sanitize_title_with_dashes( 'One && Two;', '', 'save' ) );55 $this->assertSame( 'one-two', sanitize_title_with_dashes( 'One && Two;', '', 'save' ) ); 56 56 } 57 57 58 58 public function test_strips_unencoded_ampersand_when_not_surrounded_by_spaces() { 59 $this->assert Equals( 'onetwo', sanitize_title_with_dashes( 'One&Two', '', 'save' ) );59 $this->assertSame( 'onetwo', sanitize_title_with_dashes( 'One&Two', '', 'save' ) ); 60 60 } 61 61 62 62 function test_replaces_nbsp() { 63 $this->assert Equals( 'dont-break-the-space', sanitize_title_with_dashes( "don't break the space", '', 'save' ) );63 $this->assertSame( 'dont-break-the-space', sanitize_title_with_dashes( "don't break the space", '', 'save' ) ); 64 64 } 65 65 … … 68 68 */ 69 69 function test_replaces_nbsp_entities() { 70 $this->assert Equals( 'dont-break-the-space', sanitize_title_with_dashes( "don't break the space", '', 'save' ) );70 $this->assertSame( 'dont-break-the-space', sanitize_title_with_dashes( "don't break the space", '', 'save' ) ); 71 71 } 72 72 73 73 function test_replaces_ndash_mdash() { 74 $this->assert Equals( 'do-the-dash', sanitize_title_with_dashes( 'Do – the Dash', '', 'save' ) );75 $this->assert Equals( 'do-the-dash', sanitize_title_with_dashes( 'Do the — Dash', '', 'save' ) );74 $this->assertSame( 'do-the-dash', sanitize_title_with_dashes( 'Do – the Dash', '', 'save' ) ); 75 $this->assertSame( 'do-the-dash', sanitize_title_with_dashes( 'Do the — Dash', '', 'save' ) ); 76 76 } 77 77 … … 80 80 */ 81 81 function test_replaces_ndash_mdash_entities() { 82 $this->assert Equals( 'do-the-dash', sanitize_title_with_dashes( 'Do – the – Dash', '', 'save' ) );83 $this->assert Equals( 'do-the-dash', sanitize_title_with_dashes( 'Do — the — Dash', '', 'save' ) );82 $this->assertSame( 'do-the-dash', sanitize_title_with_dashes( 'Do – the – Dash', '', 'save' ) ); 83 $this->assertSame( 'do-the-dash', sanitize_title_with_dashes( 'Do — the — Dash', '', 'save' ) ); 84 84 } 85 85 86 86 function test_replaces_iexcel_iquest() { 87 $this->assert Equals( 'just-a-slug', sanitize_title_with_dashes( 'Just ¡a Slug', '', 'save' ) );88 $this->assert Equals( 'just-a-slug', sanitize_title_with_dashes( 'Just a Slug¿', '', 'save' ) );87 $this->assertSame( 'just-a-slug', sanitize_title_with_dashes( 'Just ¡a Slug', '', 'save' ) ); 88 $this->assertSame( 'just-a-slug', sanitize_title_with_dashes( 'Just a Slug¿', '', 'save' ) ); 89 89 } 90 90 91 91 function test_replaces_angle_quotes() { 92 $this->assert Equals( 'just-a-slug', sanitize_title_with_dashes( '‹Just a Slug›', '', 'save' ) );93 $this->assert Equals( 'just-a-slug', sanitize_title_with_dashes( '«Just a Slug»', '', 'save' ) );92 $this->assertSame( 'just-a-slug', sanitize_title_with_dashes( '‹Just a Slug›', '', 'save' ) ); 93 $this->assertSame( 'just-a-slug', sanitize_title_with_dashes( '«Just a Slug»', '', 'save' ) ); 94 94 } 95 95 96 96 function test_replaces_curly_quotes() { 97 $this->assert Equals( 'hey-its-curly-joe', sanitize_title_with_dashes( 'Hey its “Curly Joe”', '', 'save' ) );98 $this->assert Equals( 'hey-its-curly-joe', sanitize_title_with_dashes( 'Hey its ‘Curly Joe’', '', 'save' ) );99 $this->assert Equals( 'hey-its-curly-joe', sanitize_title_with_dashes( 'Hey its „Curly Joe“', '', 'save' ) );100 $this->assert Equals( 'hey-its-curly-joe', sanitize_title_with_dashes( 'Hey its ‚Curly Joe‛', '', 'save' ) );101 $this->assert Equals( 'hey-its-curly-joe', sanitize_title_with_dashes( 'Hey its „Curly Joe‟', '', 'save' ) );97 $this->assertSame( 'hey-its-curly-joe', sanitize_title_with_dashes( 'Hey its “Curly Joe”', '', 'save' ) ); 98 $this->assertSame( 'hey-its-curly-joe', sanitize_title_with_dashes( 'Hey its ‘Curly Joe’', '', 'save' ) ); 99 $this->assertSame( 'hey-its-curly-joe', sanitize_title_with_dashes( 'Hey its „Curly Joe“', '', 'save' ) ); 100 $this->assertSame( 'hey-its-curly-joe', sanitize_title_with_dashes( 'Hey its ‚Curly Joe‛', '', 'save' ) ); 101 $this->assertSame( 'hey-its-curly-joe', sanitize_title_with_dashes( 'Hey its „Curly Joe‟', '', 'save' ) ); 102 102 } 103 103 … … 106 106 */ 107 107 function test_replaces_bullet() { 108 $this->assert Equals( 'fancy-title-amazing', sanitize_title_with_dashes( 'Fancy Title • Amazing', '', 'save' ) );108 $this->assertSame( 'fancy-title-amazing', sanitize_title_with_dashes( 'Fancy Title • Amazing', '', 'save' ) ); 109 109 } 110 110 111 111 function test_replaces_copy_reg_deg_trade() { 112 $this->assert Equals( 'just-a-slug', sanitize_title_with_dashes( 'Just © a Slug', '', 'save' ) );113 $this->assert Equals( 'just-a-slug', sanitize_title_with_dashes( '® Just a Slug', '', 'save' ) );114 $this->assert Equals( 'just-a-slug', sanitize_title_with_dashes( 'Just a ° Slug', '', 'save' ) );115 $this->assert Equals( 'just-a-slug', sanitize_title_with_dashes( 'Just ™ a Slug', '', 'save' ) );112 $this->assertSame( 'just-a-slug', sanitize_title_with_dashes( 'Just © a Slug', '', 'save' ) ); 113 $this->assertSame( 'just-a-slug', sanitize_title_with_dashes( '® Just a Slug', '', 'save' ) ); 114 $this->assertSame( 'just-a-slug', sanitize_title_with_dashes( 'Just a ° Slug', '', 'save' ) ); 115 $this->assertSame( 'just-a-slug', sanitize_title_with_dashes( 'Just ™ a Slug', '', 'save' ) ); 116 116 } 117 117 … … 120 120 */ 121 121 function test_replaces_forward_slash() { 122 $this->assert Equals( 'songs-by-lennon-mccartney', sanitize_title_with_dashes( 'songs by Lennon/McCartney', '', 'save' ) );123 $this->assert Equals( 'songs-by-lennon-mccartney', sanitize_title_with_dashes( 'songs by Lennon//McCartney', '', 'save' ) );124 $this->assert Equals( 'songs-by-lennon-mccartney', sanitize_title_with_dashes( 'songs by Lennon///McCartney', '', 'save' ) );125 $this->assert Equals( 'songs-by-lennon-mccartney', sanitize_title_with_dashes( 'songs by Lennon/-McCartney', '', 'save' ) );126 $this->assert Equals( 'songs-by-lennon-mccartney', sanitize_title_with_dashes( '//songs by Lennon/McCartney', '', 'save' ) );122 $this->assertSame( 'songs-by-lennon-mccartney', sanitize_title_with_dashes( 'songs by Lennon/McCartney', '', 'save' ) ); 123 $this->assertSame( 'songs-by-lennon-mccartney', sanitize_title_with_dashes( 'songs by Lennon//McCartney', '', 'save' ) ); 124 $this->assertSame( 'songs-by-lennon-mccartney', sanitize_title_with_dashes( 'songs by Lennon///McCartney', '', 'save' ) ); 125 $this->assertSame( 'songs-by-lennon-mccartney', sanitize_title_with_dashes( 'songs by Lennon/-McCartney', '', 'save' ) ); 126 $this->assertSame( 'songs-by-lennon-mccartney', sanitize_title_with_dashes( '//songs by Lennon/McCartney', '', 'save' ) ); 127 127 } 128 128 … … 131 131 */ 132 132 function test_replaces_multiply_sign() { 133 $this->assert Equals( '6x7-is-42', sanitize_title_with_dashes( '6×7 is 42', '', 'save' ) );133 $this->assertSame( '6x7-is-42', sanitize_title_with_dashes( '6×7 is 42', '', 'save' ) ); 134 134 } 135 135 … … 138 138 */ 139 139 function test_replaces_standalone_diacritic() { 140 $this->assert Equals( 'aaaa', sanitize_title_with_dashes( 'āáǎà', '', 'save' ) );140 $this->assertSame( 'aaaa', sanitize_title_with_dashes( 'āáǎà', '', 'save' ) ); 141 141 } 142 142 … … 145 145 */ 146 146 function test_replaces_acute_accents() { 147 $this->assert Equals( 'aaaa', sanitize_title_with_dashes( 'ááa´aˊ', '', 'save' ) );147 $this->assertSame( 'aaaa', sanitize_title_with_dashes( 'ááa´aˊ', '', 'save' ) ); 148 148 } 149 149
Note: See TracChangeset
for help on using the changeset viewer.