Skip to content

Commit 058eb8b

Browse files
committed
fix: establish managed multisite constants
1 parent 489e3a9 commit 058eb8b

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

packages/runtime-playground/src/phpunit-command-handlers.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ if (!is_array($wp_config_defines)) {
11131113
$wp_config_defines = array();
11141114
}
11151115
if ($multisite) {
1116-
$wp_config_defines += array(
1116+
$multisite_defines = array(
11171117
'WP_TESTS_MULTISITE' => true,
11181118
'MULTISITE' => true,
11191119
'SUBDOMAIN_INSTALL' => false,
@@ -1122,6 +1122,12 @@ if ($multisite) {
11221122
'SITE_ID_CURRENT_SITE' => 1,
11231123
'BLOG_ID_CURRENT_SITE' => 1,
11241124
);
1125+
$wp_config_defines += $multisite_defines;
1126+
foreach ($multisite_defines as $name => $value) {
1127+
if (!defined($name)) {
1128+
define($name, $value);
1129+
}
1130+
}
11251131
putenv('WP_MULTISITE=1');
11261132
$_ENV['WP_MULTISITE'] = '1';
11271133
}

tests/phpunit-project-autoload.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,7 @@ assert.ok(managedModeCode.includes("configured PHPUnit harness autoload file is
726726
assert.ok(managedModeCode.includes("define('DB_NAME', ':memory:');"), "default managed PHPUnit remains on SQLite")
727727
assert.ok(managedModeCode.includes("'cacheResult' => false"))
728728
assert.ok(managedModeCode.includes("global $argv, $pg_stage_output_buffering, $wp_rewrite;"), "managed WordPress installation must expose the rewrite global required by multisite setup")
729+
assert.ok(managedModeCode.includes("foreach ($multisite_defines as $name => $value)"), "managed multisite must establish network constants before the WordPress test installer runs")
729730
assert.ok(managedModeCode.includes('$dep_mounts = "/wordpress/wp-content/plugins/demo-plugin\\n/wordpress/wp-content/plugins/dependency";'), "dependency mounts must be newline-delimited for the generated PHP runner")
730731
const installStageIndex = managedModeCode.indexOf("pg_run_install_stage(array(")
731732
const dependencyLoadStageIndex = managedModeCode.indexOf("$loaded_dep_files = pg_run_load_deps_stage", installStageIndex)

0 commit comments

Comments
 (0)