Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/wp-includes/meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -1397,6 +1397,8 @@ function sanitize_meta( $meta_key, $meta_value, $object_type, $object_subtype =
* @since 6.4.0 The `$revisions_enabled` argument was added to the arguments array.
* @since 6.7.0 The `label` argument was added to the arguments array.
*
* @global array $wp_meta_keys Global registry for meta keys.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mukeshpanchal27 I have updated the @global documentation in abstract-testcase.php and reverted the changes in deprecated.php as suggested.

*
* @param string $object_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
* 'user', or any other object type with an associated meta table.
* @param string $meta_key Meta key to register.
Expand Down Expand Up @@ -1567,6 +1569,8 @@ function register_meta( $object_type, $meta_key, $args, $deprecated = null ) {
*
* @since 5.5.0
*
* @global array $wp_meta_keys Global registry for meta keys.
*
* @param mixed $value Current value passed to filter.
* @param int $object_id ID of the object metadata is for.
* @param string $meta_key Metadata key.
Expand Down Expand Up @@ -1646,6 +1650,8 @@ function registered_meta_key_exists( $object_type, $meta_key, $object_subtype =
* @since 4.6.0
* @since 4.9.8 The `$object_subtype` parameter was added.
*
* @global array $wp_meta_keys Global registry for meta keys.
*
* @param string $object_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
* 'user', or any other object type with an associated meta table.
* @param string $meta_key Metadata key.
Expand Down Expand Up @@ -1696,6 +1702,8 @@ function unregister_meta_key( $object_type, $meta_key, $object_subtype = '' ) {
* @since 4.6.0
* @since 4.9.8 The `$object_subtype` parameter was added.
*
* @global array $wp_meta_keys Global registry for meta keys.
*
* @param string $object_type Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term',
* 'user', or any other object type with an associated meta table.
* @param string $object_subtype Optional. The subtype of the object type. Default empty string.
Expand Down
37 changes: 27 additions & 10 deletions tests/phpunit/includes/abstract-testcase.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ public static function get_called_class() {

/**
* Runs the routine before setting up all tests.
*
* @global wpdb $wpdb WordPress database abstraction object.
*/
public static function set_up_before_class() {
global $wpdb;
Expand Down Expand Up @@ -98,6 +100,8 @@ public static function tear_down_after_class() {

/**
* Runs the routine before each test is executed.
*
* @global WP_Rewrite $wp_rewrite WordPress rewrite rules object.
*/
public function set_up() {
set_time_limit( 0 );
Expand Down Expand Up @@ -155,6 +159,11 @@ public function wp_hash_password_options( array $options, string $algorithm ): a

/**
* After a test method runs, resets any state in WordPress the test method might have changed.
*
* @global wpdb $wpdb WordPress database abstraction object.
* @global WP_Query $wp_the_query WordPress Query object.
* @global WP_Query $wp_query WordPress Query object.
* @global WP $wp WordPress environment object.
*/
public function tear_down() {
global $wpdb, $wp_the_query, $wp_query, $wp;
Expand Down Expand Up @@ -359,10 +368,10 @@ protected function reset__SERVER() {
* Stores $wp_filter, $wp_actions, $wp_filters, and $wp_current_filter
* on a class variable so they can be restored on tear_down() using _restore_hooks().
*
* @global array $wp_filter
* @global array $wp_actions
* @global array $wp_filters
* @global array $wp_current_filter
* @global array $wp_filter Stores all of the filters and actions.
* @global array $wp_actions Stores the number of times each action was triggered.
* @global array $wp_filters Stores the number of times each filter was triggered.
* @global array $wp_current_filter Stores the list of current filters with the current one last.
*/
protected function _backup_hooks() {
self::$hooks_saved['wp_filter'] = array();
Expand All @@ -382,10 +391,10 @@ protected function _backup_hooks() {
* Restores the hook-related globals to their state at set_up()
* so that future tests aren't affected by hooks set during this last test.
*
* @global array $wp_filter
* @global array $wp_actions
* @global array $wp_filters
* @global array $wp_current_filter
* @global array $wp_filter Stores all of the filters and actions.
* @global array $wp_actions Stores the number of times each action was triggered.
* @global array $wp_filters Stores the number of times each filter was triggered.
* @global array $wp_current_filter Stores the list of current filters with the current one last.
*/
protected function _restore_hooks() {
if ( isset( self::$hooks_saved['wp_filter'] ) ) {
Expand All @@ -407,6 +416,8 @@ protected function _restore_hooks() {

/**
* Flushes the WordPress object cache.
*
* @global WP_Object_Cache $wp_object_cache WordPress Object Cache object.
*/
public static function flush_cache() {
global $wp_object_cache;
Expand Down Expand Up @@ -452,7 +463,7 @@ public static function flush_cache() {
*
* @since 5.1.0
*
* @global array $wp_meta_keys
* @global array $wp_meta_keys Global registry for meta keys.
*/
public function unregister_all_meta_keys() {
global $wp_meta_keys;
Expand All @@ -470,6 +481,8 @@ public function unregister_all_meta_keys() {

/**
* Starts a database transaction.
*
* @global wpdb $wpdb WordPress database abstraction object.
*/
public function start_transaction() {
global $wpdb;
Expand All @@ -483,6 +496,8 @@ public function start_transaction() {
* Commits the queries in a transaction.
*
* @since 4.1.0
*
* @global wpdb $wpdb WordPress database abstraction object.
*/
public static function commit_transaction() {
global $wpdb;
Expand Down Expand Up @@ -1133,6 +1148,8 @@ public function normalizeDirectorySeparatorsInPath( $path ) {
* @since 5.3.0 Formalized the existing `...$prop` parameter by adding it
* to the function signature.
*
* @global WP_Query $wp_query WordPress Query object.
*
* @param string ...$prop Any number of WP_Query properties that are expected to be true for the current request.
*/
public function assertQueryTrue( ...$prop ) {
Expand Down Expand Up @@ -1632,7 +1649,7 @@ public static function delete_user( $user_id ) {
*
* @since 4.4.0
*
* @global WP_Rewrite $wp_rewrite
* @global WP_Rewrite $wp_rewrite WordPress rewrite rules object.
*
* @param string $structure Optional. Permalink structure to set. Default empty.
*/
Expand Down
Loading