1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-24 01:44:27 +02:00
This commit is contained in:
Huong Nguyen 2024-05-28 08:57:26 +07:00
commit f1528765a5
No known key found for this signature in database
GPG Key ID: 40D88AB693A3E72A

@ -128,8 +128,7 @@ class adminlib_test extends \advanced_testcase {
}
/**
* Test method used by upgradesettings.php to make sure
* there are no missing settings in PHPUnit and Behat tests.
* Test admin_output_new_settings_by_page method.
*
* @covers ::admin_output_new_settings_by_page
*/
@ -137,24 +136,26 @@ class adminlib_test extends \advanced_testcase {
$this->resetAfterTest();
$this->setAdminUser();
$root = admin_get_root(true, true);
// The initial list of html pages with no default settings.
$initialsettings = admin_output_new_settings_by_page($root);
$this->assertArrayHasKey('supportcontact', $initialsettings);
$this->assertArrayHasKey('frontpagesettings', $initialsettings);
// Existing default setting.
$this->assertArrayNotHasKey('modsettingbook', $initialsettings);
// Add settings not set during PHPUnit init.
set_config('supportemail', 'support@example.com');
$frontpage = new \admin_setting_special_frontpagedesc();
$frontpage->write_setting('test test');
// NOTE: if this test fails then it is most likely extra setting in
// some additional plugin without default - developer needs to add
// a workaround into their db/install.php for PHPUnit and Behat.
$root = admin_get_root(true, true);
$new = admin_output_new_settings_by_page($root);
$this->assertSame([], $new);
// Remove a default setting.
unset_config('numbering', 'book');
unset_config('supportemail');
$root = admin_get_root(true, true);
$new = admin_output_new_settings_by_page($root);
$this->assertCount(2, $new);
$this->assertArrayNotHasKey('supportcontact', $new);
$this->assertArrayNotHasKey('frontpagesettings', $new);
$this->assertArrayHasKey('modsettingbook', $new);
}
/**