mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-55611 calendar: Fix unit test filter
The event test factory uses a closure to return only every other record. This was previously working based on ID but MSSQL starts from an even number rather than an odd number. This change changes that to use a static variable which keeps a count of the records instead and only returns every other record in this fashion, removing the dependance upon ID.
This commit is contained in:
parent
c254588732
commit
95f38c22ca
@ -208,7 +208,9 @@ class core_calendar_event_vault_testcase extends advanced_testcase {
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
// The factory will skip events with even ids.
|
||||
$factory = new action_event_test_factory(function($actionevent) {
|
||||
return ($actionevent->get_id() % 2) ? false : true;
|
||||
static $count = 0;
|
||||
$count++;
|
||||
return ($count % 2) ? true : false;
|
||||
});
|
||||
$strategy = new raw_event_retrieval_strategy();
|
||||
$vault = new event_vault($factory, $strategy);
|
||||
|
Loading…
x
Reference in New Issue
Block a user