Ticket #29278: ticket29278.patch
File ticket29278.patch, 1.5 KB (added by , 10 years ago) |
---|
-
src/wp-includes/taxonomy.php
2944 2944 $parsed_args['name'] = $name; 2945 2945 $parsed_args['description'] = $description; 2946 2946 2947 if ( array_key_exists('term_group', $args) ) { 2948 $term_group = wp_unslash( $args[ 'term_group' ] ); 2949 $parsed_args[ 'term_group' ] = $term_group; 2950 } 2951 2947 2952 if ( '' == trim($name) ) 2948 2953 return new WP_Error('empty_term_name', __('A name is required for this term')); 2949 2954 -
tests/phpunit/tests/taxonomy.php
296 296 $term20 = $this->factory->tag->create( array( 'name' => 'A--' ) ); 297 297 $this->assertFalse( is_wp_error( $term20 ) ); 298 298 } 299 300 /** 301 * @ticket 29278 302 */ 303 function test_update_term_updates_term_group() { 304 $term = wp_insert_term( 'Test Term Group', 'category', array( 'term_group' => 1 ) ); 305 $this->assertFalse( is_wp_error( $term ) ); 306 $term_with_term_group = get_term_by( 'id', $term[ 'term_id' ], 'category' ); 307 $this->assertEquals( 0, $term_with_term_group->term_group ); 308 $term_with_new_term_group = wp_update_term( $term_with_term_group->term_id, 'category', array( 'term_group' => 1 ) ); 309 $updated_term = get_term_by( 'id', $term_with_new_term_group[ 'term_id' ], 'category' ); 310 $this->assertEquals( 1, $updated_term->term_group ); 311 } 299 312 }