Example #1
0
 function test_synced_term_is_updated()
 {
     $master = new Master();
     $taxonomy = 'post_tag';
     $term = wp_insert_term('test_term', $taxonomy, array('description' => 'test description'));
     if (is_wp_error($term)) {
         var_dump($term);
         throw new Exception("Error in wp_insert_term");
     }
     $term_id = $term['term_id'];
     $tt_id = $term['term_taxonomy_id'];
     $result = wp_set_post_terms($this->ID, array($term_id), $taxonomy);
     $remote_id = $master->push($this->post, $this->site);
     wp_update_term($term_id, $taxonomy, array("description" => "updated desc"));
     $master->update_term($term_id, $tt_id, $taxonomy);
     $local_terms = wp_get_post_terms($this->ID, $taxonomy);
     $remote_terms = wp_get_post_terms($remote_id, $taxonomy);
     $this->assertEquals('updated desc', $local_terms[0]->description);
     $this->assertEquals('updated desc', $remote_terms[0]->description);
 }