mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
Tests: Include special characters in term names for wp_set_term_objects().
Test `wp_set_term_objects()` using terms with special characters in the name, for example ampersand, bullet and other symbols and punctuation. Props kapacity, costdev. Fixes #53152. See #54725. git-svn-id: https://develop.svn.wordpress.org/trunk@52938 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -252,6 +252,51 @@ class Tests_Term extends WP_UnitTestCase {
|
||||
$this->assertSame( 0, sanitize_term_field( 'parent', '', $term['term_id'], $this->taxonomy, 'raw' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 53152
|
||||
* @dataProvider data_wp_set_term_objects_finds_term_name_with_special_characters
|
||||
*
|
||||
* @param string $name A term name containing special characters.
|
||||
*/
|
||||
public function test_wp_set_term_objects_finds_term_name_with_special_characters( $name ) {
|
||||
$post_id = self::$post_ids[0];
|
||||
$expected = wp_set_object_terms( $post_id, $name, 'category', false );
|
||||
$actual = wp_set_object_terms( $post_id, $name, 'category', false );
|
||||
$this->assertEquals( $expected, $actual );
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function data_wp_set_term_objects_finds_term_name_with_special_characters() {
|
||||
return array(
|
||||
'ampersand' => array( 'name' => 'Foo & Bar' ),
|
||||
'ndash and mdash' => array( 'name' => 'Foo – Bar' ),
|
||||
'trademark' => array( 'name' => 'Foo Bar™' ),
|
||||
'copyright' => array( 'name' => 'Foo Bar©' ),
|
||||
'registered' => array( 'name' => 'Foo Bar®' ),
|
||||
'degree' => array( 'name' => 'Foo ° Bar' ),
|
||||
'forward slash' => array( 'name' => 'Fo/o Ba/r' ),
|
||||
'back slash' => array( 'name' => 'F\oo \Bar' ),
|
||||
'multiply' => array( 'name' => 'Foo × Bar' ),
|
||||
'standalone diacritic' => array( 'name' => 'Foo Bāáǎàr' ),
|
||||
'acute accents' => array( 'name' => 'ááa´aˊ' ),
|
||||
'iexcel and iquest' => array( 'name' => '¡Foo ¿Bar' ),
|
||||
'angle quotes' => array( 'name' => '‹Foo« »Bar›' ),
|
||||
'curly quotes' => array( 'name' => '“F‘o„o‚ „ ‟ ‛B“a’r”' ),
|
||||
'bullet' => array( 'name' => 'Foo • Bar' ),
|
||||
'unencoded percent' => array( 'name' => 'Foo % Bar' ),
|
||||
'encoded ampersand' => array( 'name' => 'Foo & Bar' ),
|
||||
'encoded ndash and mdash' => array( 'name' => 'Foo — – Bar' ),
|
||||
'encoded trademark' => array( 'name' => 'Foo Bar ™' ),
|
||||
'encoded copyright' => array( 'name' => 'Foo Bar ©' ),
|
||||
'encoded registered' => array( 'name' => 'Foo Bar ®' ),
|
||||
'encoded bullet' => array( 'name' => 'Foo • Bar' ),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 19205
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user