mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
Merge branch 'w16_MDL-44366_m27_filtergloss' of https://github.com/skodak/moodle
This commit is contained in:
commit
c675899425
@ -206,11 +206,13 @@ class concept_cache {
|
|||||||
foreach ($concepts as $modid => $unused) {
|
foreach ($concepts as $modid => $unused) {
|
||||||
if (!isset($cminfos[$modid])) {
|
if (!isset($cminfos[$modid])) {
|
||||||
// This should not happen.
|
// This should not happen.
|
||||||
unset($concepts[$modinfo]);
|
unset($concepts[$modid]);
|
||||||
|
unset($glossaries[$modid]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!$cminfos[$modid]->uservisible) {
|
if (!$cminfos[$modid]->uservisible) {
|
||||||
unset($concepts[$modinfo]);
|
unset($concepts[$modid]);
|
||||||
|
unset($glossaries[$modid]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,5 +158,24 @@ class mod_glossary_concept_cache_testcase extends advanced_testcase {
|
|||||||
|
|
||||||
$concepts2 = \mod_glossary\local\concept_cache::get_concepts($course2->id);
|
$concepts2 = \mod_glossary\local\concept_cache::get_concepts($course2->id);
|
||||||
$this->assertEquals($concepts3, $concepts2);
|
$this->assertEquals($concepts3, $concepts2);
|
||||||
|
|
||||||
|
// Test uservisible flag.
|
||||||
|
set_config('enablegroupmembersonly', 1);
|
||||||
|
$glossary1d = $this->getDataGenerator()->create_module('glossary',
|
||||||
|
array('course' => $course1->id, 'mainglossary' => 1, 'usedynalink' => 1, 'groupmembersonly' => 1));
|
||||||
|
$entry1d1 = $generator->create_content($glossary1d, array('concept' => 'membersonly', 'usedynalink' => 1));
|
||||||
|
$user = $this->getDataGenerator()->create_user();
|
||||||
|
$this->getDataGenerator()->enrol_user($user->id, $course1->id);
|
||||||
|
$this->getDataGenerator()->enrol_user($user->id, $course2->id);
|
||||||
|
\mod_glossary\local\concept_cache::reset_caches();
|
||||||
|
$concepts1 = \mod_glossary\local\concept_cache::get_concepts($course1->id);
|
||||||
|
$this->assertCount(4, $concepts1[0]);
|
||||||
|
$this->assertCount(4, $concepts1[1]);
|
||||||
|
$this->setUser($user);
|
||||||
|
course_modinfo::clear_instance_cache();
|
||||||
|
\mod_glossary\local\concept_cache::reset_caches();
|
||||||
|
$concepts1 = \mod_glossary\local\concept_cache::get_concepts($course1->id);
|
||||||
|
$this->assertCount(3, $concepts1[0]);
|
||||||
|
$this->assertCount(3, $concepts1[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user