mirror of
https://github.com/catalyst/moodle-auth_outage.git
synced 2026-05-17 05:48:43 +02:00
Issue #54 - Fixed property names and related tests.
This commit is contained in:
@@ -110,8 +110,8 @@ class outagelib {
|
||||
'default_autostart' => false,
|
||||
'default_duration' => 60,
|
||||
'default_warning_duration' => 60,
|
||||
'default_warning_title' => get_string('defaultwarningtitlevalue', 'auth_outage'),
|
||||
'default_warning_description' => get_string('defaultwarningdescriptionvalue', 'auth_outage'),
|
||||
'default_title' => get_string('defaulttitlevalue', 'auth_outage'),
|
||||
'default_description' => get_string('defaultdescriptionvalue', 'auth_outage'),
|
||||
'css' => file_get_contents($CFG->dirroot.'/auth/outage/views/warningbar/warningbar.css'),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -38,8 +38,8 @@ $cli->set_defaults([
|
||||
'warn' => (int)($config->default_warning_duration),
|
||||
'start' => null,
|
||||
'duration' => (int)($config->default_duration),
|
||||
'title' => $config->default_warning_title,
|
||||
'description' => $config->default_warning_description,
|
||||
'title' => $config->default_title,
|
||||
'description' => $config->default_description,
|
||||
]);
|
||||
|
||||
try {
|
||||
|
||||
@@ -65,12 +65,12 @@ $string['defaultoutageduration'] = 'Outage Duration';
|
||||
$string['defaultoutagedurationdescription'] = 'Default duration (in minutes) of an outage.';
|
||||
$string['defaultwarningduration'] = 'Warning Duration';
|
||||
$string['defaultwarningdurationdescription'] = 'Default warning time (in minutes) for outages.';
|
||||
$string['defaultwarningtitle'] = 'Title';
|
||||
$string['defaultwarningtitledescription'] = 'Default title for outages. Use {{start}} and {{stop}} placeholders as required.';
|
||||
$string['defaultwarningtitlevalue'] = 'System down from {{start}} for {{duration}}.';
|
||||
$string['defaultwarningdescription'] = 'Description';
|
||||
$string['defaultwarningdescriptiondescription'] = 'Default warning message for outages. Use {{start}} and {{stop}} placeholders as required.';
|
||||
$string['defaultwarningdescriptionvalue'] = 'There is an scheduled maintenance from {{start}} to {{stop}} and our system will not be available during that time.';
|
||||
$string['defaulttitle'] = 'Title';
|
||||
$string['defaulttitledescription'] = 'Default title for outages. Use {{start}} and {{stop}} placeholders as required.';
|
||||
$string['defaulttitlevalue'] = 'System down from {{start}} for {{duration}}.';
|
||||
$string['defaultdescription'] = 'Description';
|
||||
$string['defaultdescriptiondescription'] = 'Default warning message for outages. Use {{start}} and {{stop}} placeholders as required.';
|
||||
$string['defaultdescriptionvalue'] = 'There is an scheduled maintenance from {{start}} to {{stop}} and our system will not be available during that time.';
|
||||
$string['description'] = 'Public Description';
|
||||
$string['description_help'] = 'A full description of the outage, publicly visible by all users.';
|
||||
$string['finish'] = 'Finish';
|
||||
|
||||
4
new.php
4
new.php
@@ -47,8 +47,8 @@ $defaults = new outage([
|
||||
'starttime' => time(),
|
||||
'stoptime' => time() + ($config->default_duration * 60),
|
||||
'warntime' => time() - ($config->default_warning_duration * 60),
|
||||
'title' => $config->default_warning_title,
|
||||
'description' => $config->default_warning_description,
|
||||
'title' => $config->default_title,
|
||||
'description' => $config->default_description,
|
||||
]);
|
||||
$mform->set_data($defaults);
|
||||
|
||||
|
||||
16
settings.php
16
settings.php
@@ -51,17 +51,17 @@ if ($hassiteconfig && is_enabled_auth('outage')) {
|
||||
PARAM_INT
|
||||
));
|
||||
$settings->add(new admin_setting_configtext(
|
||||
'auth_outage/default_warning_title',
|
||||
get_string('defaultwarningtitle', 'auth_outage'),
|
||||
get_string('defaultwarningtitledescription', 'auth_outage'),
|
||||
$defaults['default_warning_title'],
|
||||
'auth_outage/default_title',
|
||||
get_string('defaulttitle', 'auth_outage'),
|
||||
get_string('defaulttitledescription', 'auth_outage'),
|
||||
$defaults['default_title'],
|
||||
PARAM_TEXT
|
||||
));
|
||||
$settings->add(new admin_setting_configtextarea(
|
||||
'auth_outage/default_warning_description',
|
||||
get_string('defaultwarningdescription', 'auth_outage'),
|
||||
get_string('defaultwarningdescriptiondescription', 'auth_outage'),
|
||||
$defaults['default_warning_description'],
|
||||
'auth_outage/default_description',
|
||||
get_string('defaultdescription', 'auth_outage'),
|
||||
get_string('defaultdescriptiondescription', 'auth_outage'),
|
||||
$defaults['default_description'],
|
||||
PARAM_TEXT
|
||||
));
|
||||
$settings->add(new admin_setting_configtextarea(
|
||||
|
||||
@@ -7,30 +7,33 @@ Feature: Test changing the default settings.
|
||||
Rules:
|
||||
- Times should be expressed in minutes.
|
||||
|
||||
|
||||
Background:
|
||||
Given the authentication plugin "outage" is enabled
|
||||
And I am an administrator
|
||||
|
||||
|
||||
Scenario: Check if I can save the default settings.
|
||||
When I navigate to "Default Settings" node in "Site administration > Plugins > Authentication > Outage manager"
|
||||
And I set the following fields to these values:
|
||||
| s_auth_outage_default_autostart | 1 |
|
||||
| s_auth_outage_default_warning_duration | 15 |
|
||||
| s_auth_outage_default_duration | 30 |
|
||||
# | s_auth_outage_default_Title | My Behat Outage {start} |
|
||||
# | s_auth_outage_default_description | My outage <b>{stop}</b>. |
|
||||
| s_auth_outage_css | /* Some CSS. */ |
|
||||
| s_auth_outage_default_autostart | 1 |
|
||||
| s_auth_outage_default_warning_duration | 15 |
|
||||
| s_auth_outage_default_duration | 30 |
|
||||
| s_auth_outage_default_title | My Behat Outage {start} |
|
||||
| s_auth_outage_default_description | My outage <b>{stop}</b>. |
|
||||
| s_auth_outage_css | /* Some CSS. */ |
|
||||
And I press "Save changes"
|
||||
Then I should see "Changes saved"
|
||||
When I visit the Create Outage Page
|
||||
Then the following fields match these values:
|
||||
# | autostart | 1 |
|
||||
| warningduration[number] | 15 |
|
||||
| warningduration[timeunit] | 60 |
|
||||
| outageduration[number] | 30 |
|
||||
| outageduration[timeunit] | 60 |
|
||||
# | title | My Behat Outage {start} |
|
||||
# | description[text] | My outage <b>{stop}</b>. |
|
||||
| autostart | 1 |
|
||||
| warningduration[number] | 15 |
|
||||
| warningduration[timeunit] | 60 |
|
||||
| outageduration[number] | 30 |
|
||||
| outageduration[timeunit] | 60 |
|
||||
| title | My Behat Outage {start} |
|
||||
| description[text] | My outage <b>{stop}</b>. |
|
||||
|
||||
|
||||
Scenario Outline: Check if I can save invalid values for default settings.
|
||||
When I navigate to "Default Settings" node in "Site administration > Plugins > Authentication > Outage manager"
|
||||
@@ -38,8 +41,8 @@ Feature: Test changing the default settings.
|
||||
| s_auth_outage_default_autostart | 1 |
|
||||
| s_auth_outage_default_warning_duration | <warning> |
|
||||
| s_auth_outage_default_duration | <duration> |
|
||||
# | s_auth_outage_default_Title | <title> |
|
||||
# | s_auth_outage_default_description | <description> |
|
||||
| s_auth_outage_default_title | <title> |
|
||||
| s_auth_outage_default_description | <description> |
|
||||
| s_auth_outage_css | /* Some CSS. */ |
|
||||
And I press "Save changes"
|
||||
Then I should <seeornot> "Changes saved"
|
||||
|
||||
Reference in New Issue
Block a user