mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-41900 events: avoid new debug call within unit tests
This commit is contained in:
parent
c78fdd8db3
commit
d451eb4dc5
1 changed files with 9 additions and 0 deletions
|
@ -126,9 +126,18 @@ class core_eventslib_testcase extends advanced_testcase {
|
||||||
* Tests events_trigger() function when instant handler fails.
|
* Tests events_trigger() function when instant handler fails.
|
||||||
*/
|
*/
|
||||||
public function test_events_trigger__failed_instant() {
|
public function test_events_trigger__failed_instant() {
|
||||||
|
global $CFG;
|
||||||
|
$olddebug = $CFG->debug;
|
||||||
|
|
||||||
$this->assertEquals(1, events_trigger('test_instant', 'fail'), 'fail first event: %s');
|
$this->assertEquals(1, events_trigger('test_instant', 'fail'), 'fail first event: %s');
|
||||||
$this->assertEquals(1, events_trigger('test_instant', 'ok'), 'this one should fail too: %s');
|
$this->assertEquals(1, events_trigger('test_instant', 'ok'), 'this one should fail too: %s');
|
||||||
|
|
||||||
|
// We disable debugging for this next test. It'll make some noise when it fails to dispatch
|
||||||
|
// so that problems don't go permanently unnoticed.
|
||||||
|
$CFG->debug = 0;
|
||||||
$this->assertEquals(0, events_cron('test_instant'), 'all events should stay in queue: %s');
|
$this->assertEquals(0, events_cron('test_instant'), 'all events should stay in queue: %s');
|
||||||
|
$CFG->debug = $olddebug;
|
||||||
|
|
||||||
$this->assertEquals(2, events_pending_count('test_instant'), 'two events should in queue: %s');
|
$this->assertEquals(2, events_pending_count('test_instant'), 'two events should in queue: %s');
|
||||||
$this->assertEquals(0, eventslib_sample_function_handler('status'), 'verify no event dispatched yet: %s');
|
$this->assertEquals(0, eventslib_sample_function_handler('status'), 'verify no event dispatched yet: %s');
|
||||||
eventslib_sample_function_handler('ignorefail'); // Ignore "fail" eventdata from now on.
|
eventslib_sample_function_handler('ignorefail'); // Ignore "fail" eventdata from now on.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue