From c2efafbddbf111d8d9a927e3fec7f9c5c3865b9c Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Mon, 17 Feb 2014 22:10:57 +0000 Subject: [PATCH] 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 --- tests/phpunit/tests/query/conditionals.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/phpunit/tests/query/conditionals.php b/tests/phpunit/tests/query/conditionals.php index 101234bb06..0a2004b28c 100644 --- a/tests/phpunit/tests/query/conditionals.php +++ b/tests/phpunit/tests/query/conditionals.php @@ -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 ) );