public
Created

WordPress international tags tests

  • Download Gist
gistfile1.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
<?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 );
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.