Changeset 1287 in tests for trunk/tests/post.php
- Timestamp:
- 05/20/2013 11:07:00 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/post.php
r1246 r1287 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 } 645 646 function test_wp_parse_post_content_remaining_single_page() { 647 $post_id = $this->factory->post->create( array( 'post_content' => 'Page 0' ) ); 648 $post = get_post( $post_id ); 649 $content = wp_parse_post_content( $post, true ); 650 $this->assertEquals( 0, $content['multipage'] ); 651 $this->assertCount( 1, $content['pages'] ); 652 $this->assertEquals( 1, $content['numpages'] ); 653 $this->assertEquals( array( 'Page 0' ), $content['pages'] ); 654 } 655 656 function test_wp_parse_post_content_remaining_multi_page() { 657 $post_id = $this->factory->post->create( array( 'post_content' => 'Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3' ) ); 658 $post = get_post( $post_id ); 659 $content = wp_parse_post_content( $post, true ); 660 $this->assertEquals( 1, $content['multipage'] ); 661 $this->assertCount( 4, $content['pages'] ); 662 $this->assertEquals( 4, $content['numpages'] ); 663 $this->assertEquals( array( 'Page 0', 'Page 1', 'Page 2', 'Page 3' ), $content['pages'] ); 664 } 625 665 }
Note: See TracChangeset
for help on using the changeset viewer.