Make WordPress Core


Ignore:
Timestamp:
05/11/2014 12:25:29 AM (8 years ago)
Author:
wonderboymusic
Message:

In get_the_author_posts(), if there is no current $post, return 0 and bail.

Props krogsgard, aaroncampbell.
Fixes #27998.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/user/author.php

    r25002 r28362  
    7676        $this->assertEquals( '', get_the_author_meta( 'does_not_exist' ) );
    7777    }
     78
     79    function test_get_the_author_posts() {
     80        // Test with no global post, result should be 0 because no author is found
     81        $this->assertEquals( 0, get_the_author_posts() );
     82        $GLOBALS['post'] = $this->post_id;
     83        $this->assertEquals( 1, get_the_author_posts() );
     84    }
    7885}
Note: See TracChangeset for help on using the changeset viewer.