| | 397 | /** |
| | 398 | * @covers ::_get_term_children |
| | 399 | */ |
| | 400 | public function test_get_term_children_handles_cycles() { |
| | 401 | remove_filter( 'wp_update_term_parent', 'wp_check_term_hierarchy_for_loops', 10 ); |
| | 402 | |
| | 403 | $parent = $this->factory->category->create(); |
| | 404 | $child = $this->factory->category->create( array( 'parent' => $parent ) ); |
| | 405 | wp_update_term( $parent, 'category', array( 'parent' => $child ) ); |
| | 406 | |
| | 407 | add_filter( 'wp_update_term_parent', 'wp_check_term_hierarchy_for_loops', 10, 3 ); |
| | 408 | |
| | 409 | $result = _get_term_children( $parent, array( $parent, $child ), 'category' ); |
| | 410 | |
| | 411 | $this->assertEquals( array( $child ), $result ); |
| | 412 | } |
| | 413 | |