diff --git a/mod/workshop/lib.php b/mod/workshop/lib.php index 273675b57cd..29df113505c 100644 --- a/mod/workshop/lib.php +++ b/mod/workshop/lib.php @@ -1786,18 +1786,6 @@ function workshop_calendar_update(stdClass $workshop, $cmid) { } } -/** - * 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_workshop_core_calendar_is_event_visible(\core_calendar\event $event) { - $cm = get_fast_modinfo($event->courseid)->instances['workshop'][$event->instance]; - $context = context_module::instance($cm->id); - return has_capability('mod/workshop:view', $context); -} - /** * Handles creating actions for events. * diff --git a/mod/workshop/tests/lib_test.php b/mod/workshop/tests/lib_test.php index ddb7eb4933a..9d75a755248 100644 --- a/mod/workshop/tests/lib_test.php +++ b/mod/workshop/tests/lib_test.php @@ -31,43 +31,7 @@ require_once($CFG->dirroot . '/mod/workshop/lib.php'); * @copyright 2017 Simey Lameze * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class mod_workshop_lib_testcase extends advanced_testcase -{ - - /** - * Test calendar event visibility. - */ - public function test_workshop_core_calendar_is_event_visible() - { - $this->resetAfterTest(); - $this->setAdminUser(); - - $course = $this->getDataGenerator()->create_course(); - $workshop = $this->getDataGenerator()->create_module('workshop', ['course' => $course->id]); - $event = $this->create_action_event($course->id, $workshop->id, WORKSHOP_EVENT_TYPE_SUBMISSION_OPEN); - - $this->assertTrue(mod_workshop_core_calendar_is_event_visible($event)); - } - - /** - * Test calendar event visibility to a non-user. - */ - public function test_workshop_core_calendar_is_event_visible_as_non_user() - { - global $CFG; - $this->resetAfterTest(); - $this->setAdminUser(); - - $course = $this->getDataGenerator()->create_course(); - $workshop = $this->getDataGenerator()->create_module('workshop', array('course' => $course->id)); - $event = $this->create_action_event($course->id, $workshop->id, WORKSHOP_EVENT_TYPE_SUBMISSION_OPEN); - - // Log out the user and set force login to true. - \core\session\manager::init_empty_session(); - $CFG->forcelogin = true; - - $this->assertFalse(mod_workshop_core_calendar_is_event_visible($event)); - } +class mod_workshop_lib_testcase extends advanced_testcase { /** * Test calendar event provide action open.