File tree Expand file tree Collapse file tree
tests/phpunit/tests/rest-api Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,6 +27,9 @@ public static function wpTearDownAfterClass() {
2727 self ::delete_user ( self ::$ subscriber_id );
2828 remove_filter ( 'pre_option_wp_collaboration_enabled ' , '__return_true ' );
2929 wp_delete_post ( self ::$ post_id , true );
30+
31+ // Reset the global REST server so rest_get_server() builds a fresh instance for subsequent test suites.
32+ $ GLOBALS ['wp_rest_server ' ] = null ;
3033 }
3134
3235 public function set_up () {
@@ -39,6 +42,9 @@ public function set_up() {
3942 // in the test suite. TRUNCATE implicitly commits the transaction.
4043 global $ wpdb ;
4144 $ wpdb ->query ( "DELETE FROM {$ wpdb ->collaboration }" );
45+
46+ // Reset the global REST server so rest_get_server() builds a fresh instance based on the option setting.
47+ $ GLOBALS ['wp_rest_server ' ] = null ;
4248 }
4349
4450 /**
You can’t perform that action at this time.
0 commit comments