Changeset 42211 for trunk/tests/phpunit/tests/taxonomy.php
- Timestamp:
- 11/21/2017 03:14:52 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/taxonomy.php
r41174 r42211 792 792 $this->assertSame( 'foo', $taxonomy->name ); 793 793 } 794 795 /** 796 * @ticket 36514 797 */ 798 public function test_edit_post_hierarchical_taxonomy() { 799 800 $taxonomy_name = 'foo'; 801 $term_name = 'bar'; 802 803 register_taxonomy( $taxonomy_name, array( 'post' ), array( 804 'hierarchical' => false, 805 'meta_box_cb' => 'post_categories_meta_box', 806 ) ); 807 $post = self::factory()->post->create_and_get( array( 808 'post_type' => 'post', 809 ) ); 810 811 $term_id = self::factory()->term->create_object( array( 812 'name' => $term_name, 813 'taxonomy' => $taxonomy_name, 814 ) ); 815 816 wp_set_current_user( self::factory()->user->create( array( 'role' => 'editor' ) ) ); 817 $updated_post_id = edit_post( array( 818 'post_ID' => $post->ID, 819 'post_type' => 'post', 820 'tax_input' => array( 821 $taxonomy_name => array( 822 (string) $term_id // Cast term_id as string to match whats sent in WP Admin. 823 ), 824 ), 825 ) ); 826 827 $terms_obj = get_the_terms( $updated_post_id, $taxonomy_name ); 828 $problematic_term = current( wp_list_pluck( $terms_obj, 'name' ) ); 829 830 $this->assertEquals( $problematic_term, $term_name ); 831 } 794 832 }
Note: See TracChangeset
for help on using the changeset viewer.