Revisions: Check and return errors for insertions to revisions.

Fixes #30009.

Props rmccue, adamsilverstein, coreymckrill, whyisjake.


git-svn-id: https://develop.svn.wordpress.org/trunk@51124 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jake Spurlock
2021-06-08 23:23:12 +00:00
parent 9f9261f051
commit 1eb777209d
2 changed files with 18 additions and 1 deletions
+17
View File
@@ -635,4 +635,21 @@ class Tests_Post_Revisions extends WP_UnitTestCase {
);
$this->assertSame( $expected, wp_revisions_to_keep( $post ) );
}
/*
* Verify that trying to create a revision with an invalid ID returns a WP_Error.
*
*
* @ticket 30009
*/
public function test_wp_save_post_revision_error() {
$post = self::factory()->post->create_and_get(
array(
'ID' => PHP_INT_MAX,
)
);
$revision = _wp_put_post_revision( $post );
$this->assertTrue( is_wp_error( $revision ) );
}
}