mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
WordPress' code just... wasn't. This is now dealt with. Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS. Fixes #41057. git-svn-id: https://develop.svn.wordpress.org/trunk@42343 602fd350-edb4-49c9-b593-d223f7449a82
70 lines
1.4 KiB
PHP
70 lines
1.4 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @group formatting
|
|
* @covers ::wp_trim_excerpt
|
|
*/
|
|
class Tests_Formatting_WpTrimExcerpt extends WP_UnitTestCase {
|
|
/**
|
|
* @ticket 25349
|
|
*/
|
|
public function test_secondary_loop_respect_more() {
|
|
$post1 = self::factory()->post->create(
|
|
array(
|
|
'post_content' => 'Post 1 Page 1<!--more-->Post 1 Page 2',
|
|
)
|
|
);
|
|
$post2 = self::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 = self::factory()->post->create(
|
|
array(
|
|
'post_content' => 'Post 1 Page 1<!--nextpage-->Post 1 Page 2',
|
|
)
|
|
);
|
|
$post2 = self::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() );
|
|
}
|
|
}
|
|
}
|
|
}
|