Changeset 36080 for trunk/tests/phpunit/tests/term/wpDeleteTerm.php
- Timestamp:
- 12/23/2015 11:43:03 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/term/wpDeleteTerm.php
r35242 r36080 6 6 class Tests_Term_WpDeleteTerm extends WP_UnitTestCase { 7 7 protected $deleted_term; 8 protected $object_ids; 8 9 9 10 /** 10 11 * @ticket 33485 12 * @ticket 35213 11 13 */ 12 14 public function test_count_property_passed_to_filters_should_reflect_pre_deleted_term() { … … 17 19 ) ); 18 20 19 $p = self::factory()->post->create();21 $post_id = self::factory()->post->create(); 20 22 21 wp_set_object_terms( $p , array( $terms[0] ), 'wptests_tax' );23 wp_set_object_terms( $post_id, array( $terms[0] ), 'wptests_tax' ); 22 24 23 add_action( 'delete_term', array( $this, 'catch_deleted_term' ), 10, 4);25 add_action( 'delete_term', array( $this, 'catch_deleted_term' ), 10, 5 ); 24 26 25 27 wp_delete_term( $terms[0], 'wptests_tax' ); 26 28 $this->assertEquals( 1, $this->deleted_term->count ); 29 $this->assertSame( $this->object_ids, array( "$post_id" ) ); 27 30 28 31 wp_delete_term( $terms[1], 'wptests_tax' ); 29 32 $this->assertEquals( 0, $this->deleted_term->count ); 33 $this->assertSame( $this->object_ids, array() ); 30 34 } 31 35 32 public function catch_deleted_term( $term_id, $tt_id, $taxonomy, $deleted_term ) {36 public function catch_deleted_term( $term_id, $tt_id, $taxonomy, $deleted_term, $object_ids ) { 33 37 $this->deleted_term = $deleted_term; 38 $this->object_ids = $object_ids; 34 39 } 35 40 }
Note: See TracChangeset
for help on using the changeset viewer.