diff --git a/tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php b/tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php index 53931bd173..80be9414c5 100644 --- a/tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php +++ b/tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php @@ -35,18 +35,28 @@ class Tests_Formatting_SanitizeTitleWithDashes extends WP_UnitTestCase { $this->assertEquals("penn-teller-bull", sanitize_title_with_dashes("penn & teller bull")); } - /** - * @ticket 10823 - */ - function test_strips_entities() { + public function test_strips_nbsp_ndash_and_amp() { $this->assertEquals("no-entities-here", sanitize_title_with_dashes("No   Entities – Here &")); + } + + public function test_strips_encoded_ampersand() { $this->assertEquals("one-two", sanitize_title_with_dashes("One & Two", '', 'save')); + } + + public function test_strips_url_encoded_ampersand() { $this->assertEquals("one-two", sanitize_title_with_dashes("One { Two;", '', 'save')); - $this->assertEquals("one-two", sanitize_title_with_dashes("One & Two;", '', 'save')); + } + + public function test_strips_trademark_symbol() { $this->assertEquals("one-two", sanitize_title_with_dashes("One Two™;", '', 'save')); + } + + public function test_strips_unencoded_ampersand_followed_by_encoded_ampersand() { $this->assertEquals("one-two", sanitize_title_with_dashes("One && Two;", '', 'save')); + } + + public function test_strips_unencoded_ampersand_when_not_surrounded_by_spaces() { $this->assertEquals("onetwo", sanitize_title_with_dashes("One&Two", '', 'save')); - $this->assertEquals("onetwo-test", sanitize_title_with_dashes("One&Two Test;", '', 'save')); } function test_replaces_nbsp() { diff --git a/tests/phpunit/tests/formatting/SanitizeUser.php b/tests/phpunit/tests/formatting/SanitizeUser.php index 3f7f03b34a..5087df7bf0 100644 --- a/tests/phpunit/tests/formatting/SanitizeUser.php +++ b/tests/phpunit/tests/formatting/SanitizeUser.php @@ -9,14 +9,15 @@ class Tests_Formatting_SanitizeUser extends WP_UnitTestCase { $expected = is_multisite() ? 'captain awesome' : 'Captain Awesome'; $this->assertEquals($expected, sanitize_user($input)); } - /** - * @ticket 10823 - */ - function test_strips_entities() { + + public function test_strips_encoded_ampersand() { $this->assertEquals("ATT", sanitize_user("AT&T")); - $this->assertEquals("ATT Test;", sanitize_user("AT&T Test;")); - $this->assertEquals("AT&T Test;", sanitize_user("AT&T Test;")); } + + public function test_strips_encoded_ampersand_when_followed_by_semicolon() { + $this->assertEquals("ATT Test;", sanitize_user("AT&T Test;")); + } + function test_strips_percent_encoded_octets() { $expected = is_multisite() ? 'franois' : 'Franois'; $this->assertEquals( $expected, sanitize_user( "Fran%c3%a7ois" ) );