public function test_problematic_events()
 {
     global $CFG;
     $event1 = \core_tests\event\problematic_event1::create(array('context' => \context_system::instance()));
     $this->assertDebuggingNotCalled();
     $this->assertNull($event1->xxx);
     $this->assertDebuggingCalled();
     $event2 = \core_tests\event\problematic_event1::create(array('xxx' => 0, 'context' => \context_system::instance()));
     $this->assertDebuggingCalled();
     set_debugging(DEBUG_NONE);
     $event3 = \core_tests\event\problematic_event1::create(array('xxx' => 0, 'context' => \context_system::instance()));
     $this->assertDebuggingNotCalled();
     set_debugging(DEBUG_DEVELOPER);
     $event4 = \core_tests\event\problematic_event1::create(array('context' => \context_system::instance(), 'other' => array('a' => 1)));
     $event4->trigger();
     $this->assertDebuggingNotCalled();
     $event5 = \core_tests\event\problematic_event1::create(array('context' => \context_system::instance(), 'other' => (object) array('a' => 1)));
     $this->assertDebuggingNotCalled();
     $event5->trigger();
     $this->assertDebuggingCalled();
     $url = new moodle_url('/admin/');
     $event6 = \core_tests\event\problematic_event1::create(array('context' => \context_system::instance(), 'other' => array('a' => $url)));
     $this->assertDebuggingNotCalled();
     $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.0, '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()));
     $this->assertDebuggingCalled();
     $event = \core_tests\event\problematic_event3::create(array('other' => 1));
     $this->assertDebuggingNotCalled();
     $event = \core_tests\event\problematic_event3::create(array());
     $this->assertDebuggingCalled();
 }
 public function test_problematic_events()
 {
     global $CFG;
     $event1 = \core_tests\event\problematic_event1::create(array('context' => \context_system::instance()));
     $this->assertDebuggingNotCalled();
     $this->assertNull($event1->xxx);
     $this->assertDebuggingCalled();
     $event2 = \core_tests\event\problematic_event1::create(array('xxx' => 0, 'context' => \context_system::instance()));
     $this->assertDebuggingCalled();
     set_debugging(DEBUG_NONE);
     $event3 = \core_tests\event\problematic_event1::create(array('xxx' => 0, 'context' => \context_system::instance()));
     $this->assertDebuggingNotCalled();
     set_debugging(DEBUG_DEVELOPER);
     $event4 = \core_tests\event\problematic_event1::create(array('context' => \context_system::instance(), 'other' => array('a' => 1)));
     $event4->trigger();
     $this->assertDebuggingNotCalled();
     $event5 = \core_tests\event\problematic_event1::create(array('context' => \context_system::instance(), 'other' => (object) array('a' => 1)));
     $this->assertDebuggingNotCalled();
     $event5->trigger();
     $this->assertDebuggingCalled();
     $url = new moodle_url('/admin/');
     $event6 = \core_tests\event\problematic_event1::create(array('context' => \context_system::instance(), 'other' => array('a' => $url)));
     $this->assertDebuggingNotCalled();
     $event6->trigger();
     $this->assertDebuggingCalled();
     $event = \core_tests\event\problematic_event2::create(array());
     $this->assertDebuggingNotCalled();
     $event = \core_tests\event\problematic_event2::create(array('context' => \context_system::instance()));
     $this->assertDebuggingCalled();
     $event = \core_tests\event\problematic_event3::create(array('other' => 1));
     $this->assertDebuggingNotCalled();
     $event = \core_tests\event\problematic_event3::create(array());
     $this->assertDebuggingCalled();
 }