Make WordPress Core

Changeset 27187


Ignore:
Timestamp:
02/17/2014 10:10:57 PM (11 years ago)
Author:
wonderboymusic
Message:

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

See [27016].
Fixes #24257.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/query/conditionals.php

    r27016 r27187  
    677677
    678678        $post = get_queried_object();
     679        $q = $GLOBALS['wp_query'];
    679680
    680681        $this->assertTrue( is_single() );
     682        $this->assertTrue( $q->is_single );
     683        $this->assertFalse( $q->is_page );
     684        $this->assertFalse( $q->is_attachment );
    681685        $this->assertTrue( is_single( $post ) );
    682686        $this->assertTrue( is_single( $post->ID ) );
     
    690694
    691695        $post = get_queried_object();
     696        $q = $GLOBALS['wp_query'];
    692697
    693698        $this->assertTrue( is_page() );
     699        $this->assertFalse( $q->is_single );
     700        $this->assertTrue( $q->is_page );
     701        $this->assertFalse( $q->is_attachment );
    694702        $this->assertTrue( is_page( $post ) );
    695703        $this->assertTrue( is_page( $post->ID ) );
     
    703711
    704712        $post = get_queried_object();
     713        $q = $GLOBALS['wp_query'];
    705714
    706715        $this->assertTrue( is_attachment() );
     716        $this->assertTrue( is_single() );
     717        $this->assertTrue( $q->is_attachment );
     718        $this->assertTrue( $q->is_single );
     719        $this->assertFalse( $q->is_page );
    707720        $this->assertTrue( is_attachment( $post ) );
    708721        $this->assertTrue( is_attachment( $post->ID ) );
Note: See TracChangeset for help on using the changeset viewer.