| | 502 | * @ticket 29573 |
| | 503 | */ |
| | 504 | function test_get_sample_permalink_html_with_non_latin_slugs() { |
| | 505 | $inputs = array( |
| | 506 | 'Αρνάκι άσπρο και παχύ της μάνας του καμάρι, και άλλα τραγούδια', |
| | 507 | 'Предлагаем супер металлообрабатывающее оборудование', |
| | 508 | 'בניית אתרי וורדפרס', |
| | 509 | ); |
| | 510 | |
| | 511 | $outputs_mbstring_enabled = array( |
| | 512 | 'αρνάκι-άσπρο-κ…-μάνας-του-καμ', |
| | 513 | 'предлагаем-суп…ллообрабатываю', |
| | 514 | 'בניית-אתרי-וורדפרס', |
| | 515 | ); |
| | 516 | |
| | 517 | $outputs_mbstring_disabled = array( |
| | 518 | 'αρνάκι-άσπρο-και-παχύ-της-μάνας-του-καμ', |
| | 519 | 'предлагаем-супер-металлообрабатываю', |
| | 520 | 'בניית-אתרי-וורדפרס', |
| | 521 | ); |
| | 522 | |
| | 523 | $old_permastruct = get_option( 'permalink_structure' ); |
| | 524 | update_option( 'permalink_structure', '/%postname%/' ); |
| | 525 | |
| | 526 | foreach ( $inputs as $k => $post_title ) { |
| | 527 | $post = array( |
| | 528 | 'post_author' => $this->author_id, |
| | 529 | 'post_status' => 'publish', |
| | 530 | 'post_content' => rand_str(), |
| | 531 | 'post_title' => $post_title, |
| | 532 | ); |
| | 533 | |
| | 534 | $id = $this->post_ids[] = wp_insert_post( $post ); |
| | 535 | $sample_permalink_html = get_sample_permalink_html( $id ); |
| | 536 | preg_match( '#<span id="editable-post-name".*?>(.+?)</span>#', $sample_permalink_html, $matches ); |
| | 537 | |
| | 538 | if ( function_exists( 'mb_strlen' ) ) { |
| | 539 | $this->assertEquals( $outputs_mbstring_enabled[ $k ], $matches[1] ); |
| | 540 | } else { |
| | 541 | $this->assertEquals( $outputs_mbstring_disabled[ $k ], $matches[1] ); |
| | 542 | } |
| | 543 | } |
| | 544 | |
| | 545 | update_option( 'permalink_structure', $old_permastruct ); |
| | 546 | } |
| | 547 | |
| | 548 | /** |