mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-30545 tests - use mod_assignment data generator
mod_assign doens't exist yet..!
This commit is contained in:
parent
95f6a022ca
commit
1f5205b344
1 changed files with 4 additions and 4 deletions
|
@ -91,8 +91,8 @@ class messagelib_testcase extends advanced_testcase {
|
||||||
// It would probably be better to use a quiz instance as it has capability controlled messages
|
// It would probably be better to use a quiz instance as it has capability controlled messages
|
||||||
// however mod_quiz doesn't have a data generator
|
// however mod_quiz doesn't have a data generator
|
||||||
// Instead we're going to use backup notifications and give and take away the capability at various levels
|
// Instead we're going to use backup notifications and give and take away the capability at various levels
|
||||||
$assign = $this->getDataGenerator()->create_module('assign', array('course'=>$course->id));
|
$assignment = $this->getDataGenerator()->create_module('assignment', array('course'=>$course->id));
|
||||||
$modulecontext = context_module::instance($assign->id);
|
$modulecontext = context_module::instance($assignment->id);
|
||||||
|
|
||||||
// Create and enrol a teacher
|
// Create and enrol a teacher
|
||||||
$teacherrole = $DB->get_record('role', array('shortname'=>'editingteacher'), '*', MUST_EXIST);
|
$teacherrole = $DB->get_record('role', array('shortname'=>'editingteacher'), '*', MUST_EXIST);
|
||||||
|
@ -120,7 +120,7 @@ class messagelib_testcase extends advanced_testcase {
|
||||||
// They should now be able to see the backup message
|
// They should now be able to see the backup message
|
||||||
assign_capability('moodle/site:config', CAP_ALLOW, $teacherrole->id, $modulecontext->id, true);
|
assign_capability('moodle/site:config', CAP_ALLOW, $teacherrole->id, $modulecontext->id, true);
|
||||||
accesslib_clear_all_caches_for_unit_testing();
|
accesslib_clear_all_caches_for_unit_testing();
|
||||||
$modulecontext = context_module::instance($assign->id);
|
$modulecontext = context_module::instance($assignment->id);
|
||||||
$this->assertTrue(has_capability('moodle/site:config', $modulecontext));
|
$this->assertTrue(has_capability('moodle/site:config', $modulecontext));
|
||||||
|
|
||||||
$providers = message_get_providers_for_user($teacher->id);
|
$providers = message_get_providers_for_user($teacher->id);
|
||||||
|
@ -131,7 +131,7 @@ class messagelib_testcase extends advanced_testcase {
|
||||||
// They should not be able to see the backup message
|
// They should not be able to see the backup message
|
||||||
assign_capability('moodle/site:config', CAP_PROHIBIT, $teacherrole->id, $coursecontext->id, true);
|
assign_capability('moodle/site:config', CAP_PROHIBIT, $teacherrole->id, $coursecontext->id, true);
|
||||||
accesslib_clear_all_caches_for_unit_testing();
|
accesslib_clear_all_caches_for_unit_testing();
|
||||||
$modulecontext = context_module::instance($assign->id);
|
$modulecontext = context_module::instance($assignment->id);
|
||||||
$this->assertFalse(has_capability('moodle/site:config', $modulecontext));
|
$this->assertFalse(has_capability('moodle/site:config', $modulecontext));
|
||||||
|
|
||||||
$providers = message_get_providers_for_user($teacher->id);
|
$providers = message_get_providers_for_user($teacher->id);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue