Don't assume `$GLOBALS['post']` is set in `tests/url.php`.

See #25282.



git-svn-id: https://develop.svn.wordpress.org/trunk@25389 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2013-09-12 05:52:53 +00:00
parent f4ac65db2d
commit 6acb4cf24d
1 changed files with 2 additions and 0 deletions

View File

@ -281,6 +281,8 @@ class Tests_URL extends WP_UnitTestCase {
sleep( 1 ); // get_adjacent_post() doesn't handle posts created in the same second.
$post_id2 = $this->factory->post->create();
if ( ! isset( $GLOBALS['post'] ) )
$GLOBALS['post'] = null;
$orig_post = $GLOBALS['post'];
$GLOBALS['post'] = get_post( $post_id2 );