mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
In wp_insert_post(), when setting $post_author, use isset() instead of ! empty() to allow 0 to be passed as the value for $post_author.
Adds unit tests. Props ericdaams, wonderboymusic. Fixes #32585. git-svn-id: https://develop.svn.wordpress.org/trunk@34085 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1200,4 +1200,22 @@ class Tests_Post extends WP_UnitTestCase {
|
||||
// Teardown
|
||||
wp_set_current_user( $old_uid );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 32585
|
||||
*/
|
||||
public function test_wp_insert_post_author_zero() {
|
||||
$post_id = $this->factory->post->create( array( 'post_author' => 0 ) );
|
||||
|
||||
$this->assertEquals( 0, get_post( $post_id )->post_author );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 32585
|
||||
*/
|
||||
public function test_wp_insert_post_author_null() {
|
||||
$post_id = $this->factory->post->create( array( 'post_author' => null ) );
|
||||
|
||||
$this->assertEquals( $this->author_id, get_post( $post_id )->post_author );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user