MDL-87648 core: Allow routerconfigured in test CFG

This commit is contained in:
Andrew Nicols
2026-01-21 13:06:19 +08:00
parent b9c4be1a65
commit ba68156c83
2 changed files with 7 additions and 2 deletions
+1
View File
@@ -201,6 +201,7 @@ $allowed = ['wwwroot', 'dataroot', 'dirroot', 'admin', 'directorypermissions', '
'proxyhost', 'proxyport', 'proxytype', 'proxyuser', 'proxypassword', 'proxybypass',
'altcacheconfigpath', 'pathtogs', 'pathtophp', 'pathtodu', 'aspellpath', 'pathtodot',
'pathtounoconv', 'alternative_file_system_class', 'pathtopython',
'routerconfigured',
];
$productioncfg = (array) $CFG;
$CFG = new stdClass();
+6 -2
View File
@@ -93,12 +93,14 @@ final class router_test extends route_testcase {
*/
public function test_basepath(
string $wwwroot,
bool $configured,
string $expected,
): void {
global $CFG;
$this->resetAfterTest();
$CFG->wwwroot = $wwwroot;
$CFG->routerconfigured = $configured;
$router = di::get(router::class);
@@ -106,8 +108,10 @@ final class router_test extends route_testcase {
}
public static function basepath_provider(): \Iterator {
yield 'Domain' => ['http://example.com', '/r.php'];
yield 'Subdirectory' => ['http://example.com/moodle', '/moodle/r.php'];
yield 'Domain Router not configured' => ['http://example.com', false, '/r.php'];
yield 'Domain Router configured' => ['http://example.com', true, ''];
yield 'Subdirectory Router not configured' => ['http://example.com/moodle', false, '/moodle/r.php'];
yield 'Subdirectory Router configured' => ['http://example.com/moodle', true, '/moodle'];
}
public function test_basepath_guessed_rphp(): void {