WordPress.org

Make WordPress Core

Changeset 1036 in tests


Ignore:
Timestamp:
09/21/12 13:29:19 (19 months ago)
Author:
ryan
Message:

Test args of delete_term action. see #WP20645

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/term.php

    r1030 r1036  
    1414        foreach(get_object_taxonomies('post') as $tax) 
    1515            wp_insert_term( $term, $tax ); 
     16    } 
     17 
     18    function deleted_term_cb( $term, $tt_id, $taxonomy, $deleted_term ) { 
     19        $this->assertInternalType( 'object', $deleted_term ); 
     20        $this->assertInternalType( 'int', $term ); 
     21        // Pesky string $this->assertInternalType( 'int', $tt_id ); 
     22        $this->assertEquals( $term, $deleted_term->term_id ); 
     23        $this->assertEquals( $taxonomy, $deleted_term->taxonomy ); 
     24        $this->assertEquals( $tt_id, $deleted_term->term_taxonomy_id ); 
    1625    } 
    1726 
     
    3544 
    3645        // now delete it 
     46        add_filter( 'delete_term', array( $this, 'deleted_term_cb' ), 10, 4 ); 
    3747        $this->assertTrue( wp_delete_term($t['term_id'], $this->taxonomy) ); 
     48        remove_filter( 'delete_term', array( $this, 'deleted_term_cb' ), 10, 4 ); 
    3849        $this->assertNull( term_exists($term) ); 
    3950        $this->assertNull( term_exists($t['term_id']) ); 
Note: See TracChangeset for help on using the changeset viewer.