Add some more assertions to Tests_Query_Conditionals, specifically for is_single(), is_page(), and is_attachment().

See [27016].
Fixes #24257.



git-svn-id: https://develop.svn.wordpress.org/trunk@27187 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2014-02-17 22:10:57 +00:00
parent 664bf1fea2
commit c2efafbddb

View File

@ -676,8 +676,12 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
$this->go_to( "/?p=$post_id" );
$post = get_queried_object();
$q = $GLOBALS['wp_query'];
$this->assertTrue( is_single() );
$this->assertTrue( $q->is_single );
$this->assertFalse( $q->is_page );
$this->assertFalse( $q->is_attachment );
$this->assertTrue( is_single( $post ) );
$this->assertTrue( is_single( $post->ID ) );
$this->assertTrue( is_single( $post->post_title ) );
@ -689,8 +693,12 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
$this->go_to( "/?page_id=$post_id" );
$post = get_queried_object();
$q = $GLOBALS['wp_query'];
$this->assertTrue( is_page() );
$this->assertFalse( $q->is_single );
$this->assertTrue( $q->is_page );
$this->assertFalse( $q->is_attachment );
$this->assertTrue( is_page( $post ) );
$this->assertTrue( is_page( $post->ID ) );
$this->assertTrue( is_page( $post->post_title ) );
@ -702,8 +710,13 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
$this->go_to( "/?attachment_id=$post_id" );
$post = get_queried_object();
$q = $GLOBALS['wp_query'];
$this->assertTrue( is_attachment() );
$this->assertTrue( is_single() );
$this->assertTrue( $q->is_attachment );
$this->assertTrue( $q->is_single );
$this->assertFalse( $q->is_page );
$this->assertTrue( is_attachment( $post ) );
$this->assertTrue( is_attachment( $post->ID ) );
$this->assertTrue( is_attachment( $post->post_title ) );