diff --git a/public/course/format/tests/stateactions_test.php b/public/course/format/tests/stateactions_test.php index 44fbc62b048..5f72ecd0684 100644 --- a/public/course/format/tests/stateactions_test.php +++ b/public/course/format/tests/stateactions_test.php @@ -1506,7 +1506,7 @@ final class stateactions_test extends \advanced_testcase { $modinfo = get_fast_modinfo($course); // Get refreshed version. $allsections = $modinfo->get_listed_section_info_all(); - $cmidstoref = array_flip($references); + $cmidstoref = array_flip(array_filter($references, fn($key) => str_starts_with($key, 'cm'), ARRAY_FILTER_USE_KEY)); foreach ($allsections as $sectioninfo) { $sectionkey = 'section' . $sectioninfo->sectionnum; $coursetree[$sectionkey] = [];