Make WordPress Core

Ticket #41426: 41426.4.diff

File 41426.4.diff, 1.5 KB (added by Soean, 9 years ago)

Adds tests

  • src/wp-includes/post-template.php

     
    382382        }
    383383
    384384        if ( post_password_required( $post ) ) {
    385                 return __( 'There is no excerpt because this is a protected post.' );
     385                return '<span class="post-password-state">' . __( 'There is no excerpt because this is a protected post.' ) . '</span>';
    386386        }
    387387
    388388        /**
  • tests/phpunit/tests/post/getTheExcerpt.php

     
    3838         */
    3939        public function test_the_excerpt_password_protected_post() {
    4040                $post = self::factory()->post->create_and_get( array( 'post_excerpt' => 'Post excerpt', 'post_password' => '1234' ) );
    41                 $this->assertSame( 'There is no excerpt because this is a protected post.', get_the_excerpt( $post ) );
     41                $this->assertSame( '<span class="post-password-state">There is no excerpt because this is a protected post.</span>', get_the_excerpt( $post ) );
    4242
    4343                $GLOBALS['post'] = $post;
    44                 $this->assertSame( "<p>There is no excerpt because this is a protected post.</p>\n", get_echo( 'the_excerpt' ) );
     44                $this->assertSame( "<p><span class=\"post-password-state\">There is no excerpt because this is a protected post.</span></p>\n", get_echo( 'the_excerpt' ) );
    4545        }
    4646
    4747        /**