Changeset 29867
- Timestamp:
- 10/09/2014 06:11:17 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/taxonomy.php
r29866 r29867 2934 2934 return new WP_Error('empty_term_name', __('A name is required for this term')); 2935 2935 2936 if ( $parsed_args['parent'] > 0 && ! term_exists( (int) $parsed_args['parent'] ) ) { 2937 return new WP_Error( 'missing_parent', __( 'Parent term does not exist.' ) ); 2938 } 2939 2936 2940 $empty_slug = false; 2937 2941 if ( empty( $args['slug'] ) ) { -
trunk/tests/phpunit/tests/term.php
r29865 r29867 632 632 } 633 633 634 /** 635 * @ticket 29614 636 */ 637 function test_wp_update_term_parent_does_not_exist() { 638 register_taxonomy( 'wptests_tax', array( 639 'hierarchical' => true, 640 ) ); 641 $fake_term_id = 787878; 642 643 $this->assertNull( term_exists( $fake_term_id, 'wptests_tax' ) ); 644 645 $t = $this->factory->term->create( array( 646 'taxonomy' => 'wptests_tax', 647 ) ); 648 649 $found = wp_update_term( $t, 'wptests_tax', array( 650 'parent' => $fake_term_id, 651 ) ); 652 653 $this->assertWPError( $found ); 654 $this->assertSame( 'missing_parent', $found->get_error_code() ); 655 656 $term = get_term( $t, 'wptests_tax' ); 657 $this->assertEquals( 0, $term->parent ); 658 } 659 634 660 public function test_wp_update_term_alias_of_no_term_group() { 635 661 register_taxonomy( 'wptests_tax', 'post' );
Note: See TracChangeset
for help on using the changeset viewer.