Add unit test files mistakenly excluded from [30085].

See #9256, #25349.

git-svn-id: https://develop.svn.wordpress.org/trunk@30367 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges
2014-11-17 16:16:01 +00:00
parent 54b2f32180
commit db2bd39770
2 changed files with 420 additions and 0 deletions
@@ -0,0 +1,57 @@
<?php
/**
* @group formatting
* @covers wp_trim_excerpt
*/
class Tests_Formatting_WpTrimExcerpt extends WP_UnitTestCase {
/**
* @ticket 25349
*/
public function test_secondary_loop_respect_more() {
$post1 = $this->factory->post->create( array(
'post_content' => 'Post 1 Page 1<!--more-->Post 1 Page 2',
) );
$post2 = $this->factory->post->create( array(
'post_content' => 'Post 2 Page 1<!--more-->Post 2 Page 2',
) );
$this->go_to( '/?p=' . $post1 );
setup_postdata( get_post( $post1 ) );
$q = new WP_Query( array(
'post__in' => array( $post2 ),
) );
if ( $q->have_posts() ) {
while ( $q->have_posts() ) {
$q->the_post();
$this->assertSame( 'Post 2 Page 1', wp_trim_excerpt() );
}
}
}
/**
* @ticket 25349
*/
public function test_secondary_loop_respect_nextpage() {
$post1 = $this->factory->post->create( array(
'post_content' => 'Post 1 Page 1<!--nextpage-->Post 1 Page 2',
) );
$post2 = $this->factory->post->create( array(
'post_content' => 'Post 2 Page 1<!--nextpage-->Post 2 Page 2',
) );
$this->go_to( '/?p=' . $post1 );
setup_postdata( get_post( $post1 ) );
$q = new WP_Query( array(
'post__in' => array( $post2 ),
) );
if ( $q->have_posts() ) {
while ( $q->have_posts() ) {
$q->the_post();
$this->assertSame( 'Post 2 Page 1', wp_trim_excerpt() );
}
}
}
}