From 13e7e78dddab5a595cd6ece83de333fa80544b39 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 15 Jan 2016 14:49:54 +0000 Subject: [PATCH] Add tests missed and announced in [36319]. See #27246. git-svn-id: https://develop.svn.wordpress.org/trunk@36320 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/post/output.php | 43 +++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/tests/phpunit/tests/post/output.php b/tests/phpunit/tests/post/output.php index 52c3eff1f1..63b9aad364 100644 --- a/tests/phpunit/tests/post/output.php +++ b/tests/phpunit/tests/post/output.php @@ -171,4 +171,47 @@ EOF; kses_remove_filters(); } + /** + * @ticket 27246 + */ + public function test_the_excerpt_invalid_post() { + $this->assertSame( '', get_echo( 'the_excerpt' ) ); + $this->assertSame( '', get_the_excerpt() ); + } + + /** + * @ticket 27246 + * @expectedDeprecated get_the_excerpt + */ + public function test_the_excerpt_deprecated() { + $this->assertSame( '', get_the_excerpt( true ) ); + $this->assertSame( '', get_the_excerpt( false ) ); + } + + /** + * @ticket 27246 + */ + public function test_the_excerpt() { + $GLOBALS['post'] = self::factory()->post->create_and_get( array( 'post_excerpt' => 'Post excerpt' ) ); + $this->assertSame( "

Post excerpt

\n", get_echo( 'the_excerpt' ) ); + $this->assertSame( 'Post excerpt', get_the_excerpt() ); + } + + /** + * @ticket 27246 + */ + public function test_the_excerpt_password_protected_post() { + $GLOBALS['post'] = self::factory()->post->create_and_get( array( 'post_excerpt' => 'Post excerpt', 'post_password' => '1234' ) ); + $this->assertSame( "

There is no excerpt because this is a protected post.

\n", get_echo( 'the_excerpt' ) ); + $this->assertSame( 'There is no excerpt because this is a protected post.', get_the_excerpt() ); + } + + /** + * @ticket 27246 + */ + public function test_the_excerpt_specific_post() { + $GLOBALS['post'] = self::factory()->post->create_and_get( array( 'post_excerpt' => 'Foo' ) ); + $post_id = self::factory()->post->create( array( 'post_excerpt' => 'Bar' ) ); + $this->assertSame( 'Bar', get_the_excerpt( $post_id ) ); + } }