Make WordPress Core


Ignore:
Timestamp:
09/30/2016 03:23:05 AM (9 years ago)
Author:
boonebgorges
Message:

Tests: Move get_the_excerpt() tests to their own file.

See #36934. Fixes #38196.

File:
1 edited

Legend:

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

    r36329 r38679  
    171171        kses_remove_filters();
    172172    }
    173 
    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      * @ticket 35486
    203      */
    204     public function test_the_excerpt_password_protected_post() {
    205         $post = self::factory()->post->create_and_get( array( 'post_excerpt' => 'Post excerpt', 'post_password' => '1234' ) );
    206         $this->assertSame( 'There is no excerpt because this is a protected post.', get_the_excerpt( $post ) );
    207 
    208         $GLOBALS['post'] = $post;
    209         $this->assertSame( "<p>There is no excerpt because this is a protected post.</p>\n", get_echo( 'the_excerpt' ) );
    210     }
    211 
    212     /**
    213      * @ticket 27246
    214      */
    215     public function test_the_excerpt_specific_post() {
    216         $GLOBALS['post'] = self::factory()->post->create_and_get( array( 'post_excerpt' => 'Foo' ) );
    217         $post_id = self::factory()->post->create( array( 'post_excerpt' => 'Bar' ) );
    218         $this->assertSame( 'Bar', get_the_excerpt( $post_id ) );
    219     }
    220173}
Note: See TracChangeset for help on using the changeset viewer.