Make WordPress Core

Ticket #28112: 28112.5.diff

File 28112.5.diff, 1.5 KB (added by costdev, 11 months ago)

Added missing $ and a PHPUnit test to ensure the action is always fired in future.

  • src/wp-admin/includes/post.php

    diff --git a/src/wp-admin/includes/post.php b/src/wp-admin/includes/post.php
    index 93cd9a7db5..025eabb657 100644
    a b function bulk_edit_posts( $post_data = null ) { 
    677677                }
    678678        }
    679679
     680        /**
     681         * Fires after processing the post data for bulk edit.
     682         *
     683         * @since 6.3.0
     684         *
     685         * @param int[] $updated          An array of updated post IDs.
     686         * @param array $shared_post_data Associative array containing the post data.
     687         */
     688        do_action( 'bulk_edit_posts', $updated, $shared_post_data );
     689
    680690        return array(
    681691                'updated' => $updated,
    682692                'skipped' => $skipped,
  • tests/phpunit/tests/admin/includesPost.php

    diff --git a/tests/phpunit/tests/admin/includesPost.php b/tests/phpunit/tests/admin/includesPost.php
    index 07660e6f30..1f1c3dbf89 100644
    a b class Tests_Admin_IncludesPost extends WP_UnitTestCase { 
    318318                }
    319319        }
    320320
     321        /**
     322         * Tests that `bulk_edit_posts()` fires the 'bulk_edit_posts' action.
     323         *
     324         * @ticket 28112
     325         *
     326         * @covers ::bulk_edit_posts
     327         */
     328        public function test_bulk_edit_posts_should_fire_bulk_edit_posts_action() {
     329                $action = new MockAction();
     330
     331                wp_set_current_user( self::$admin_id );
     332
     333                add_action( 'bulk_edit_posts', array( $action, 'action' ) );
     334
     335                bulk_edit_posts(
     336                        array(
     337                                'post'      => self::$post_id,
     338                                'post_type' => 'post',
     339                                '_status'   => 1,
     340
     341                        )
     342                );
     343
     344                $this->assertSame( 1, $action->get_call_count() );
     345        }
     346
    321347        /**
    322348         * @ticket 38293
    323349         */