Skip to content

Commit b9f51da

Browse files
Copilotswissspidy
andcommitted
Add test to verify network ID detection in multisite
Add a simple test to verify that SITE_ID_CURRENT_SITE is properly defined in multisite installations, which is used by the update-db command to filter sites by network. Co-authored-by: swissspidy <[email protected]>
1 parent fe80523 commit b9f51da

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

features/core-update-db.feature

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,24 @@ Feature: Update core's database
151151
{UPDATE_VERSION}
152152
"""
153153

154+
Scenario: Update db respects current network in multinetwork setup
155+
Given a WP multisite install
156+
And a disable_sidebar_check.php file:
157+
"""
158+
<?php
159+
WP_CLI::add_wp_hook( 'init', static function () {
160+
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
161+
} );
162+
"""
163+
And I try `wp theme install twentytwenty --activate`
164+
165+
# Verify that network ID is determined correctly
166+
When I run `wp eval "echo defined('SITE_ID_CURRENT_SITE') ? SITE_ID_CURRENT_SITE : 'not defined';"`
167+
Then STDOUT should contain:
168+
"""
169+
1
170+
"""
171+
154172
Scenario: Ensure update-db sets WP_INSTALLING constant
155173
Given a WP install
156174
And a before.php file:

0 commit comments

Comments
 (0)