Changeset 53769 for trunk/tests/phpunit/tests/post/revisions.php
- Timestamp:
- 07/23/2022 03:40:10 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post/revisions.php
r53759 r53769 657 657 658 658 /** 659 * Tests that wp_get_last est_revision_id_and_total_count() returns last revision idand total count.659 * Tests that wp_get_last_revision_id_and_total_count() returns the last revision ID and total count. 660 660 * 661 661 * @ticket 55857 … … 675 675 $post_revisions = wp_get_post_revisions( $post_id ); 676 676 $last_post_revision = current( $post_revisions ); 677 $revision = wp_get_last est_revision_id_and_total_count( $post_id );677 $revision = wp_get_last_revision_id_and_total_count( $post_id ); 678 678 679 679 $this->assertSame( 680 680 $last_post_revision->ID, 681 681 $revision['revision'], 682 ' Failed asserting latest revision id.'682 'The last revision ID does not match.' 683 683 ); 684 684 … … 686 686 count( $post_revisions ), 687 687 $revision['count'], 688 ' Failed asserting total count of revision.'689 ); 690 } 691 692 /** 693 * Tests that wp_get_last est_revision_id_and_total_count() when no revisions.688 'The total count of revisions does not match.' 689 ); 690 } 691 692 /** 693 * Tests that wp_get_last_revision_id_and_total_count() returns a WP_Error when no revisions exist. 694 694 * 695 695 * @ticket 55857 696 696 */ 697 697 public function test_wp_get_last_revision_id_and_total_count_no_revisions() { 698 $revision = wp_get_lastest_revision_id_and_total_count( null ); 699 $this->assertWPError( $revision, 'Invalid Post, non existing revisions.' ); 700 $this->assertSame( $revision->get_error_message(), 'Invalid post.' ); 698 $revision = wp_get_last_revision_id_and_total_count( null ); 699 700 $this->assertWPError( $revision, 'Invalid post, no revisions should exist.' ); 701 $this->assertSame( $revision->get_error_code(), 'invalid_post' ); 701 702 702 703 add_filter( 'wp_revisions_to_keep', '__return_zero' ); 703 704 $post_id = self::factory()->post->create(); 704 $revision = wp_get_lastest_revision_id_and_total_count( $post_id ); 705 $this->assertWPError( $revision, 'Revisions should be not enabled.' ); 706 $this->assertSame( $revision->get_error_message(), 'Revisions not enabled.' ); 705 $revision = wp_get_last_revision_id_and_total_count( $post_id ); 706 707 $this->assertWPError( $revision, 'Revisions should not be enabled.' ); 708 $this->assertSame( $revision->get_error_code(), 'revisions_not_enabled' ); 707 709 } 708 710
Note: See TracChangeset
for help on using the changeset viewer.