mirror of
https://github.com/moodle/moodle.git
synced 2025-04-24 01:44:27 +02:00
Merge branch 'MDL-81915' of https://github.com/AnupamaSarjoshi/moodle
This commit is contained in:
commit
f1528765a5
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user