| | 1698 | /** |
| | 1699 | * @ticket 31270 |
| | 1700 | */ |
| | 1701 | public function test_31270() { |
| | 1702 | register_taxonomy( 'foo', 'post', array( |
| | 1703 | 'hierarchical' => true |
| | 1704 | ) ); |
| | 1705 | |
| | 1706 | $term_slugs = array(); |
| | 1707 | |
| | 1708 | $t1 = $this->factory->term->create( array( |
| | 1709 | 'taxonomy' => 'foo', |
| | 1710 | 'name' => 'Foo', |
| | 1711 | ) ); |
| | 1712 | $term_slugs[ $t1 ] = get_term( $t1, 'foo' )->slug; |
| | 1713 | |
| | 1714 | $t2 = $this->factory->term->create( array( |
| | 1715 | 'taxonomy' => 'foo', |
| | 1716 | 'name' => 'Bar', |
| | 1717 | 'slug' => 'foo-bar', // non-conflicting slug |
| | 1718 | 'parent' => $t1, |
| | 1719 | ) ); |
| | 1720 | $term_slugs[ $t2 ] = get_term( $t2, 'foo' )->slug; |
| | 1721 | |
| | 1722 | $t3 = $this->factory->term->create( array( |
| | 1723 | 'taxonomy' => 'foo', |
| | 1724 | 'name' => 'Bar', |
| | 1725 | ) ); |
| | 1726 | $term_slugs[ $t3 ] = get_term( $t3, 'foo' )->slug; |
| | 1727 | |
| | 1728 | _unregister_taxonomy( 'foo' ); |
| | 1729 | |
| | 1730 | $expected = array( |
| | 1731 | $t1 => 'foo', |
| | 1732 | $t2 => 'foo-bar', |
| | 1733 | $t3 => 'bar', |
| | 1734 | ); |
| | 1735 | |
| | 1736 | $this->assertEquals( $expected, $term_slugs ); |
| | 1737 | } |
| | 1738 | |