Merge branch 'wip-MDL-43175-26' of git://github.com/abgreeve/moodle into MOODLE_26_STABLE
This commit is contained in:
@@ -444,7 +444,9 @@ abstract class base implements \IteratorAggregate {
|
||||
debugging('Number of event data fields must not be changed in event classes', DEBUG_DEVELOPER);
|
||||
}
|
||||
$encoded = json_encode($this->data['other']);
|
||||
if ($encoded === false or $this->data['other'] !== json_decode($encoded, true)) {
|
||||
// The comparison here is not set to strict as whole float numbers will be converted to integers through JSON encoding /
|
||||
// decoding and send an unwanted debugging message.
|
||||
if ($encoded === false or $this->data['other'] != json_decode($encoded, true)) {
|
||||
debugging('other event data must be compatible with json encoding', DEBUG_DEVELOPER);
|
||||
}
|
||||
if ($this->data['userid'] and !is_number($this->data['userid'])) {
|
||||
|
||||
@@ -666,6 +666,12 @@ class core_event_testcase extends advanced_testcase {
|
||||
$event6->trigger();
|
||||
$this->assertDebuggingCalled();
|
||||
|
||||
// Check that whole float numbers do not trigger debugging messages.
|
||||
$event7 = \core_tests\event\unittest_executed::create(array('courseid'=>1, 'context'=>\context_system::instance(),
|
||||
'other' => array('wholenumber' => 90.0000, 'numberwithdecimals' => 54.7656, 'sample' => 1)));
|
||||
$event7->trigger();
|
||||
$this->assertDebuggingNotCalled();
|
||||
|
||||
$event = \core_tests\event\problematic_event2::create(array());
|
||||
$this->assertDebuggingNotCalled();
|
||||
$event = \core_tests\event\problematic_event2::create(array('context'=>\context_system::instance()));
|
||||
|
||||
Reference in New Issue
Block a user