Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moodle
moodle
Commits
a8de3331
Commit
a8de3331
authored
Jun 29, 2022
by
jun
Browse files
Merge branch 'MDL-74886-master' of
https://github.com/lameze/moodle
parents
6a55fb96
3fc9e345
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/adminlib.php
View file @
a8de3331
...
...
@@ -4010,7 +4010,9 @@ class admin_setting_configduration extends admin_setting {
return
''
;
}
$seconds
=
(
int
)(
$data
[
'v'
]
*
$data
[
'u'
]);
$unit
=
(
int
)
$data
[
'u'
];
$value
=
(
int
)
$data
[
'v'
];
$seconds
=
$value
*
$unit
;
// Validate the new setting.
$error
=
$this
->
validate_setting
(
$seconds
);
...
...
lib/tests/admintree_test.php
View file @
a8de3331
...
...
@@ -357,6 +357,17 @@ class core_admintree_testcase extends advanced_testcase {
$this
->
assertSame
(
''
,
get_config
(
'abc_cde'
,
'execpath'
));
}
/**
* Test setting an empty duration displays the correct validation message.
*/
public
function
test_emptydurationvalue
()
{
$this
->
resetAfterTest
();
$adminsetting
=
new
admin_setting_configduration
(
'abc_cde/duration'
,
'some desc'
,
''
,
''
);
// A value that isn't a number is treated as a zero, so we expect to see no error message.
$this
->
assertEmpty
(
$adminsetting
->
write_setting
([
'u'
=>
'3600'
,
'v'
=>
'abc'
]));
}
/**
* Test setting for blocked hosts
*
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment