Merge branch 'MDL-86501-405' of https://github.com/junpataleta/moodle into MOODLE_405_STABLE

This commit is contained in:
Paul Holden
2025-09-10 16:10:28 +01:00
2 changed files with 16 additions and 14 deletions
+7 -6
View File
@@ -147,7 +147,7 @@ final class dateselector_test extends \advanced_testcase {
* Testcase to check onQuickformEvent
*/
public function test_onquickformevent(): void {
global $USER;
global $OUTPUT, $USER;
$testvals = $this->testvals;
// Get dummy form for data.
$mform = $this->mform;
@@ -160,11 +160,12 @@ final class dateselector_test extends \advanced_testcase {
$elparams = array('optional'=>false, 'timezone' => $vals['timezone']);
$el = $this->mform->addElement('date_selector', 'dateselector', null, $elparams);
$this->assertTrue($el instanceof MoodleQuickForm_date_selector);
$expectedvalues = array(
'day' => array($vals['day']),
'month' => array($vals['month']),
'year' => array($vals['year'])
);
$expectedvalues = [
'day' => [$vals['day']],
'month' => [$vals['month']],
'year' => [$vals['year']],
'calendar' => $OUTPUT->pix_icon('i/calendar', ''),
];
$mform->_submitValues = array('dateselector' => $vals['timestamp']);
$el->onQuickFormEvent('updateValue', null, $mform);
$this->assertSame($expectedvalues, $el->getValue());
+9 -8
View File
@@ -159,7 +159,7 @@ final class datetimeselector_test extends \advanced_testcase {
* Testcase to check onQuickformEvent
*/
public function test_onquickformevent(): void {
global $USER;
global $OUTPUT, $USER;
$testvals = $this->testvals;
// Get dummy form for data.
$mform = $this->mform;
@@ -172,13 +172,14 @@ final class datetimeselector_test extends \advanced_testcase {
$elparams = array('optional'=>false, 'timezone' => $vals['timezone']);
$el = $this->mform->addElement('date_time_selector', 'dateselector', null, $elparams);
$this->assertTrue($el instanceof MoodleQuickForm_date_time_selector);
$expectedvalues = array(
'day' => array($vals['day']),
'month' => array($vals['month']),
'year' => array($vals['year']),
'hour' => array($vals['hour']),
'minute' => array($vals['minute'])
);
$expectedvalues = [
'day' => [$vals['day']],
'month' => [$vals['month']],
'year' => [$vals['year']],
'hour' => [$vals['hour']],
'minute' => [$vals['minute']],
'calendar' => $OUTPUT->pix_icon('i/calendar', ''),
];
$mform->_submitValues = array('dateselector' => $vals['timestamp']);
$el->onQuickFormEvent('updateValue', null, $mform);
$this->assertSame($expectedvalues, $el->getValue());