Created
October 27, 2012 11:22
-
-
Save rickard2/3964335 to your computer and use it in GitHub Desktop.
WordPress international tags tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Tests_Term_Intl extends WP_UnitTestCase { | |
function test_one_char_terms() { | |
$post = array( | |
'post_content' => 'test', | |
'post_status' => 'publish', | |
'post_title' => 'test', | |
'post_type' => 'post', | |
'tags_input' => 'å,ä,ö', | |
); | |
$post_id = wp_insert_post( $post ); | |
$term_names = wp_get_post_terms( $post_id, 'post_tag', array( 'fields' => 'names' ) ); | |
$this->assertContains( 'å', $term_names ); | |
$this->assertContains( 'ä', $term_names ); | |
$this->assertContains( 'ö', $term_names ); | |
} | |
function test_terms_with_non_intl_counterparts() { | |
$post = array( | |
'post_content' => 'test', | |
'post_status' => 'publish', | |
'post_title' => 'test', | |
'post_type' => 'post', | |
'tags_input' => 'for,för,får,far', | |
); | |
$post_id = wp_insert_post( $post ); | |
$term_names = wp_get_post_terms( $post_id, 'post_tag', array( 'fields' => 'names' ) ); | |
$this->assertContains( 'for', $term_names ); | |
$this->assertContains( 'för', $term_names ); | |
$this->assertContains( 'får', $term_names ); | |
$this->assertContains( 'far', $term_names ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment