WordPress.org

Make WordPress Core

Changeset 438 in tests


Ignore:
Timestamp:
09/18/2011 07:43:57 PM (9 years ago)
Author:
nacin
Message:

Add sanitize_title_with_dashes tests for various punctuation now stripped on context save. props ampt, see #WP10797.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_includes_formatting.php

    r427 r438  
    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
Note: See TracChangeset for help on using the changeset viewer.