Make WordPress Core

Ticket #5809: 5809.6.patch

File 5809.6.patch, 18.1 KB (added by boonebgorges, 9 years ago)

Refreshed for 4.2.0. Introduces wp_get_split_terms(), which can be used to retrieve stored data about previously split terms.

  • src/wp-includes/default-filters.php

    diff --git src/wp-includes/default-filters.php src/wp-includes/default-filters.php
    index 21419f2..c28594f 100644
    add_filter( 'authenticate', 'wp_authenticate_spam_check', 99 ); 
    306306add_filter( 'determine_current_user', 'wp_validate_auth_cookie'          );
    307307add_filter( 'determine_current_user', 'wp_validate_logged_in_cookie', 20 );
    308308
     309// Split term updates.
     310add_action( 'split_shared_term', '_wp_check_split_default_terms',  10, 4 );
     311add_action( 'split_shared_term', '_wp_check_split_terms_in_menus', 10, 4 );
     312
    309313/**
    310314 * Filters formerly mixed into wp-includes
    311315 */
  • src/wp-includes/taxonomy.php

    diff --git src/wp-includes/taxonomy.php src/wp-includes/taxonomy.php
    index 991f595..38d0fe7 100644
    function wp_update_term( $term_id, $taxonomy, $args = array() ) { 
    33763376
    33773377        $tt_id = $wpdb->get_var( $wpdb->prepare( "SELECT tt.term_taxonomy_id FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = %s AND t.term_id = %d", $taxonomy, $term_id) );
    33783378
     3379        // Check whether this is a shared term that needs splitting.
     3380        $_term_id = _split_shared_term( $term_id, $tt_id );
     3381        if ( ! is_wp_error( $_term_id ) ) {
     3382                $term_id = $_term_id;
     3383        }
     3384
    33793385        /**
    33803386         * Fires immediately before the given terms are edited.
    33813387         *
    function _update_generic_term_count( $terms, $taxonomy ) { 
    40164022}
    40174023
    40184024/**
     4025 * Create a new term for a term_taxonomy item that currently shares its term.
     4026 *
     4027 * @since 4.2.0
     4028 * @access private
     4029 *
     4030 * @param int   $term_id          ID of the shared term.
     4031 * @param int   $term_taxonomy_id ID of the term taxonomy item to receive a new term.
     4032 * @param array $shared_tts       Sibling term taxonomies, used for busting caches.
     4033 * @return int  Term ID.
     4034 */
     4035function _split_shared_term( $term_id, $term_taxonomy_id ) {
     4036        global $wpdb;
     4037
     4038        // Don't try to split terms if database schema does not support shared slugs.
     4039        $current_db_version = get_option( 'db_version' );
     4040        if ( $current_db_version < 30133 ) {
     4041                return $term_id;
     4042        }
     4043
     4044        // If there are no shared term_taxonomy rows, there's nothing to do here.
     4045        $shared_tt_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_taxonomy tt WHERE tt.term_id = %d AND tt.term_taxonomy_id != %d", $term_id, $term_taxonomy_id ) );
     4046        if ( ! $shared_tt_count ) {
     4047                return $term_id;
     4048        }
     4049
     4050        // Pull up data about the currently shared slug, which we'll use to populate the new one.
     4051        $shared_term = $wpdb->get_row( $wpdb->prepare( "SELECT t.* FROM $wpdb->terms t WHERE t.term_id = %d", $term_id ) );
     4052
     4053        $new_term_data = array(
     4054                'name' => $shared_term->name,
     4055                'slug' => $shared_term->slug,
     4056                'term_group' => $shared_term->term_group,
     4057        );
     4058
     4059        if ( false === $wpdb->insert( $wpdb->terms, $new_term_data ) ) {
     4060                return new WP_Error( 'db_insert_error', __( 'Could not split shared term.' ), $wpdb->last_error );
     4061        }
     4062
     4063        $new_term_id = (int) $wpdb->insert_id;
     4064
     4065        // Update the existing term_taxonomy to point to the newly created term.
     4066        $wpdb->update( $wpdb->term_taxonomy,
     4067                array( 'term_id' => $new_term_id ),
     4068                array( 'term_taxonomy_id' => $term_taxonomy_id )
     4069        );
     4070
     4071        // Reassign child terms to the new parent.
     4072        $term_taxonomy = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->term_taxonomy WHERE term_taxonomy_id = %d", $term_taxonomy_id ) );
     4073        $children_tt_ids = $wpdb->get_col( $wpdb->prepare( "SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE taxonomy = %s AND parent = %d", $term_taxonomy->taxonomy, $term_id ) );
     4074
     4075        if ( ! empty( $children_tt_ids ) ) {
     4076                foreach ( $children_tt_ids as $child_tt_id ) {
     4077                        $wpdb->update( $wpdb->term_taxonomy,
     4078                                array( 'parent' => $new_term_id ),
     4079                                array( 'term_taxonomy_id' => $child_tt_id )
     4080                        );
     4081                        clean_term_cache( $term_id, $term_taxonomy->taxonomy );
     4082                }
     4083        } else {
     4084                // If the term has no children, we must force its taxonomy cache to be rebuilt separately.
     4085                clean_term_cache( $new_term_id, $term_taxonomy->taxonomy );
     4086        }
     4087
     4088        // Clean the cache for term taxonomies formerly shared with the current term.
     4089        $shared_term_taxonomies = $wpdb->get_row( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d", $term_id ) );
     4090        foreach ( (array) $shared_term_taxonomies as $shared_term_taxonomy ) {
     4091                clean_term_cache( $term_id, $shared_term_taxonomy );
     4092        }
     4093
     4094        // Keep a record of term_ids that have been split, keyed by old term_id.
     4095        $split_term_data = get_option( '_split_terms', array() );
     4096        if ( ! isset( $split_term_data[ $term_id ] ) ) {
     4097                $split_term_data[ $term_id ] = array();
     4098        }
     4099
     4100        $split_term_data[ $term_id ][] = array(
     4101                'new_term_id'      => $new_term_id,
     4102                'term_taxonomy_id' => $term_taxonomy_id,
     4103                'taxonomy'         => $term_taxonomy->taxonomy,
     4104        );
     4105
     4106        update_option( '_split_terms', $split_term_data );
     4107
     4108        /**
     4109         * Fires after a previously shared taxonomy term is split into two separate terms.
     4110         *
     4111         * @since 4.2.0
     4112         *
     4113         * @param int    $term_id          ID of the formerly shared term.
     4114         * @param int    $new_term_id      ID of the new term created for the $term_taxonomy_id.
     4115         * @param int    $term_taxonomy_id ID for the term_taxonomy row affected by the split.
     4116         * @param string $taxonomy         Taxonomy for the split term.
     4117         */
     4118        do_action( 'split_shared_term', $term_id, $new_term_id, $term_taxonomy_id, $term_taxonomy->taxonomy );
     4119
     4120        return $new_term_id;
     4121}
     4122
     4123/**
     4124 * Check default categories when a term gets split to see if any of them need
     4125 * to be updated.
     4126 *
     4127 * @since 4.2.0
     4128 * @access private
     4129 *
     4130 * @param int    $term_id          ID of the formerly shared term.
     4131 * @param int    $new_term_id      ID of the new term created for the $term_taxonomy_id.
     4132 * @param int    $term_taxonomy_id ID for the term_taxonomy row affected by the split.
     4133 * @param string $taxonomy         Taxonomy for the split term.
     4134 */
     4135function _wp_check_split_default_terms( $term_id, $new_term_id, $term_taxonomy_id, $taxonomy ) {
     4136        if ( 'category' == $taxonomy ) {
     4137                foreach ( array( 'default_category', 'default_link_category', 'default_email_category' ) as $option ) {
     4138                        if ( $term_id == get_option( $option, -1 ) ) {
     4139                                update_option( $option, $new_term_id );
     4140                        }
     4141                }
     4142        }
     4143}
     4144
     4145/**
     4146 * Check menu items when a term gets split to see if any of them need to be
     4147 * updated.
     4148 *
     4149 * @since 4.2.0
     4150 * @access private
     4151 *
     4152 * @param int    $term_id          ID of the formerly shared term.
     4153 * @param int    $new_term_id      ID of the new term created for the $term_taxonomy_id.
     4154 * @param int    $term_taxonomy_id ID for the term_taxonomy row affected by the split.
     4155 * @param string $taxonomy         Taxonomy for the split term.
     4156 */
     4157function _wp_check_split_terms_in_menus( $term_id, $new_term_id, $term_taxonomy_id, $taxonomy ) {
     4158        global $wpdb;
     4159        $post_ids = $wpdb->get_col( $wpdb->prepare(
     4160                "SELECT m1.post_id
     4161                FROM {$wpdb->postmeta} AS m1
     4162                        INNER JOIN {$wpdb->postmeta} AS m2 ON m2.post_id=m1.post_id
     4163                        INNER JOIN {$wpdb->postmeta} AS m3 ON m3.post_id=m1.post_id
     4164                WHERE ( m1.meta_key = '_menu_item_type' AND m1.meta_value = 'taxonomy' )
     4165                        AND ( m2.meta_key = '_menu_item_object' AND m2.meta_value = '%s' )
     4166                        AND ( m3.meta_key = '_menu_item_object_id' AND m3.meta_value = %d )",
     4167                $taxonomy,
     4168                $term_id
     4169        ) );
     4170
     4171        if ( $post_ids ) {
     4172                foreach ( $post_ids as $post_id ) {
     4173                        update_post_meta( $post_id, '_menu_item_object_id', $new_term_id, $term_id );
     4174                }
     4175        }
     4176}
     4177
     4178/**
     4179 * Get data about a previously split taxonomy term.
     4180 *
     4181 * @since 4.2.0
     4182 *
     4183 * @param int $old_term_id Term ID. This is the old, pre-split term ID.
     4184 * @param string $taxonomy Optional. If provided, results will be limited to those matching the given taxonomy.
     4185 * @return array Array of data about matching terms that have been previously split. Each set of term data contains
     4186 *               the 'new_term_id', the 'term_taxonomy_id', and the 'taxonomy' of the split term.
     4187 */
     4188function wp_get_split_terms( $old_term_id, $taxonomy = '' ) {
     4189        $split_term_data = get_option( '_split_terms', array() );
     4190
     4191        $terms = array();
     4192        if ( isset( $split_term_data[ $old_term_id ] ) ) {
     4193                $terms = $split_term_data[ $old_term_id ];
     4194        }
     4195
     4196        if ( $taxonomy ) {
     4197                $terms = wp_list_filter( $terms, array( 'taxonomy' => $taxonomy ) );
     4198        }
     4199
     4200        return $terms;
     4201}
     4202
     4203/**
    40194204 * Generate a permalink for a taxonomy term archive.
    40204205 *
    40214206 * @since 2.5.0
  • tests/phpunit/tests/term.php

    diff --git tests/phpunit/tests/term.php tests/phpunit/tests/term.php
    index d717bf6..0237ac9 100644
    class Tests_Term extends WP_UnitTestCase { 
    760760                $this->assertSame( 'Bar', $t3_term->name );
    761761        }
    762762
     763        /**
     764         * @ticket 5809
     765         */
     766        public function test_wp_update_term_should_split_shared_term() {
     767                global $wpdb;
     768
     769                register_taxonomy( 'wptests_tax', 'post' );
     770                register_taxonomy( 'wptests_tax_2', 'post' );
     771
     772                $t1 = wp_insert_term( 'Foo', 'wptests_tax' );
     773                $t2 = wp_insert_term( 'Foo', 'wptests_tax_2' );
     774
     775                // Manually modify because split terms shouldn't naturally occur.
     776                $wpdb->update( $wpdb->term_taxonomy,
     777                        array( 'term_id' => $t1['term_id'] ),
     778                        array( 'term_taxonomy_id' => $t2['term_taxonomy_id'] ),
     779                        array( '%d' ),
     780                        array( '%d' )
     781                );
     782
     783                $posts = $this->factory->post->create_many( 2 );
     784                wp_set_object_terms( $posts[0], array( 'Foo' ), 'wptests_tax' );
     785                wp_set_object_terms( $posts[1], array( 'Foo' ), 'wptests_tax_2' );
     786
     787                // Verify that the terms are shared.
     788                $t1_terms = wp_get_object_terms( $posts[0], 'wptests_tax' );
     789                $t2_terms = wp_get_object_terms( $posts[1], 'wptests_tax_2' );
     790                $this->assertSame( $t1_terms[0]->term_id, $t2_terms[0]->term_id );
     791
     792                wp_update_term( $t2_terms[0]->term_id, 'wptests_tax_2', array(
     793                        'name' => 'New Foo',
     794                ) );
     795
     796                $t1_terms = wp_get_object_terms( $posts[0], 'wptests_tax' );
     797                $t2_terms = wp_get_object_terms( $posts[1], 'wptests_tax_2' );
     798                $this->assertNotEquals( $t1_terms[0]->term_id, $t2_terms[0]->term_id );
     799        }
     800
     801        /**
     802         * @ticket 5809
     803         */
     804        public function test_wp_update_term_should_not_split_shared_term_before_410_schema_change() {
     805                global $wpdb;
     806
     807                $db_version = get_option( 'db_version' );
     808                update_option( 'db_version', 30055 );
     809
     810                register_taxonomy( 'wptests_tax', 'post' );
     811                register_taxonomy( 'wptests_tax_2', 'post' );
     812
     813                $t1 = wp_insert_term( 'Foo', 'wptests_tax' );
     814                $t2 = wp_insert_term( 'Foo', 'wptests_tax_2' );
     815
     816                // Manually modify because split terms shouldn't naturally occur.
     817                $wpdb->update( $wpdb->term_taxonomy,
     818                        array( 'term_id' => $t1['term_id'] ),
     819                        array( 'term_taxonomy_id' => $t2['term_taxonomy_id'] ),
     820                        array( '%d' ),
     821                        array( '%d' )
     822                );
     823
     824                $posts = $this->factory->post->create_many( 2 );
     825                wp_set_object_terms( $posts[0], array( 'Foo' ), 'wptests_tax' );
     826                wp_set_object_terms( $posts[1], array( 'Foo' ), 'wptests_tax_2' );
     827
     828                // Verify that the term is shared.
     829                $t1_terms = wp_get_object_terms( $posts[0], 'wptests_tax' );
     830                $t2_terms = wp_get_object_terms( $posts[1], 'wptests_tax_2' );
     831                $this->assertSame( $t1_terms[0]->term_id, $t2_terms[0]->term_id );
     832
     833                wp_update_term( $t2_terms[0]->term_id, 'wptests_tax_2', array(
     834                        'name' => 'New Foo',
     835                ) );
     836
     837                // Term should still be shared.
     838                $t1_terms = wp_get_object_terms( $posts[0], 'wptests_tax' );
     839                $t2_terms = wp_get_object_terms( $posts[1], 'wptests_tax_2' );
     840                $this->assertSame( $t1_terms[0]->term_id, $t2_terms[0]->term_id );
     841
     842                update_option( 'db_version', $db_version );
     843        }
     844
    763845        public function test_wp_update_term_alias_of_no_term_group() {
    764846                register_taxonomy( 'wptests_tax', 'post' );
    765847                $t1 = $this->factory->term->create( array(
  • new file tests/phpunit/tests/term/splitSharedTerm.php

    diff --git tests/phpunit/tests/term/splitSharedTerm.php tests/phpunit/tests/term/splitSharedTerm.php
    new file mode 100644
    index 0000000..d755e7b
    - +  
     1<?php
     2
     3/**
     4 * @group taxonomy
     5 */
     6class Tests_Term_SplitSharedTerm extends WP_UnitTestCase {
     7        protected $terms = array();
     8
     9        public function setUp() {
     10                global $wpdb;
     11
     12                parent::setUp();
     13
     14                register_taxonomy( 'wptests_tax', 'post' );
     15                register_taxonomy( 'wptests_tax_2', 'post', array(
     16                        'hierarchical' => true,
     17                ) );
     18                register_taxonomy( 'wptests_tax_3', 'post' );
     19
     20                $t1 = wp_insert_term( 'Foo', 'wptests_tax' );
     21                $t2 = wp_insert_term( 'Foo', 'wptests_tax_2' );
     22                $t3 = wp_insert_term( 'Foo', 'wptests_tax_3' );
     23
     24                // Manually modify because split terms shouldn't naturally occur.
     25                $wpdb->update( $wpdb->term_taxonomy,
     26                        array( 'term_id' => $t1['term_id'] ),
     27                        array( 'term_taxonomy_id' => $t2['term_taxonomy_id'] ),
     28                        array( '%d' ),
     29                        array( '%d' )
     30                );
     31
     32                $wpdb->update( $wpdb->term_taxonomy,
     33                        array( 'term_id' => $t1['term_id'] ),
     34                        array( 'term_taxonomy_id' => $t3['term_taxonomy_id'] ),
     35                        array( '%d' ),
     36                        array( '%d' )
     37                );
     38
     39                $t2_child = wp_insert_term( 'Foo Child', 'wptests_tax_2', array(
     40                        'parent' => $t1['term_id'],
     41                ) );
     42
     43                $this->terms = array(
     44                        't1' => $t1,
     45                        't2' => $t2,
     46                        't3' => $t3,
     47                        't2_child' => $t2_child,
     48                );
     49
     50                _split_shared_term( $t1['term_id'], $t2['term_taxonomy_id'] );
     51                _split_shared_term( $t1['term_id'], $t3['term_taxonomy_id'] );
     52        }
     53
     54        /**
     55         * @ticket 5809
     56         */
     57        public function test_should_create_new_term_ids() {
     58                $t1_term = get_term_by( 'term_taxonomy_id', $this->terms['t1']['term_taxonomy_id'], 'wptests_tax' );
     59                $t2_term = get_term_by( 'term_taxonomy_id', $this->terms['t2']['term_taxonomy_id'], 'wptests_tax_2' );
     60                $t3_term = get_term_by( 'term_taxonomy_id', $this->terms['t3']['term_taxonomy_id'], 'wptests_tax_3' );
     61
     62                $this->assertNotEquals( $t1_term->term_id, $t2_term->term_id );
     63                $this->assertNotEquals( $t1_term->term_id, $t3_term->term_id );
     64                $this->assertNotEquals( $t2_term->term_id, $t3_term->term_id );
     65        }
     66
     67        /**
     68         * @ticket 5809
     69         */
     70        public function test_should_retain_child_terms_when_using_get_terms_parent() {
     71                $t2_term = get_term_by( 'term_taxonomy_id', $this->terms['t2']['term_taxonomy_id'], 'wptests_tax_2' );
     72                $children = get_terms( 'wptests_tax_2', array(
     73                        'parent' => $t2_term->term_id,
     74                        'hide_empty' => false,
     75                ) );
     76
     77                $this->assertEquals( $this->terms['t2_child']['term_taxonomy_id'], $children[0]->term_taxonomy_id );
     78        }
     79
     80        /**
     81         * @ticket 5809
     82         */
     83        public function test_should_retain_child_terms_when_using_get_terms_child_of() {
     84                $t2_term = get_term_by( 'term_taxonomy_id', $this->terms['t2']['term_taxonomy_id'], 'wptests_tax_2' );
     85                $children = get_terms( 'wptests_tax_2', array(
     86                        'child_of' => $t2_term->term_id,
     87                        'hide_empty' => false,
     88                ) );
     89
     90                $this->assertEquals( $this->terms['t2_child']['term_taxonomy_id'], $children[0]->term_taxonomy_id );
     91        }
     92
     93        /**
     94         * @ticket 30335
     95         */
     96        public function test_should_rebuild_split_term_taxonomy_hierarchy() {
     97                global $wpdb;
     98
     99                register_taxonomy( 'wptests_tax_3', 'post' );
     100                register_taxonomy( 'wptests_tax_4', 'post', array(
     101                        'hierarchical' => true,
     102                ) );
     103
     104                $t1 = wp_insert_term( 'Foo1', 'wptests_tax_3' );
     105                $t2 = wp_insert_term( 'Foo1 Parent', 'wptests_tax_4' );
     106                $t3 = wp_insert_term( 'Foo1', 'wptests_tax_4', array(
     107                        'parent' => $t2['term_id'],
     108                ) );
     109
     110                // Manually modify because split terms shouldn't naturally occur.
     111                $wpdb->update( $wpdb->term_taxonomy,
     112                        array( 'term_id' => $t1['term_id'] ),
     113                        array( 'term_taxonomy_id' => $t3['term_taxonomy_id'] ),
     114                        array( '%d' ),
     115                        array( '%d' )
     116                );
     117                $th = _get_term_hierarchy( 'wptests_tax_4' );
     118
     119                $new_term_id = _split_shared_term( $t1['term_id'], $t3['term_taxonomy_id'] );
     120
     121                $t2_children = get_term_children( $t2['term_id'], 'wptests_tax_4' );
     122                $this->assertEquals( array( $new_term_id ), $t2_children );
     123        }
     124
     125        /**
     126         * @ticket 30335
     127         */
     128        public function test_should_update_default_category_on_term_split() {
     129                global $wpdb;
     130                $t1 = wp_insert_term( 'Foo Default', 'category' );
     131
     132                update_option( 'default_category', $t1['term_id'] );
     133
     134                register_taxonomy( 'wptests_tax_5', 'post' );
     135                $t2 = wp_insert_term( 'Foo Default', 'wptests_tax_5' );
     136
     137                // Manually modify because split terms shouldn't naturally occur.
     138                $wpdb->update( $wpdb->term_taxonomy,
     139                        array( 'term_id' => $t1['term_id'] ),
     140                        array( 'term_taxonomy_id' => $t2['term_taxonomy_id'] ),
     141                        array( '%d' ),
     142                        array( '%d' )
     143                );
     144
     145                $this->assertEquals( $t1['term_id'], get_option( 'default_category', -1 ) );
     146
     147                $new_term_id = _split_shared_term( $t1['term_id'], $t1['term_taxonomy_id'] );
     148
     149                $this->assertNotEquals( $new_term_id, $t1['term_id'] );
     150                $this->assertEquals( $new_term_id, get_option( 'default_category', -1 ) );
     151        }
     152
     153        /**
     154         * @ticket 30335
     155         */
     156        public function test_should_update_menus_on_term_split() {
     157                global $wpdb;
     158
     159                $t1 = wp_insert_term( 'Foo Menu', 'category' );
     160
     161                register_taxonomy( 'wptests_tax_6', 'post' );
     162                $t2 = wp_insert_term( 'Foo Menu', 'wptests_tax_6' );
     163
     164                // Manually modify because split terms shouldn't naturally occur.
     165                $wpdb->update( $wpdb->term_taxonomy,
     166                        array( 'term_id' => $t1['term_id'] ),
     167                        array( 'term_taxonomy_id' => $t2['term_taxonomy_id'] ),
     168                        array( '%d' ),
     169                        array( '%d' )
     170                );
     171
     172                $menu_id = wp_create_nav_menu( rand_str() );
     173                $cat_menu_item = wp_update_nav_menu_item( $menu_id, 0, array(
     174                        'menu-item-type' => 'taxonomy',
     175                        'menu-item-object' => 'category',
     176                        'menu-item-object-id' => $t1['term_id'],
     177                        'menu-item-status' => 'publish'
     178                ) );
     179                $this->assertEquals( $t1['term_id'], get_post_meta( $cat_menu_item, '_menu_item_object_id', true ) );
     180
     181                $new_term_id = _split_shared_term( $t1['term_id'], $t1['term_taxonomy_id'] );
     182                $this->assertNotEquals( $new_term_id, $t1['term_id'] );
     183                $this->assertEquals( $new_term_id, get_post_meta( $cat_menu_item, '_menu_item_object_id', true ) );
     184        }
     185
     186        public function test_wp_get_split_shared_term_with_no_taxonomy() {
     187                $found = wp_get_split_terms( $this->terms['t1']['term_id'] );
     188
     189                $expected = array(
     190                        $this->terms['t2']['term_taxonomy_id'],
     191                        $this->terms['t3']['term_taxonomy_id'],
     192                );
     193
     194                $this->assertEqualSets( $expected, wp_list_pluck( $found, 'term_taxonomy_id' ) );
     195        }
     196
     197        public function test_wp_get_split_shared_term_with_taxonomy() {
     198                $found = wp_get_split_terms( $this->terms['t1']['term_id'], 'wptests_tax_3' );
     199
     200                $expected = array(
     201                        $this->terms['t3']['term_taxonomy_id'],
     202                );
     203
     204                $this->assertEqualSets( $expected, wp_list_pluck( $found, 'term_taxonomy_id' ) );
     205        }
     206}