| 725 | |
| 726 | /** |
| 727 | * @ticket 10663 |
| 728 | */ |
| 729 | function test_is_category() { |
| 730 | $post_id = $this->factory->post->create(); |
| 731 | $cat_id = $this->factory->category->create( array( 'name' => 'News' ) ); |
| 732 | wp_set_post_categories( $post_id, $cat_id ); |
| 733 | |
| 734 | $this->go_to( "/?cat=$cat_id" ); |
| 735 | |
| 736 | $this->assertQueryTrue( 'is_category', 'is_archive' ); |
| 737 | $this->assertTrue( is_numeric( $cat_id ) ); |
| 738 | $this->assertTrue( is_category( $cat_id ) ); |
| 739 | $this->assertTrue( is_numeric( "$cat_id") ); |
| 740 | $this->assertTrue( is_category( "$cat_id" ) ); |
| 741 | |
| 742 | $this->assertFalse( is_numeric( "{$cat_id}eth release" ) ); |
| 743 | $this->assertFalse( is_category( "{$cat_id}eth release" ) ); |
| 744 | $this->assertFalse( is_category( "{$cat_id}eth" ) ); |
| 745 | $this->assertFalse( is_category( "{$cat_id} of a kind" ) ); |
| 746 | } |
| 747 | |
| 748 | /** |
| 749 | * @ticket 10663 |
| 750 | */ |
| 751 | function test_is_tag() { |
| 752 | $post_id = $this->factory->post->create(); |
| 753 | $tag_id = $this->factory->tag->create( array( 'name' => 'News' ) ); |
| 754 | wp_set_post_tags( $post_id, $tag_id ); |
| 755 | |
| 756 | $this->go_to( "/?tag=$tag_id" ); |
| 757 | |
| 758 | $this->assertQueryTrue( 'is_tag', 'is_archive' ); |
| 759 | $this->assertTrue( is_numeric( $tag_id ) ); |
| 760 | $this->assertTrue( is_tag( $tag_id ) ); |
| 761 | $this->assertTrue( is_numeric( "$tag_id") ); |
| 762 | $this->assertTrue( is_tag( "$tag_id" ) ); |
| 763 | |
| 764 | $this->assertFalse( is_numeric( "{$tag_id}eth release" ) ); |
| 765 | $this->assertFalse( is_tag( "{$tag_id}eth release" ) ); |
| 766 | $this->assertFalse( is_tag( "{$tag_id}eth" ) ); |
| 767 | $this->assertFalse( is_tag( "{$tag_id} of a kind" ) ); |
| 768 | } |