diff --git a/lib/tests/admintree_test.php b/lib/tests/admintree_test.php index d1207a68e0c..ec3d989362f 100644 --- a/lib/tests/admintree_test.php +++ b/lib/tests/admintree_test.php @@ -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 *