WordPress.org

Make WordPress Core

Ticket #10797: 10797.tests.patch

File 10797.tests.patch, 2.2 KB (added by ampt, 3 years ago)

unit tests

  • wp-testcase/test_includes_formatting.php

     
    892892        function test_handles_non_entity_ampersands() { 
    893893                $this->assertEquals("penn-teller-bull", sanitize_title_with_dashes("penn & teller bull")); 
    894894        } 
     895 
     896        function test_strips_entities() { 
     897                $this->assertEquals("no-entities-here", sanitize_title_with_dashes("No   Entities – Here &")); 
     898        } 
     899 
     900        function test_replaces_nbsp() { 
     901                $this->assertEquals("dont-break-the-space", sanitize_title_with_dashes("don't break the space", '', 'save')); 
     902        } 
     903 
     904        function test_replaces_ndash_mdash() { 
     905                $this->assertEquals("do-the-dash", sanitize_title_with_dashes("Do – the Dash", '', 'save')); 
     906                $this->assertEquals("do-the-dash", sanitize_title_with_dashes("Do the — Dash", '', 'save')); 
     907        } 
     908 
     909        function test_replaces_iexcel_iquest() { 
     910                $this->assertEquals("just-a-slug", sanitize_title_with_dashes("Just ¡a Slug", '', 'save')); 
     911                $this->assertEquals("just-a-slug", sanitize_title_with_dashes("Just a Slug¿", '', 'save')); 
     912        } 
     913 
     914        function test_replaces_angle_quotes() { 
     915                $this->assertEquals("just-a-slug", sanitize_title_with_dashes("‹Just a Slug›", '', 'save')); 
     916                $this->assertEquals("just-a-slug", sanitize_title_with_dashes("«Just a Slug»", '', 'save')); 
     917        } 
     918 
     919        function test_replaces_curly_quotes() { 
     920                $this->assertEquals("hey-its-curly-joe", sanitize_title_with_dashes("Hey its “Curly Joe”", '', 'save')); 
     921                $this->assertEquals("hey-its-curly-joe", sanitize_title_with_dashes("Hey its ‘Curly Joe’", '', 'save')); 
     922        } 
     923 
     924        function test_replaces_copy_reg_deg_trade() { 
     925                $this->assertEquals("just-a-slug", sanitize_title_with_dashes("Just © a Slug", '', 'save')); 
     926                $this->assertEquals("just-a-slug", sanitize_title_with_dashes("® Just a Slug", '', 'save')); 
     927                $this->assertEquals("just-a-slug", sanitize_title_with_dashes("Just a ° Slug", '', 'save')); 
     928                $this->assertEquals("just-a-slug", sanitize_title_with_dashes("Just ™ a Slug", '', 'save')); 
     929        } 
    895930} 
    896931 
    897932class TestConvertChars extends WPTestCase {