MDL-58363 mod_feedback: Remove calendar is_visible

Part of MDL-55611 epic.
This commit is contained in:
Andrew Nicols
2017-04-03 11:37:09 +08:00
committed by Damyon Wiese
parent 89cfa1e6b2
commit b375ec262d
2 changed files with 0 additions and 45 deletions
-12
View File
@@ -3369,18 +3369,6 @@ function feedback_check_updates_since(cm_info $cm, $from, $filter = array()) {
return $updates;
}
/**
* Is the event visible?
*
* @param \core_calendar\event $event
* @return bool Returns true if the event is visible to the current user, false otherwise.
*/
function mod_feedback_core_calendar_is_event_visible(\core_calendar\event $event) {
$cm = get_fast_modinfo($event->courseid)->instances['feedback'][$event->instance];
$context = context_module::instance($cm->id);
return has_capability('mod/feedback:view', $context);
}
/**
* Handles creating actions for events.
*
-33
View File
@@ -137,39 +137,6 @@ class mod_feedback_lib_testcase extends advanced_testcase {
$this->assertCount(1, $updates->attemptsfinished->itemids);
}
/**
* Test calendar event visibility.
*/
public function test_feedback_core_calendar_is_event_visible() {
$this->resetAfterTest();
$this->setAdminUser();
$course = $this->getDataGenerator()->create_course();
$feedback = $this->getDataGenerator()->create_module('feedback', ['course' => $course->id]);
$event = $this->create_action_event($course->id, $feedback->id, FEEDBACK_EVENT_TYPE_OPEN);
$this->assertTrue(mod_feedback_core_calendar_is_event_visible($event));
}
/**
* Test calendar event visibility to a non-user.
*/
public function test_feedback_core_calendar_is_event_visible_as_non_user() {
global $CFG;
$this->resetAfterTest();
$this->setAdminUser();
$course = $this->getDataGenerator()->create_course();
$feedback = $this->getDataGenerator()->create_module('feedback', array('course' => $course->id));
$event = $this->create_action_event($course->id, $feedback->id, FEEDBACK_EVENT_TYPE_OPEN);
// Log out the user and set force login to true.
\core\session\manager::init_empty_session();
$CFG->forcelogin = true;
$this->assertFalse(mod_feedback_core_calendar_is_event_visible($event));
}
/**
* Test calendar event provide action open.
*/