Permalink
Browse files

Merge branch 'MDL-43440-master' of git://github.com/mr-russ/moodle

  • Loading branch information...
2 parents e06bb5f + 74b63ea commit 1b066c06c6fe9e7b2882317a6275962f17ef2f6c @marinaglancy marinaglancy committed Feb 3, 2014
View
2 badges/tests/badgeslib_test.php
@@ -233,7 +233,7 @@ public function test_badges_observer_course_module_criteria_review() {
$criteria_overall = award_criteria::build(array('criteriatype' => BADGE_CRITERIA_TYPE_OVERALL, 'badgeid' => $badge->id));
$criteria_overall->save(array('agg' => BADGE_CRITERIA_AGGREGATION_ANY));
$criteria_overall = award_criteria::build(array('criteriatype' => BADGE_CRITERIA_TYPE_ACTIVITY, 'badgeid' => $badge->id));
- $criteria_overall->save(array('agg' => BADGE_CRITERIA_AGGREGATION_ANY, 'module_'.$this->module->id => $this->module->id));
+ $criteria_overall->save(array('agg' => BADGE_CRITERIA_AGGREGATION_ANY, 'module_'.$this->module->cmid => $this->module->cmid));
// Set completion for forum activity.
$c = new completion_info($this->course);
View
8 blocks/comments/tests/events_test.php
@@ -88,7 +88,7 @@ public function test_comment_created() {
$this->assertEquals($url, $event->get_url());
// Comments when block is on module (wiki) page.
- $context = context_module::instance($this->wiki->id);
+ $context = context_module::instance($this->wiki->cmid);
$args = new stdClass;
$args->context = $context;
$args->course = $this->course;
@@ -111,7 +111,7 @@ public function test_comment_created() {
// Checking that the event contains the expected values.
$this->assertInstanceOf('\block_comments\event\comment_created', $event);
$this->assertEquals($context, $event->get_context());
- $url = new moodle_url('/mod/wiki/view.php', array('id' => $this->wiki->id));
+ $url = new moodle_url('/mod/wiki/view.php', array('id' => $this->wiki->cmid));
$this->assertEquals($url, $event->get_url());
$this->assertEventContextNotUsed($event);
}
@@ -153,7 +153,7 @@ public function test_comment_deleted() {
$this->assertEquals($url, $event->get_url());
// Comments when block is on module (wiki) page.
- $context = context_module::instance($this->wiki->id);
+ $context = context_module::instance($this->wiki->cmid);
$args = new stdClass;
$args->context = $context;
$args->course = $this->course;
@@ -177,7 +177,7 @@ public function test_comment_deleted() {
// Checking that the event contains the expected values.
$this->assertInstanceOf('\block_comments\event\comment_deleted', $event);
$this->assertEquals($context, $event->get_context());
- $url = new moodle_url('/mod/wiki/view.php', array('id' => $this->wiki->id));
+ $url = new moodle_url('/mod/wiki/view.php', array('id' => $this->wiki->cmid));
$this->assertEquals($url, $event->get_url());
$this->assertEventContextNotUsed($event);
}
View
4 files/tests/externallib_test.php
@@ -223,7 +223,7 @@ public function test_get_files() {
// Insert the information about the file.
$contentid = $DB->insert_record('data_content', $datacontent);
// Required information for uploading a file.
- $context = context_module::instance($module->id);
+ $context = context_module::instance($module->cmid);
$usercontext = context_user::instance($USER->id);
$component = 'mod_data';
$filearea = 'content';
@@ -301,7 +301,7 @@ public function test_get_files() {
$modified = 0;
// Context level and instance ID are used to determine what the context is.
$contextlevel = 'module';
- $instanceid = $module->id;
+ $instanceid = $module->cmid;
$testfilelisting = core_files_external::get_files($nocontext, $component, $filearea, $itemid, '/', $filename, $modified, $contextlevel, $instanceid);
$this->assertEquals($testfilelisting, $testdata);
}
View
2 grade/tests/edittreelib_test.php
@@ -52,7 +52,7 @@ public function test_grade_edit_tree_column_range_get_item_cell() {
$scale = $this->getDataGenerator()->create_scale();
$course = $this->getDataGenerator()->create_course();
$assign = $this->getDataGenerator()->create_module('assign', array('course' => $course->id));
- $modulecontext = context_module::instance($assign->id);
+ $modulecontext = context_module::instance($assign->cmid);
// The generator returns a dummy object, lets get the real assign object.
$assign = new assign($modulecontext, false, false);
$cm = $assign->get_course_module();
View
6 grade/tests/externallib_test.php
@@ -66,7 +66,7 @@ public function test_get_definitions() {
// Create a teacher and give them capabilities.
$coursecontext = context_course::instance($course->id);
$roleid = $this->assignUserCapability('moodle/course:viewparticipants', $coursecontext->id, 3);
- $modulecontext = context_module::instance($cm->id);
+ $modulecontext = context_module::instance($cm->cmid);
$this->assignUserCapability('mod/assign:grade', $modulecontext->id, $roleid);
// Create the teacher's enrolment record.
@@ -146,7 +146,7 @@ public function test_get_definitions() {
$DB->insert_record('gradingform_rubric_levels', $rubriclevel2);
// Call the external function.
- $cmids = array ($cm->id);
+ $cmids = array ($cm->cmid);
$areaname = 'submissions';
$result = core_grading_external::get_definitions($cmids, $areaname);
@@ -209,7 +209,7 @@ public function test_get_gradingform_instances() {
// Create a teacher and give them capabilities.
$coursecontext = context_course::instance($course->id);
$roleid = $this->assignUserCapability('moodle/course:viewparticipants', $coursecontext->id, 3);
- $modulecontext = context_module::instance($assign->id);
+ $modulecontext = context_module::instance($assign->cmid);
$this->assignUserCapability('mod/assign:grade', $modulecontext->id, $roleid);
// Create the teacher's enrolment record.
View
10 lib/tests/accesslib_test.php
@@ -60,7 +60,7 @@ public function test_accesslib_clear_all_caches() {
$this->assertNotEmpty($ACCESSLIB_PRIVATE->rolepermissions);
$this->assertNotEmpty($ACCESSLIB_PRIVATE->rolepermissions);
$this->assertNotEmpty($ACCESSLIB_PRIVATE->accessdatabyuser);
- accesslib_clear_all_caches(true);
+ accesslib_clear_all_caches_for_unit_testing();
$this->assertEmpty($ACCESSLIB_PRIVATE->rolepermissions);
$this->assertEmpty($ACCESSLIB_PRIVATE->rolepermissions);
$this->assertEmpty($ACCESSLIB_PRIVATE->dirtycontexts);
@@ -2095,7 +2095,7 @@ public function test_permission_evaluation() {
unassign_capability('moodle/site:accessallgroups', $allroles['teacher'], $frontpagecontext->id, true);
unset($rc);
- accesslib_clear_all_caches(false); // Must be done after assign_capability().
+ accesslib_clear_all_caches_for_unit_testing(); // Must be done after assign_capability().
// Test role_assign(), role_unassign(), role_unassign_all() functions.
@@ -2112,7 +2112,7 @@ public function test_permission_evaluation() {
$this->assertEquals(0, $DB->count_records('role_assignments', array('contextid'=>$context->id)));
unset($context);
- accesslib_clear_all_caches(false); // Just in case.
+ accesslib_clear_all_caches_for_unit_testing(); // Just in case.
// Test has_capability(), get_users_by_capability(), role_switch(), reload_all_capabilities() and friends functions.
@@ -2173,7 +2173,7 @@ public function test_permission_evaluation() {
assign_capability('mod/page:view', CAP_PREVENT, $allroles['guest'], $systemcontext, true);
- accesslib_clear_all_caches(false); // Must be done after assign_capability().
+ accesslib_clear_all_caches_for_unit_testing(); /// Must be done after assign_capability().
// Extra tests for guests and not-logged-in users because they can not be verified by cross checking
// with get_users_by_capability() where they are ignored.
@@ -2296,7 +2296,7 @@ public function test_permission_evaluation() {
unset($permissions);
unset($roles);
- accesslib_clear_all_caches(false); // Must be done after assign_capability().
+ accesslib_clear_all_caches_for_unit_testing(); // must be done after assign_capability().
// Test time - let's set up some real user, just in case the logic for USER affects the others...
$USER = $DB->get_record('user', array('id'=>$testusers[3]));
View
2 lib/tests/completionlib_test.php
@@ -812,7 +812,7 @@ public function test_course_module_completion_updated_event() {
$this->assertInstanceOf('\core\event\course_module_completion_updated', $event);
$this->assertEquals($forum->cmid, $event->get_record_snapshot('course_modules_completion', $event->objectid)->coursemoduleid);
$this->assertEquals($current, $event->get_record_snapshot('course_modules_completion', $event->objectid));
- $this->assertEquals(context_module::instance($forum->id), $event->get_context());
+ $this->assertEquals(context_module::instance($forum->cmid), $event->get_context());
$this->assertEquals($USER->id, $event->userid);
$this->assertEquals($this->user->id, $event->other['relateduserid']);
$this->assertInstanceOf('moodle_url', $event->get_url());
View
6 lib/tests/messagelib_test.php
@@ -134,7 +134,7 @@ public function test_message_get_providers_for_user_more() {
// 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.
$assign = $this->getDataGenerator()->create_module('assign', array('course'=>$course->id));
- $modulecontext = context_module::instance($assign->id);
+ $modulecontext = context_module::instance($assign->cmid);
// Create and enrol a teacher.
$teacherrole = $DB->get_record('role', array('shortname'=>'editingteacher'), '*', MUST_EXIST);
@@ -162,7 +162,7 @@ public function test_message_get_providers_for_user_more() {
// They should now be able to see the backup message.
assign_capability('moodle/site:config', CAP_ALLOW, $teacherrole->id, $modulecontext->id, true);
accesslib_clear_all_caches_for_unit_testing();
- $modulecontext = context_module::instance($assign->id);
+ $modulecontext = context_module::instance($assign->cmid);
$this->assertTrue(has_capability('moodle/site:config', $modulecontext));
$providers = message_get_providers_for_user($teacher->id);
@@ -173,7 +173,7 @@ public function test_message_get_providers_for_user_more() {
// They should not be able to see the backup message.
assign_capability('moodle/site:config', CAP_PROHIBIT, $teacherrole->id, $coursecontext->id, true);
accesslib_clear_all_caches_for_unit_testing();
- $modulecontext = context_module::instance($assign->id);
+ $modulecontext = context_module::instance($assign->cmid);
$this->assertFalse(has_capability('moodle/site:config', $modulecontext));
$providers = message_get_providers_for_user($teacher->id);
View
4 mod/assign/submission/comments/tests/events_test.php
@@ -73,7 +73,7 @@ public function test_comment_created() {
// Checking that the event contains the expected values.
$this->assertInstanceOf('\assignsubmission_comments\event\comment_created', $event);
$this->assertEquals($context, $event->get_context());
- $url = new moodle_url('/mod/assign/view.php', array('id' => $submission->id));
+ $url = new moodle_url('/mod/assign/view.php', array('id' => $assign->get_course_module()->id));
$this->assertEquals($url, $event->get_url());
$this->assertEventContextNotUsed($event);
}
@@ -111,7 +111,7 @@ public function test_comment_deleted() {
// Checking that the event contains the expected values.
$this->assertInstanceOf('\assignsubmission_comments\event\comment_deleted', $event);
$this->assertEquals($context, $event->get_context());
- $url = new moodle_url('/mod/assign/view.php', array('id' => $submission->id));
+ $url = new moodle_url('/mod/assign/view.php', array('id' => $assign->get_course_module()->id));
$this->assertEquals($url, $event->get_url());
$this->assertEventContextNotUsed($event);
}
View
10 mod/assign/tests/externallib_test.php
@@ -66,7 +66,7 @@ public function test_get_grades() {
// Create a teacher and give them capabilities.
$context = context_course::instance($course->id);
$roleid = $this->assignUserCapability('moodle/course:viewparticipants', $context->id, 3);
- $context = context_module::instance($assign->id);
+ $context = context_module::instance($assign->cmid);
$this->assignUserCapability('mod/assign:grade', $context->id, $roleid);
// Create the teacher's enrolment record.
@@ -163,7 +163,7 @@ public function test_get_assignments() {
// Create the user and give them capabilities.
$context = context_course::instance($course1->id);
$roleid = $this->assignUserCapability('moodle/course:view', $context->id);
- $context = context_module::instance($assign1->id);
+ $context = context_module::instance($assign1->cmid);
$this->assignUserCapability('mod/assign:view', $context->id, $roleid);
// Create the user enrolment record.
@@ -332,7 +332,7 @@ public function test_get_user_flags() {
// Create a teacher and give them capabilities.
$context = context_course::instance($course->id);
$roleid = $this->assignUserCapability('moodle/course:viewparticipants', $context->id, 3);
- $context = context_module::instance($assign->id);
+ $context = context_module::instance($assign->cmid);
$this->assignUserCapability('mod/assign:grade', $context->id, $roleid);
// Create the teacher's enrolment record.
@@ -403,7 +403,7 @@ public function test_get_user_mappings() {
// Create a teacher and give them capabilities.
$context = context_course::instance($course->id);
$roleid = $this->assignUserCapability('moodle/course:viewparticipants', $context->id, 3);
- $context = context_module::instance($assign->id);
+ $context = context_module::instance($assign->cmid);
$this->assignUserCapability('mod/assign:revealidentities', $context->id, $roleid);
// Create the teacher's enrolment record.
@@ -1072,7 +1072,7 @@ public function test_set_user_flags() {
// Create a teacher and give them capabilities.
$context = context_course::instance($course->id);
$roleid = $this->assignUserCapability('moodle/course:viewparticipants', $context->id, 3);
- $context = context_module::instance($assign->id);
+ $context = context_module::instance($assign->cmid);
$this->assignUserCapability('mod/assign:grade', $context->id, $roleid);
// Create the teacher's enrolment record.
View
6 mod/book/tests/events_test.php
@@ -65,7 +65,7 @@ public function test_chapter_created() {
// Checking that the event contains the expected values.
$this->assertInstanceOf('\mod_book\event\chapter_created', $event);
- $this->assertEquals(context_module::instance($book->id), $event->get_context());
+ $this->assertEquals(context_module::instance($book->cmid), $event->get_context());
$this->assertEquals($chapter->id, $event->objectid);
$expected = array($course->id, 'book', 'add chapter', 'view.php?id='.$book->cmid.'&chapterid='.$chapter->id,
$chapter->id, $book->cmid);
@@ -98,7 +98,7 @@ public function test_chapter_updated() {
// Checking that the event contains the expected values.
$this->assertInstanceOf('\mod_book\event\chapter_updated', $event);
- $this->assertEquals(context_module::instance($book->id), $event->get_context());
+ $this->assertEquals(context_module::instance($book->cmid), $event->get_context());
$this->assertEquals($chapter->id, $event->objectid);
$expected = array($course->id, 'book', 'update chapter', 'view.php?id='.$book->cmid.'&chapterid='.$chapter->id,
$chapter->id, $book->cmid);
@@ -133,7 +133,7 @@ public function test_chapter_deleted() {
// Checking that the event contains the expected values.
$this->assertInstanceOf('\mod_book\event\chapter_deleted', $event);
- $this->assertEquals(context_module::instance($book->id), $event->get_context());
+ $this->assertEquals(context_module::instance($book->cmid), $event->get_context());
$this->assertEquals($chapter->id, $event->objectid);
$this->assertEquals($chapter, $event->get_record_snapshot('book_chapters', $chapter->id));
$this->assertEventLegacyLogData(array('1', 2, false), $event);
View
8 mod/choice/tests/events_test.php
@@ -77,7 +77,7 @@ public function test_answer_submitted() {
$this->assertCount(1, $events);
$this->assertInstanceOf('\mod_choice\event\answer_submitted', $events[0]);
$this->assertEquals($user->id, $events[0]->userid);
- $this->assertEquals(context_module::instance($this->choice->id), $events[0]->get_context());
+ $this->assertEquals(context_module::instance($this->choice->cmid), $events[0]->get_context());
$this->assertEquals(1, $events[0]->other['choiceid']);
$this->assertEquals(3, $events[0]->other['optionid']);
$expected = array($this->course->id, "choice", "choose", 'view.php?id=' . $this->cm->id, $this->choice->id, $this->cm->id);
@@ -128,7 +128,7 @@ public function test_answer_updated() {
$this->assertCount(1, $events);
$this->assertInstanceOf('\mod_choice\event\answer_updated', $events[0]);
$this->assertEquals($user->id, $events[0]->userid);
- $this->assertEquals(context_module::instance($this->choice->id), $events[0]->get_context());
+ $this->assertEquals(context_module::instance($this->choice->cmid), $events[0]->get_context());
$this->assertEquals(1, $events[0]->other['choiceid']);
$this->assertEquals(3, $events[0]->other['optionid']);
$expected = array($this->course->id, "choice", "choose again", 'view.php?id=' . $this->cm->id,
@@ -189,7 +189,7 @@ public function test_report_viewed() {
$this->assertCount(1, $event);
$this->assertInstanceOf('\mod_choice\event\report_viewed', $event[0]);
$this->assertEquals($USER->id, $event[0]->userid);
- $this->assertEquals(context_module::instance($this->choice->id), $event[0]->get_context());
+ $this->assertEquals(context_module::instance($this->choice->cmid), $event[0]->get_context());
$expected = array($this->course->id, "choice", "report", 'report.php?id=' . $this->context->instanceid,
$this->choice->id, $this->context->instanceid);
$this->assertEventLegacyLogData($expected, $event[0]);
@@ -224,7 +224,7 @@ public function test_course_module_viewed() {
$this->assertCount(1, $event);
$this->assertInstanceOf('\mod_choice\event\course_module_viewed', $event[0]);
$this->assertEquals($USER->id, $event[0]->userid);
- $this->assertEquals(context_module::instance($this->choice->id), $event[0]->get_context());
+ $this->assertEquals(context_module::instance($this->choice->cmid), $event[0]->get_context());
$expected = array($this->course->id, "choice", "view", 'view.php?id=' . $this->context->instanceid,
$this->choice->id, $this->context->instanceid);
$this->assertEventLegacyLogData($expected, $event[0]);
View
4 mod/data/tests/lib_test.php
@@ -142,7 +142,7 @@ public function test_data_comment_created_event() {
$contentid = $DB->insert_record('data_content', $datacontent);
$cm = get_coursemodule_from_instance('data', $module->id, $course->id);
- $context = context_module::instance($module->id);
+ $context = context_module::instance($module->cmid);
$cmt = new stdClass();
$cmt->context = $context;
$cmt->course = $course;
@@ -205,7 +205,7 @@ public function test_data_comment_deleted_event() {
$contentid = $DB->insert_record('data_content', $datacontent);
$cm = get_coursemodule_from_instance('data', $module->id, $course->id);
- $context = context_module::instance($module->id);
+ $context = context_module::instance($module->cmid);
$cmt = new stdClass();
$cmt->context = $context;
$cmt->course = $course;
View
2 mod/feedback/tests/events_test.php
@@ -286,7 +286,7 @@ public function test_response_submitted_event() {
// Test legacy data.
$arr = array($this->eventcourse->id, 'feedback', 'submit', 'view.php?id=' . $this->eventcm->id, $this->eventfeedback->id,
- $this->eventfeedback->id, $USER->id);
+ $this->eventcm->id, $USER->id);
$this->assertEventLegacyLogData($arr, $event);
// Test can_view().
View
6 mod/forum/tests/externallib_test.php
@@ -90,7 +90,7 @@ public function test_mod_forum_get_forums_by_courses() {
$enrol->enrol_user($instance2, $user->id);
// Assign capabilities to view forums for forum 2.
- $cm2 = get_coursemodule_from_id('forum', $forum2->id, 0, false, MUST_EXIST);
+ $cm2 = get_coursemodule_from_id('forum', $forum2->cmid, 0, false, MUST_EXIST);
$context2 = context_module::instance($cm2->id);
$newrole = create_role('Role 2', 'role2', 'Role 2 description');
$roleid2 = $this->assignUserCapability('mod/forum:viewdiscussion', $context2->id, $newrole);
@@ -256,13 +256,13 @@ public function test_mod_forum_get_forum_discussions() {
$enrol->enrol_user($instance2, $user1->id);
// Assign capabilities to view discussions for forum 2.
- $cm = get_coursemodule_from_id('forum', $forum2->id, 0, false, MUST_EXIST);
+ $cm = get_coursemodule_from_id('forum', $forum2->cmid, 0, false, MUST_EXIST);
$context = context_module::instance($cm->id);
$newrole = create_role('Role 2', 'role2', 'Role 2 description');
$this->assignUserCapability('mod/forum:viewdiscussion', $context->id, $newrole);
// Assign capabilities to view discussions for forum 3.
- $cm = get_coursemodule_from_id('forum', $forum3->id, 0, false, MUST_EXIST);
+ $cm = get_coursemodule_from_id('forum', $forum3->cmid, 0, false, MUST_EXIST);
$context = context_module::instance($cm->id);
$this->assignUserCapability('mod/forum:viewdiscussion', $context->id, $newrole);
View
2 mod/forum/tests/lib_test.php
@@ -36,7 +36,7 @@ public function test_forum_trigger_content_uploaded_event() {
$this->setUser($user->id);
$fakepost = (object) array('id' => 123, 'message' => 'Yay!', 'discussion' => 100);
- $cm = get_coursemodule_from_instance('forum', $forum->cmid);
+ $cm = get_coursemodule_from_instance('forum', $forum->id);
$fs = get_file_storage();
$dummy = (object) array(
View
4 mod/glossary/tests/events_test.php
@@ -52,7 +52,7 @@ public function test_comment_created() {
$entry = $glossarygenerator->create_content($glossary);
- $context = context_module::instance($glossary->id);
+ $context = context_module::instance($glossary->cmid);
$cm = get_coursemodule_from_instance('data', $glossary->id, $course->id);
$cmt = new stdClass();
$cmt->component = 'mod_glossary';
@@ -96,7 +96,7 @@ public function test_comment_deleted() {
$entry = $glossarygenerator->create_content($glossary);
- $context = context_module::instance($glossary->id);
+ $context = context_module::instance($glossary->cmid);
$cm = get_coursemodule_from_instance('data', $glossary->id, $course->id);
$cmt = new stdClass();
$cmt->component = 'mod_glossary';
View
2 mod/scorm/tests/event_test.php
@@ -78,7 +78,7 @@ public function test_attempt_deleted_event() {
$this->assertEquals(4, $event->other['attemptid']);
$this->assertEquals(2, $event->relateduserid);
$expected = array($this->eventcourse->id, 'scorm', 'delete attempts', 'report.php?id=' . $this->eventcm->id,
- 4, $this->eventscorm->id);
+ 4, $this->eventcm->id);
$this->assertEventLegacyLogData($expected, $events[0]);
$this->assertEventContextNotUsed($event);
View
16 mod/wiki/tests/events_test.php
@@ -237,7 +237,7 @@ public function test_page_viewed() {
$this->assertInstanceOf('\mod_wiki\event\page_viewed', $event);
$this->assertEquals($context, $event->get_context());
$this->assertEquals($page->id, $event->objectid);
- $expected = array($this->course->id, 'wiki', 'view', 'view.php?pageid=' . $page->id, $page->id, $this->wiki->id);
+ $expected = array($this->course->id, 'wiki', 'view', 'view.php?pageid=' . $page->id, $page->id, $this->wiki->cmid);
$this->assertEventLegacyLogData($expected, $event);
$this->assertEventContextNotUsed($event);
}
@@ -272,7 +272,7 @@ public function test_pretty_page_viewed() {
$this->assertInstanceOf('\mod_wiki\event\page_viewed', $event);
$this->assertEquals($context, $event->get_context());
$this->assertEquals($page->id, $event->objectid);
- $expected = array($this->course->id, 'wiki', 'view', 'prettyview.php?pageid=' . $page->id, $page->id, $this->wiki->id);
+ $expected = array($this->course->id, 'wiki', 'view', 'prettyview.php?pageid=' . $page->id, $page->id, $this->wiki->cmid);
$this->assertEventLegacyLogData($expected, $event);
$this->assertEventContextNotUsed($event);
}
@@ -345,7 +345,7 @@ public function test_page_deleted() {
$this->assertInstanceOf('\mod_wiki\event\page_locks_deleted', $event);
$this->assertEquals($context, $event->get_context());
$this->assertEquals($page->id, $event->objectid);
- $expected = array($this->course->id, 'wiki', 'overridelocks', 'view.php?pageid=' . $page->id, $page->id, $this->wiki->id);
+ $expected = array($this->course->id, 'wiki', 'overridelocks', 'view.php?pageid=' . $page->id, $page->id, $this->wiki->cmid);
$this->assertEventLegacyLogData($expected, $event);
// Delete all pages.
@@ -431,7 +431,7 @@ public function test_page_diff_viewed() {
$this->assertEquals($context, $event->get_context());
$this->assertEquals($page->id, $event->objectid);
$expected = array($this->course->id, 'wiki', 'diff', 'diff.php?pageid=' . $page->id . '&comparewith=' .
- 1 . '&compare=' . 2, $page->id, $this->wiki->id);
+ 1 . '&compare=' . 2, $page->id, $this->wiki->cmid);
$this->assertEventLegacyLogData($expected, $event);
$this->assertEventContextNotUsed($event);
}
@@ -465,7 +465,7 @@ public function test_page_history_viewed() {
$this->assertInstanceOf('\mod_wiki\event\page_history_viewed', $event);
$this->assertEquals($context, $event->get_context());
$this->assertEquals($page->id, $event->objectid);
- $expected = array($this->course->id, 'wiki', 'history', 'history.php?pageid=' . $page->id, $page->id, $this->wiki->id);
+ $expected = array($this->course->id, 'wiki', 'history', 'history.php?pageid=' . $page->id, $page->id, $this->wiki->cmid);
$this->assertEventLegacyLogData($expected, $event);
$this->assertEventContextNotUsed($event);
}
@@ -503,7 +503,7 @@ public function test_page_map_viewed() {
$this->assertEquals($context, $event->get_context());
$this->assertEquals($page->id, $event->objectid);
$this->assertEquals(0, $event->other['option']);
- $expected = array($this->course->id, 'wiki', 'map', 'map.php?pageid=' . $page->id, $page->id, $this->wiki->id);
+ $expected = array($this->course->id, 'wiki', 'map', 'map.php?pageid=' . $page->id, $page->id, $this->wiki->cmid);
$this->assertEventLegacyLogData($expected, $event);
$this->assertEventContextNotUsed($event);
}
@@ -542,7 +542,7 @@ public function test_page_version_viewed() {
$this->assertEquals($page->id, $event->objectid);
$this->assertEquals(1, $event->other['versionid']);
$expected = array($this->course->id, 'wiki', 'history', 'viewversion.php?pageid=' . $page->id . '&versionid=1',
- $page->id, $this->wiki->id);
+ $page->id, $this->wiki->cmid);
$this->assertEventLegacyLogData($expected, $event);
$this->assertEventContextNotUsed($event);
}
@@ -569,7 +569,7 @@ public function test_page_version_restored() {
$this->assertEquals($context, $event->get_context());
$this->assertEquals($version->id, $event->objectid);
$this->assertEquals($page->id, $event->other['pageid']);
- $expected = array($this->course->id, 'wiki', 'restore', 'view.php?pageid=' . $page->id, $page->id, $this->wiki->id);
+ $expected = array($this->course->id, 'wiki', 'restore', 'view.php?pageid=' . $page->id, $page->id, $this->wiki->cmid);
$this->assertEventLegacyLogData($expected, $event);
$this->assertEventContextNotUsed($event);
}
View
4 repository/tests/repositorylib_test.php
@@ -246,10 +246,10 @@ public function test_check_capability() {
$forumdata = new stdClass();
$forumdata->course = $course1->id;
$forumc1 = $this->getDataGenerator()->create_module('forum', $forumdata);
- $forumc1context = context_module::instance($forumc1->id);
+ $forumc1context = context_module::instance($forumc1->cmid);
$forumdata->course = $course2->id;
$forumc2 = $this->getDataGenerator()->create_module('forum', $forumdata);
- $forumc2context = context_module::instance($forumc2->id);
+ $forumc2context = context_module::instance($forumc2->cmid);
$blockdata = new stdClass();
$blockdata->parentcontextid = $course1context->id;

0 comments on commit 1b066c0

Please sign in to comment.