Make WordPress Core

Ticket #10823: 10823-unittests.diff

File 10823-unittests.diff, 1.8 KB (added by boonebgorges, 10 years ago)

See #30284.

  • tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php

    diff --git tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php
    index 80be941..222e25f 100644
    class Tests_Formatting_SanitizeTitleWithDashes extends WP_UnitTestCase { 
    5959                $this->assertEquals("onetwo", sanitize_title_with_dashes("One&Two", '', 'save'));
    6060        }
    6161
     62        /**
     63         * @ticket 10823
     64         */
     65        public function test_strips_unencoded_ampersand_when_followed_by_semicolon() {
     66                $this->assertEquals("one-two", sanitize_title_with_dashes("One & Two;", '', 'save'));
     67        }
     68
     69        /**
     70         * @ticket 10823
     71         */
     72        public function test_strips_unencoded_ampersand_when_not_surrounded_by_spaces_and_followed_by_semicolon() {
     73                $this->assertEquals("onetwo-test", sanitize_title_with_dashes("One&Two Test;", '', 'save'));
     74        }
     75
     76
    6277        function test_replaces_nbsp() {
    6378                $this->assertEquals("dont-break-the-space", sanitize_title_with_dashes("don't break the space", '', 'save'));
    6479        }
  • tests/phpunit/tests/formatting/SanitizeUser.php

    diff --git tests/phpunit/tests/formatting/SanitizeUser.php tests/phpunit/tests/formatting/SanitizeUser.php
    index 5087df7..bf2cca2 100644
    class Tests_Formatting_SanitizeUser extends WP_UnitTestCase { 
    1818                $this->assertEquals("ATT Test;", sanitize_user("AT&T Test;"));
    1919        }
    2020
     21        /**
     22         * @ticket 10823
     23         */
     24        public function test_strips_unencoded_ampersand_when_followed_by_semicolon() {
     25                $this->assertEquals("AT&T Test;", sanitize_user("AT&T Test;"));
     26        }
     27
    2128        function test_strips_percent_encoded_octets() {
    2229                $expected = is_multisite() ? 'franois' : 'Franois';
    2330                $this->assertEquals( $expected, sanitize_user( "Fran%c3%a7ois" ) );