Ticket #24330: 24330-ut.2.diff
File 24330-ut.2.diff, 2.5 KB (added by , 12 years ago) |
---|
-
tests/post.php
622 622 $this->assertInstanceOf( 'WP_Error', wp_update_post( $post, true ) ); 623 623 624 624 } 625 626 function test_wp_parse_post_content_single_page() { 627 $post_id = $this->factory->post->create( array( 'post_content' => 'Page 0' ) ); 628 $post = get_post( $post_id ); 629 $content = wp_parse_post_content( $post ); 630 $this->assertEquals( 0, $content['multipage'] ); 631 $this->assertCount( 1, $content['pages'] ); 632 $this->assertEquals( 1, $content['numpages'] ); 633 $this->assertEquals( array( 'Page 0' ), $content['pages'] ); 634 } 635 636 function test_wp_parse_post_content_multi_page() { 637 $post_id = $this->factory->post->create( array( 'post_content' => 'Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3' ) ); 638 $post = get_post( $post_id ); 639 $content = wp_parse_post_content( $post ); 640 $this->assertEquals( 1, $content['multipage'] ); 641 $this->assertCount( 4, $content['pages'] ); 642 $this->assertEquals( 4, $content['numpages'] ); 643 $this->assertEquals( array( 'Page 0', 'Page 1', 'Page 2', 'Page 3' ), $content['pages'] ); 644 } 625 645 } -
tests/post/output.php
170 170 171 171 kses_remove_filters(); 172 172 } 173 174 function test_the_content_with_id() { 175 $post_content = <<<EOF 176 test_the_content_with_id <i>This is the excerpt.</i> 177 <!--more--> 178 This is the <b>body</b>. 179 EOF; 180 181 $post_id = $this->factory->post->create( compact( 'post_content' ) ); 182 183 $expected = <<<EOF 184 <p>test_the_content_with_id <i>This is the excerpt.</i><br /> 185 <span id="more-{$post_id}"></span><br /> 186 This is the <b>body</b>.</p> 187 EOF; 188 189 $this->assertEquals( strip_ws( $expected ), strip_ws( get_echo( 'the_content', array( null, false, $post_id ) ) ) ); 190 } 191 192 function test_the_remaining_content_with_id() { 193 $post_content = <<<EOF 194 test_the_remaining_content_with_id <i>This is the excerpt.</i> 195 <!--more--> 196 This is the <b>body</b>. 197 EOF; 198 199 $post_id = $this->factory->post->create( compact( 'post_content' ) ); 200 201 $expected = <<<EOF 202 <p>test_the_remaining_content_with_id <i>This is the excerpt.</i><br /> 203 <span id="more-{$post_id}"></span><br /> 204 This is the <b>body</b>.</p> 205 EOF; 206 207 $this->assertEquals( strip_ws( $expected ), strip_ws( get_echo( 'the_remaining_content', array( null, false, $post_id ) ) ) ); 208 } 173 209 }