Ticket #42096: 42096_tests.patch
File 42096_tests.patch, 2.1 KB (added by , 7 years ago) |
---|
-
tests/phpunit/tests/term/query.php
528 528 529 529 $this->assertEqualSets( array( $term_1, $term_1 ), wp_list_pluck( $q->terms, 'term_id' ) ); 530 530 } 531 532 /** 533 * @ticket 42096 534 */ 535 public function test_term_query_by_slug_should_support_slugs_created_pre_3_3() { 536 global $wpdb; 537 538 // pre-3.3 supported slug 539 $slug = 'foo-%c3%a5-bar-%e2%80%9cquoted-text%e2%80%9d'; 540 541 register_taxonomy( 'wptests_tax', 'post' ); 542 543 // Manually add term with example name and slug with pre-3.3 supported values 544 $wpdb->insert( $wpdb->terms, array( 545 'term_id' => 42096, 546 'name' => 'foo--bar-quoted-text', 547 'slug' => $slug, 548 ) ); 549 550 $wpdb->insert( $wpdb->term_taxonomy, array( 551 'term_id' => 42096, 552 'taxonomy' => 'wptests_tax', 553 ) ); 554 555 $q = new WP_Term_Query( array( 556 'taxonomy' => 'wptests_tax', 557 'slug' => $slug, 558 'hide_empty' => false, 559 'fields' => 'ids', 560 ) ); 561 562 $this->assertEquals( array( 42096 ), $q->terms ); 563 } 531 564 } -
tests/phpunit/tests/query/taxQuery.php
1409 1409 1410 1410 $this->assertEqualSets( array( $p ), $q->posts ); 1411 1411 } 1412 1413 /** 1414 * @ticket 42096 1415 */ 1416 public function test_query_by_tag_slug_should_support_slugs_created_pre_3_3() { 1417 global $wpdb; 1418 1419 // pre-3.3 supported slug 1420 $slug = 'foo-%c3%a5-bar-%e2%80%9cquoted-text%e2%80%9d'; 1421 1422 $wpdb->insert( $wpdb->terms, array( 1423 'term_id' => 42096, 1424 'name' => 'foo--bar-quoted-text', 1425 'slug' => $slug, 1426 ) ); 1427 1428 $wpdb->insert( $wpdb->term_taxonomy, array( 1429 'term_id' => 42096, 1430 'taxonomy' => 'post_tag', 1431 ) ); 1432 1433 $p = self::factory()->post->create(); 1434 wp_set_object_terms( $p, array( 42096 ), 'post_tag' ); 1435 1436 $q = new WP_Query( array( 1437 'fields' => 'ids', 1438 'tag' => $slug, 1439 ) ); 1440 1441 $this->assertEquals( array( $p ), $q->posts ); 1442 } 1412 1443 }