Make WordPress Core


Ignore:
Timestamp:
06/08/2021 11:23:12 PM (5 years ago)
Author:
whyisjake
Message:

Revisions: Check and return errors for insertions to revisions.

Fixes #30009.

Props rmccue, adamsilverstein, coreymckrill, whyisjake.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/post/revisions.php

    r50949 r51124  
    636636                $this->assertSame( $expected, wp_revisions_to_keep( $post ) );
    637637        }
     638
     639
     640        /*
     641         * Verify that trying to create a revision with an invalid ID returns a WP_Error.
     642         *
     643         *
     644         * @ticket 30009
     645         */
     646        public function test_wp_save_post_revision_error() {
     647                $post     = self::factory()->post->create_and_get(
     648                        array(
     649                                'ID' => PHP_INT_MAX,
     650                        )
     651                );
     652                $revision = _wp_put_post_revision( $post );
     653                $this->assertTrue( is_wp_error( $revision ) );
     654        }
    638655}
Note: See TracChangeset for help on using the changeset viewer.