| | 174 | /** |
| | 175 | * @ticket 27246 |
| | 176 | */ |
| | 177 | public function test_the_excerpt_invalid_post() { |
| | 178 | $this->assertSame( '', get_echo( 'the_excerpt' ) ); |
| | 179 | $this->assertSame( '', get_the_excerpt() ); |
| | 180 | } |
| | 181 | |
| | 182 | /** |
| | 183 | * @ticket 27246 |
| | 184 | * @expectedDeprecated get_the_excerpt |
| | 185 | */ |
| | 186 | public function test_the_excerpt_deprecated() { |
| | 187 | $this->assertSame( '', get_the_excerpt( true ) ); |
| | 188 | $this->assertSame( '', get_the_excerpt( false ) ); |
| | 189 | } |
| | 190 | |
| | 191 | /** |
| | 192 | * @ticket 27246 |
| | 193 | */ |
| | 194 | public function test_the_excerpt() { |
| | 195 | $GLOBALS['post'] = self::factory()->post->create_and_get( array( 'post_excerpt' => 'Post excerpt' ) ); |
| | 196 | $this->assertSame( "<p>Post excerpt</p>\n", get_echo( 'the_excerpt' ) ); |
| | 197 | $this->assertSame( 'Post excerpt', get_the_excerpt() ); |
| | 198 | } |
| | 199 | |
| | 200 | /** |
| | 201 | * @ticket 27246 |
| | 202 | */ |
| | 203 | public function test_the_excerpt_password_protected_post() { |
| | 204 | $GLOBALS['post'] = self::factory()->post->create_and_get( array( 'post_excerpt' => 'Post excerpt', 'post_password' => '1234' ) ); |
| | 205 | $this->assertSame( "<p>There is no excerpt because this is a protected post.</p>\n", get_echo( 'the_excerpt' ) ); |
| | 206 | $this->assertSame( 'There is no excerpt because this is a protected post.', get_the_excerpt() ); |
| | 207 | } |
| | 208 | |
| | 209 | /** |
| | 210 | * @ticket 27246 |
| | 211 | */ |
| | 212 | public function test_the_excerpt_specific_post() { |
| | 213 | $GLOBALS['post'] = self::factory()->post->create_and_get( array( 'post_excerpt' => 'Foo' ) ); |
| | 214 | $post_id = self::factory()->post->create( array( 'post_excerpt' => 'Bar' ) ); |
| | 215 | $this->assertSame( 'Bar', get_the_excerpt( $post_id ) ); |
| | 216 | } |