@@ -58,6 +58,8 @@ public static function get_called_class() {
5858
5959 /**
6060 * Runs the routine before setting up all tests.
61+ *
62+ * @global wpdb $wpdb WordPress database abstraction object.
6163 */
6264 public static function set_up_before_class () {
6365 global $ wpdb ;
@@ -98,8 +100,12 @@ public static function tear_down_after_class() {
98100
99101 /**
100102 * Runs the routine before each test is executed.
103+ *
104+ * @global WP_Rewrite $wp_rewrite WordPress rewrite rules object.
101105 */
102106 public function set_up () {
107+ global $ wp_rewrite ;
108+
103109 set_time_limit ( 0 );
104110
105111 $ this ->factory = static ::factory ();
@@ -112,8 +118,6 @@ public function set_up() {
112118 $ this ->_backup_hooks ();
113119 }
114120
115- global $ wp_rewrite ;
116-
117121 $ this ->clean_up_global_scope ();
118122
119123 /*
@@ -155,10 +159,17 @@ public function wp_hash_password_options( array $options, string $algorithm ): a
155159
156160 /**
157161 * After a test method runs, resets any state in WordPress the test method might have changed.
162+ *
163+ * @global wpdb $wpdb WordPress database abstraction object.
164+ * @global WP_Query $wp_the_query WordPress Query object.
165+ * @global WP_Query $wp_query WordPress Query object.
166+ * @global WP $wp WordPress environment object.
158167 */
159168 public function tear_down () {
160169 global $ wpdb , $ wp_the_query , $ wp_query , $ wp ;
170+
161171 $ wpdb ->query ( 'ROLLBACK ' );
172+
162173 if ( is_multisite () ) {
163174 while ( ms_is_switched () ) {
164175 restore_current_blog ();
@@ -359,10 +370,10 @@ protected function reset__SERVER() {
359370 * Stores $wp_filter, $wp_actions, $wp_filters, and $wp_current_filter
360371 * on a class variable so they can be restored on tear_down() using _restore_hooks().
361372 *
362- * @global array $wp_filter
363- * @global array $wp_actions
364- * @global array $wp_filters
365- * @global array $wp_current_filter
373+ * @global array $wp_filter Stores all of the filters and actions.
374+ * @global array $wp_actions Stores the number of times each action was triggered.
375+ * @global array $wp_filters Stores the number of times each filter was triggered.
376+ * @global array $wp_current_filter Stores the list of current filters with the current one last.
366377 */
367378 protected function _backup_hooks () {
368379 self ::$ hooks_saved ['wp_filter ' ] = array ();
@@ -382,10 +393,10 @@ protected function _backup_hooks() {
382393 * Restores the hook-related globals to their state at set_up()
383394 * so that future tests aren't affected by hooks set during this last test.
384395 *
385- * @global array $wp_filter
386- * @global array $wp_actions
387- * @global array $wp_filters
388- * @global array $wp_current_filter
396+ * @global array $wp_filter Stores all of the filters and actions.
397+ * @global array $wp_actions Stores the number of times each action was triggered.
398+ * @global array $wp_filters Stores the number of times each filter was triggered.
399+ * @global array $wp_current_filter Stores the list of current filters with the current one last.
389400 */
390401 protected function _restore_hooks () {
391402 if ( isset ( self ::$ hooks_saved ['wp_filter ' ] ) ) {
@@ -407,6 +418,8 @@ protected function _restore_hooks() {
407418
408419 /**
409420 * Flushes the WordPress object cache.
421+ *
422+ * @global WP_Object_Cache $wp_object_cache WordPress Object Cache object.
410423 */
411424 public static function flush_cache () {
412425 global $ wp_object_cache ;
@@ -452,13 +465,15 @@ public static function flush_cache() {
452465 *
453466 * @since 5.1.0
454467 *
455- * @global array $wp_meta_keys
468+ * @global array $wp_meta_keys Global registry for meta keys.
456469 */
457470 public function unregister_all_meta_keys () {
458471 global $ wp_meta_keys ;
472+
459473 if ( ! is_array ( $ wp_meta_keys ) ) {
460474 return ;
461475 }
476+
462477 foreach ( $ wp_meta_keys as $ object_type => $ type_keys ) {
463478 foreach ( $ type_keys as $ object_subtype => $ subtype_keys ) {
464479 foreach ( $ subtype_keys as $ key => $ value ) {
@@ -470,11 +485,15 @@ public function unregister_all_meta_keys() {
470485
471486 /**
472487 * Starts a database transaction.
488+ *
489+ * @global wpdb $wpdb WordPress database abstraction object.
473490 */
474491 public function start_transaction () {
475492 global $ wpdb ;
493+
476494 $ wpdb ->query ( 'SET autocommit = 0; ' );
477495 $ wpdb ->query ( 'START TRANSACTION; ' );
496+
478497 add_filter ( 'query ' , array ( $ this , '_create_temporary_tables ' ) );
479498 add_filter ( 'query ' , array ( $ this , '_drop_temporary_tables ' ) );
480499 }
@@ -483,9 +502,12 @@ public function start_transaction() {
483502 * Commits the queries in a transaction.
484503 *
485504 * @since 4.1.0
505+ *
506+ * @global wpdb $wpdb WordPress database abstraction object.
486507 */
487508 public static function commit_transaction () {
488509 global $ wpdb ;
510+
489511 $ wpdb ->query ( 'COMMIT; ' );
490512 }
491513
@@ -1133,6 +1155,8 @@ public function normalizeDirectorySeparatorsInPath( $path ) {
11331155 * @since 5.3.0 Formalized the existing `...$prop` parameter by adding it
11341156 * to the function signature.
11351157 *
1158+ * @global WP_Query $wp_query WordPress Query object.
1159+ *
11361160 * @param string ...$prop Any number of WP_Query properties that are expected to be true for the current request.
11371161 */
11381162 public function assertQueryTrue ( ...$ prop ) {
@@ -1632,7 +1656,7 @@ public static function delete_user( $user_id ) {
16321656 *
16331657 * @since 4.4.0
16341658 *
1635- * @global WP_Rewrite $wp_rewrite
1659+ * @global WP_Rewrite $wp_rewrite WordPress rewrite rules object.
16361660 *
16371661 * @param string $structure Optional. Permalink structure to set. Default empty.
16381662 */
0 commit comments