Skip to content

Commit 247ab89

Browse files
Tests: add test case to ensure bulk edit unsticks existing private posts
1 parent 399ae6e commit 247ab89

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

‎tests/phpunit/tests/admin/includesPost.php‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,33 @@ public function test_bulk_edit_posts_should_not_make_private_posts_sticky() {
285285
$this->assertFalse( is_sticky( $post_id ) );
286286
}
287287

288+
/**
289+
* Existing private posts should not be made sticky during bulk edit.
290+
*
291+
* @ticket 39946
292+
*/
293+
public function test_bulk_edit_posts_should_unstick_existing_private_posts() {
294+
wp_set_current_user( self::$admin_id );
295+
296+
$post_id = self::factory()->post->create(
297+
array(
298+
'post_status' => 'private',
299+
)
300+
);
301+
stick_post( $post_id );
302+
303+
$request = array(
304+
'post_type' => 'post',
305+
'sticky' => 'sticky',
306+
'_status' => '-1',
307+
'post' => array( $post_id ),
308+
);
309+
310+
bulk_edit_posts( $request );
311+
312+
$this->assertFalse( is_sticky( $post_id ) );
313+
}
314+
288315
/**
289316
* The bulk_edit_posts() function should preserve the post format
290317
* when it's unchanged.

0 commit comments

Comments
 (0)