Add tests missed and announced in [36319].

See #27246.

git-svn-id: https://develop.svn.wordpress.org/trunk@36320 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Pascal Birchler 2016-01-15 14:49:54 +00:00
parent 57978063cf
commit 13e7e78ddd
1 changed files with 43 additions and 0 deletions

View File

@ -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( "<p>Post excerpt</p>\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( "<p>There is no excerpt because this is a protected post.</p>\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 ) );
}
}