WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/07/2019 02:32:23 PM (6 weeks ago)
Author:
SergeyBiryukov
Message:

Posts, Post Types: Avoid a PHP warning when the_content() is called outside of the loop.

Fixes #47824.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/post/getTheContent.php

    r44941 r46079  
    7676        $this->assertSame( 'Bang', $found );
    7777    }
     78
     79    /**
     80     * @ticket 47824
     81     */
     82    public function test_should_fall_back_to_post_global_outside_of_the_loop() {
     83        $GLOBALS['post'] = self::factory()->post->create( array( 'post_content' => 'Foo' ) );
     84
     85        $this->assertSame( 'Foo', get_the_content() );
     86    }
    7887}
Note: See TracChangeset for help on using the changeset viewer.