mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-82457 core: Remove chat and survey dependencies
* Remove chat and survey plugins from the standard plugins * Remove all related tables and settings from both plugins using upgrade. * Remove temporary admin notification (MDL-82297) and strings. * PHP Unit: - Remove chat and survey as a sample module for unit testing replacing it with assignment module when possible (if not page). - Remove chat and survey from bulk update test * Behat: Remove chat and survey behat tests
This commit is contained in:
parent
8e5ac0e34f
commit
2be6563324
@ -295,7 +295,6 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
|
||||
$output .= $this->header();
|
||||
$output .= $this->output->heading(get_string('notifications', 'admin'));
|
||||
$output .= $this->upgrade_news_message();
|
||||
$output .= $this->maturity_info($maturity);
|
||||
$output .= empty($CFG->disableupdatenotifications) ? $this->available_updates($availableupdates, $availableupdatesfetch) : '';
|
||||
$output .= $this->insecure_dataroot_warning($insecuredataroot);
|
||||
@ -755,22 +754,6 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
return $this->box($copyrighttext, 'copyright');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a transient notification for important upgrades messages for
|
||||
* specific releases.
|
||||
*
|
||||
* @return string HTML to output.
|
||||
*/
|
||||
protected function upgrade_news_message() {
|
||||
return $this->notification(
|
||||
get_string('importantupdates_content', 'admin'),
|
||||
'info',
|
||||
false,
|
||||
get_string('importantupdates_title', 'admin'),
|
||||
'i/circleinfo, core'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a warning about installing development code if necesary.
|
||||
* @param int $maturity
|
||||
|
@ -77,7 +77,7 @@ class provider_test extends provider_testcase {
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$course2 = $this->getDataGenerator()->create_course();
|
||||
$coursecat = $this->getDataGenerator()->create_category();
|
||||
$cm = $this->getDataGenerator()->create_module('chat', ['course' => $course->id]);
|
||||
$cm = $this->getDataGenerator()->create_module('assign', ['course' => $course->id]);
|
||||
$cmcontext = \context_module::instance($cm->cmid);
|
||||
$page = $this->getDataGenerator()->create_module('page', array('course' => $course->id));
|
||||
$cmcontext2 = \context_module::instance($page->cmid);
|
||||
@ -125,7 +125,7 @@ class provider_test extends provider_testcase {
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$course2 = $this->getDataGenerator()->create_course();
|
||||
$coursecat = $this->getDataGenerator()->create_category();
|
||||
$cm = $this->getDataGenerator()->create_module('chat', ['course' => $course->id]);
|
||||
$cm = $this->getDataGenerator()->create_module('assign', ['course' => $course->id]);
|
||||
$cmcontext = \context_module::instance($cm->cmid);
|
||||
$page = $this->getDataGenerator()->create_module('page', array('course' => $course->id));
|
||||
$cmcontext2 = \context_module::instance($page->cmid);
|
||||
@ -257,7 +257,7 @@ class provider_test extends provider_testcase {
|
||||
$coursecat = $this->getDataGenerator()->create_category();
|
||||
$coursecatcontext = \context_coursecat::instance($coursecat->id);
|
||||
$systemcontext = \context_system::instance();
|
||||
$cm = $this->getDataGenerator()->create_module('chat', ['course' => $course->id]);
|
||||
$cm = $this->getDataGenerator()->create_module('assign', ['course' => $course->id]);
|
||||
$cmcontext = \context_module::instance($cm->cmid);
|
||||
$student = $DB->get_record('role', array('shortname' => 'student'), '*', MUST_EXIST);
|
||||
$manager = $DB->get_record('role', array('shortname' => 'manager'), '*', MUST_EXIST);
|
||||
@ -348,7 +348,7 @@ class provider_test extends provider_testcase {
|
||||
$coursecat = $this->getDataGenerator()->create_category();
|
||||
$coursecatcontext = \context_coursecat::instance($coursecat->id);
|
||||
$systemcontext = \context_system::instance();
|
||||
$cm = $this->getDataGenerator()->create_module('chat', ['course' => $course->id]);
|
||||
$cm = $this->getDataGenerator()->create_module('assign', ['course' => $course->id]);
|
||||
$cmcontext = \context_module::instance($cm->cmid);
|
||||
$student = $DB->get_record('role', array('shortname' => 'student'), '*', MUST_EXIST);
|
||||
$manager = $DB->get_record('role', array('shortname' => 'manager'), '*', MUST_EXIST);
|
||||
@ -499,8 +499,8 @@ class provider_test extends provider_testcase {
|
||||
// Create course category.
|
||||
$coursecat = $this->getDataGenerator()->create_category();
|
||||
$coursecatcontext = \context_coursecat::instance($coursecat->id);
|
||||
// Create chat module.
|
||||
$cm = $this->getDataGenerator()->create_module('chat', ['course' => $course1->id]);
|
||||
// Create assignment module.
|
||||
$cm = $this->getDataGenerator()->create_module('assign', ['course' => $course1->id]);
|
||||
$cmcontext = \context_module::instance($cm->cmid);
|
||||
|
||||
$systemcontext = \context_system::instance();
|
||||
@ -619,8 +619,8 @@ class provider_test extends provider_testcase {
|
||||
// Create course category.
|
||||
$coursecat = $this->getDataGenerator()->create_category();
|
||||
$coursecatcontext = \context_coursecat::instance($coursecat->id);
|
||||
// Create chat module.
|
||||
$cm = $this->getDataGenerator()->create_module('chat', ['course' => $course1->id]);
|
||||
// Create assignment module.
|
||||
$cm = $this->getDataGenerator()->create_module('assign', ['course' => $course1->id]);
|
||||
$cmcontext = \context_module::instance($cm->cmid);
|
||||
|
||||
$systemcontext = \context_system::instance();
|
||||
|
@ -150,13 +150,10 @@ Feature: Set up contextual data for tests
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname |
|
||||
| Course 1 | C1 |
|
||||
And I enable "chat" "mod" plugin
|
||||
And I enable "survey" "mod" plugin
|
||||
And the following "activities" exist:
|
||||
| activity | name | intro | course | idnumber |
|
||||
| assign | Test assignment name | Test assignment description | C1 | assign1 |
|
||||
| book | Test book name | Test book description | C1 | book1 |
|
||||
| chat | Test chat name | Test chat description | C1 | chat1 |
|
||||
| choice | Test choice name | Test choice description | C1 | choice1 |
|
||||
| data | Test database name | Test database description | C1 | data1 |
|
||||
| feedback | Test feedback name | Test feedback description | C1 | feedback1 |
|
||||
@ -171,7 +168,6 @@ Feature: Set up contextual data for tests
|
||||
| quiz | Test quiz name | Test quiz description | C1 | quiz1 |
|
||||
| resource | Test resource name | Test resource description | C1 | resource1 |
|
||||
| scorm | Test scorm name | Test scorm description | C1 | scorm1 |
|
||||
| survey | Test survey name | Test survey description | C1 | survey1 |
|
||||
| url | Test url name | Test url description | C1 | url1 |
|
||||
| wiki | Test wiki name | Test wiki description | C1 | wiki1 |
|
||||
| workshop | Test workshop name | Test workshop description | C1 | workshop1 |
|
||||
@ -186,7 +182,6 @@ Feature: Set up contextual data for tests
|
||||
# Assignment 2.2 module type is disabled by default
|
||||
# And I should see "Test assignment22 name"
|
||||
And I should see "Test book name"
|
||||
And I should see "Test chat name"
|
||||
And I should see "Test choice name"
|
||||
And I should see "Test database name"
|
||||
# Feedback module type is disabled by default
|
||||
@ -203,7 +198,6 @@ Feature: Set up contextual data for tests
|
||||
And I should see "Test quiz name"
|
||||
And I should see "Test resource name"
|
||||
And I should see "Test scorm name"
|
||||
And I should see "Test survey name"
|
||||
And I should see "Test url name"
|
||||
And I should see "Test wiki name"
|
||||
And I should see "Test workshop name"
|
||||
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
/**
|
||||
* Definition of chat scheduled tasks.
|
||||
* Definition of mnet scheduled tasks.
|
||||
*
|
||||
* @package auth_mnet
|
||||
* @copyright 2019 Simey Lameze <simey@moodle.com>
|
||||
|
@ -529,24 +529,6 @@
|
||||
<TIMEMODIFIED>1311692185</TIMEMODIFIED>
|
||||
<MODIFIERID>0</MODIFIERID>
|
||||
</CAPABILITY>
|
||||
<CAPABILITY>
|
||||
<NAME>mod/survey:readresponses</NAME>
|
||||
<PERMISSION>1</PERMISSION>
|
||||
<TIMEMODIFIED>1311692181</TIMEMODIFIED>
|
||||
<MODIFIERID>0</MODIFIERID>
|
||||
</CAPABILITY>
|
||||
<CAPABILITY>
|
||||
<NAME>mod/survey:participate</NAME>
|
||||
<PERMISSION>1</PERMISSION>
|
||||
<TIMEMODIFIED>1311692181</TIMEMODIFIED>
|
||||
<MODIFIERID>0</MODIFIERID>
|
||||
</CAPABILITY>
|
||||
<CAPABILITY>
|
||||
<NAME>mod/survey:download</NAME>
|
||||
<PERMISSION>1</PERMISSION>
|
||||
<TIMEMODIFIED>1311692181</TIMEMODIFIED>
|
||||
<MODIFIERID>0</MODIFIERID>
|
||||
</CAPABILITY>
|
||||
<CAPABILITY>
|
||||
<NAME>mod/scorm:viewscores</NAME>
|
||||
<PERMISSION>1</PERMISSION>
|
||||
@ -907,24 +889,6 @@
|
||||
<TIMEMODIFIED>1311692127</TIMEMODIFIED>
|
||||
<MODIFIERID>0</MODIFIERID>
|
||||
</CAPABILITY>
|
||||
<CAPABILITY>
|
||||
<NAME>mod/chat:readlog</NAME>
|
||||
<PERMISSION>1</PERMISSION>
|
||||
<TIMEMODIFIED>1311692125</TIMEMODIFIED>
|
||||
<MODIFIERID>0</MODIFIERID>
|
||||
</CAPABILITY>
|
||||
<CAPABILITY>
|
||||
<NAME>mod/chat:deletelog</NAME>
|
||||
<PERMISSION>1</PERMISSION>
|
||||
<TIMEMODIFIED>1311692125</TIMEMODIFIED>
|
||||
<MODIFIERID>0</MODIFIERID>
|
||||
</CAPABILITY>
|
||||
<CAPABILITY>
|
||||
<NAME>mod/chat:chat</NAME>
|
||||
<PERMISSION>1</PERMISSION>
|
||||
<TIMEMODIFIED>1311692125</TIMEMODIFIED>
|
||||
<MODIFIERID>0</MODIFIERID>
|
||||
</CAPABILITY>
|
||||
<CAPABILITY>
|
||||
<NAME>mod/assignment:view</NAME>
|
||||
<PERMISSION>1</PERMISSION>
|
||||
@ -1166,12 +1130,6 @@
|
||||
<TIMEMODIFIED>1311692184</TIMEMODIFIED>
|
||||
<MODIFIERID>0</MODIFIERID>
|
||||
</CAPABILITY>
|
||||
<CAPABILITY>
|
||||
<NAME>mod/survey:participate</NAME>
|
||||
<PERMISSION>1</PERMISSION>
|
||||
<TIMEMODIFIED>1311692181</TIMEMODIFIED>
|
||||
<MODIFIERID>0</MODIFIERID>
|
||||
</CAPABILITY>
|
||||
<CAPABILITY>
|
||||
<NAME>mod/scorm:viewscores</NAME>
|
||||
<PERMISSION>1</PERMISSION>
|
||||
@ -1298,18 +1256,6 @@
|
||||
<TIMEMODIFIED>1311692127</TIMEMODIFIED>
|
||||
<MODIFIERID>0</MODIFIERID>
|
||||
</CAPABILITY>
|
||||
<CAPABILITY>
|
||||
<NAME>mod/chat:readlog</NAME>
|
||||
<PERMISSION>1</PERMISSION>
|
||||
<TIMEMODIFIED>1311692125</TIMEMODIFIED>
|
||||
<MODIFIERID>0</MODIFIERID>
|
||||
</CAPABILITY>
|
||||
<CAPABILITY>
|
||||
<NAME>mod/chat:chat</NAME>
|
||||
<PERMISSION>1</PERMISSION>
|
||||
<TIMEMODIFIED>1311692125</TIMEMODIFIED>
|
||||
<MODIFIERID>0</MODIFIERID>
|
||||
</CAPABILITY>
|
||||
<CAPABILITY>
|
||||
<NAME>mod/assignment:view</NAME>
|
||||
<PERMISSION>1</PERMISSION>
|
||||
|
@ -312,7 +312,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
|
||||
$component = 'core_backup';
|
||||
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$activity = $this->getDataGenerator()->create_module('chat', ['course' => $course->id]);
|
||||
$activity = $this->getDataGenerator()->create_module('assign', ['course' => $course->id]);
|
||||
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
$user2 = $this->getDataGenerator()->create_user();
|
||||
@ -408,7 +408,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
|
||||
$course2 = $this->getDataGenerator()->create_course();
|
||||
$coursecontext2 = \context_course::instance($course2->id);
|
||||
// Create an activity.
|
||||
$activity = $this->getDataGenerator()->create_module('chat', ['course' => $course1->id]);
|
||||
$activity = $this->getDataGenerator()->create_module('assign', ['course' => $course1->id]);
|
||||
$activitycontext = \context_module::instance($activity->cmid);
|
||||
// Create user1.
|
||||
$user1 = $this->getDataGenerator()->create_user();
|
||||
|
@ -4,16 +4,11 @@ Feature: Block activity modules
|
||||
As a manager
|
||||
I can add activities block in a course or on the frontpage
|
||||
|
||||
Background:
|
||||
Given I enable "chat" "mod" plugin
|
||||
And I enable "survey" "mod" plugin
|
||||
|
||||
Scenario: Add activities block on the frontpage
|
||||
Given the following "activities" exist:
|
||||
| activity | name | intro | course | idnumber |
|
||||
| assign | Frontpage assignment name | Frontpage assignment description | Acceptance test site | assign0 |
|
||||
| book | Frontpage book name | Frontpage book description | Acceptance test site | book0 |
|
||||
| chat | Frontpage chat name | Frontpage chat description | Acceptance test site | chat0 |
|
||||
| choice | Frontpage choice name | Frontpage choice description | Acceptance test site | choice0 |
|
||||
| data | Frontpage database name | Frontpage database description | Acceptance test site | data0 |
|
||||
| feedback | Frontpage feedback name | Frontpage feedback description | Acceptance test site | feedback0 |
|
||||
@ -28,7 +23,6 @@ Feature: Block activity modules
|
||||
| glossary | Frontpage glossary name | Frontpage glossary description | Acceptance test site | glossary0 |
|
||||
| scorm | Frontpage scorm name | Frontpage scorm description | Acceptance test site | scorm0 |
|
||||
| lesson | Frontpage lesson name | Frontpage lesson description | Acceptance test site | lesson0 |
|
||||
| survey | Frontpage survey name | Frontpage survey description | Acceptance test site | survey0 |
|
||||
| url | Frontpage url name | Frontpage url description | Acceptance test site | url0 |
|
||||
| wiki | Frontpage wiki name | Frontpage wiki description | Acceptance test site | wiki0 |
|
||||
| workshop | Frontpage workshop name | Frontpage workshop description | Acceptance test site | workshop0 |
|
||||
@ -40,9 +34,6 @@ Feature: Block activity modules
|
||||
And I click on "Assignments" "link" in the "Activities" "block"
|
||||
Then I should see "Frontpage assignment name"
|
||||
And I am on site homepage
|
||||
And I click on "Chats" "link" in the "Activities" "block"
|
||||
And I should see "Frontpage chat name"
|
||||
And I am on site homepage
|
||||
And I click on "Choices" "link" in the "Activities" "block"
|
||||
And I should see "Frontpage choice name"
|
||||
And I am on site homepage
|
||||
@ -92,7 +83,6 @@ Feature: Block activity modules
|
||||
| activity | name | intro | course | idnumber |
|
||||
| assign | Test assignment name | Test assignment description | C1 | assign1 |
|
||||
| book | Test book name | Test book description | C1 | book1 |
|
||||
| chat | Test chat name | Test chat description | C1 | chat1 |
|
||||
| choice | Test choice name | Test choice description | C1 | choice1 |
|
||||
| data | Test database name | Test database description | C1 | data1 |
|
||||
| feedback | Test feedback name | Test feedback description | C1 | feedback1 |
|
||||
@ -107,7 +97,6 @@ Feature: Block activity modules
|
||||
| quiz | Test quiz name | Test quiz description | C1 | quiz1 |
|
||||
| resource | Test resource name | Test resource description | C1 | resource1 |
|
||||
| scorm | Test scorm name | Test scorm description | C1 | scorm1 |
|
||||
| survey | Test survey name | Test survey description | C1 | survey1 |
|
||||
| url | Test url name | Test url description | C1 | url1 |
|
||||
| wiki | Test wiki name | Test wiki description | C1 | wiki1 |
|
||||
| workshop | Test workshop name | Test workshop description | C1 | workshop1 |
|
||||
@ -118,9 +107,6 @@ Feature: Block activity modules
|
||||
And I click on "Assignments" "link" in the "Activities" "block"
|
||||
Then I should see "Test assignment name"
|
||||
And I am on "Course 1" course homepage
|
||||
And I click on "Chats" "link" in the "Activities" "block"
|
||||
And I should see "Test chat name"
|
||||
And I am on "Course 1" course homepage
|
||||
And I click on "Choices" "link" in the "Activities" "block"
|
||||
And I should see "Test choice name"
|
||||
And I am on "Course 1" course homepage
|
||||
|
@ -84,8 +84,8 @@ class externallib_test extends externallib_advanced_testcase {
|
||||
|
||||
// Student access all assignments.
|
||||
foreach ($assign as $module) {
|
||||
$event = \mod_chat\event\course_module_viewed::create(array('context' => \context_module::instance($module->cmid),
|
||||
'objectid' => $module->id));
|
||||
$event = \mod_assign\event\course_module_viewed::create(['context' => \context_module::instance($module->cmid),
|
||||
'objectid' => $module->id]);
|
||||
$event->trigger();
|
||||
$this->waitForSecond();
|
||||
}
|
||||
|
@ -56,8 +56,8 @@ class observer_test extends \advanced_testcase {
|
||||
/** @var \stdClass course glossary. */
|
||||
protected $glossary;
|
||||
|
||||
/** @var \stdClass course chat. */
|
||||
protected $chat;
|
||||
/** @var \stdClass course assignment. */
|
||||
protected $assign;
|
||||
|
||||
/**
|
||||
* Set up for every test
|
||||
@ -88,7 +88,7 @@ class observer_test extends \advanced_testcase {
|
||||
// Create items.
|
||||
$this->forum = $this->getDataGenerator()->create_module('forum', array('course' => $this->course));
|
||||
$this->glossary = $this->getDataGenerator()->create_module('glossary', array('course' => $this->course));
|
||||
$this->chat = $this->getDataGenerator()->create_module('chat', array('course' => $this->course));
|
||||
$this->assign = $this->getDataGenerator()->create_module('assign', ['course' => $this->course]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -109,28 +109,28 @@ class observer_test extends \advanced_testcase {
|
||||
'objectid' => $this->forum->id));
|
||||
$event->trigger();
|
||||
|
||||
// Student access chat activity.
|
||||
// Student access assignment activity.
|
||||
$this->setUser($this->student);
|
||||
$event1 = \mod_chat\event\course_module_viewed::create(array('context' => \context_module::instance($this->chat->cmid),
|
||||
'objectid' => $this->chat->id));
|
||||
$event1 = \mod_assign\event\course_module_viewed::create(['context' => \context_module::instance($this->assign->cmid),
|
||||
'objectid' => $this->assign->id]);
|
||||
$event1->trigger();
|
||||
|
||||
$records = $DB->count_records($this->table, array('userid' => $this->teacher->id, 'courseid' => $this->course->id,
|
||||
'cmid' => $this->forum->cmid));
|
||||
$this->assertEquals(1, $records);
|
||||
|
||||
$records = $DB->count_records($this->table, array('userid' => $this->student->id, 'courseid' => $this->course->id, 'cmid' =>
|
||||
$this->chat->cmid));
|
||||
$records = $DB->count_records($this->table, ['userid' => $this->student->id, 'courseid' => $this->course->id, 'cmid' =>
|
||||
$this->assign->cmid]);
|
||||
$this->assertEquals(1, $records);
|
||||
|
||||
$this->waitForSecond();
|
||||
// Student access chat activity again after 1 second (no new record created, timeaccess updated).
|
||||
$event2 = \mod_chat\event\course_module_viewed::create(array('context' => \context_module::instance($this->chat->cmid),
|
||||
'objectid' => $this->chat->id));
|
||||
// Student access assignment activity again after 1 second (no new record created, timeaccess updated).
|
||||
$event2 = \mod_assign\event\course_module_viewed::create(['context' => \context_module::instance($this->assign->cmid),
|
||||
'objectid' => $this->assign->id]);
|
||||
$event2->trigger();
|
||||
|
||||
$records = $DB->get_records($this->table, array('userid' => $this->student->id, 'courseid' => $this->course->id, 'cmid' =>
|
||||
$this->chat->cmid));
|
||||
$records = $DB->get_records($this->table, ['userid' => $this->student->id, 'courseid' => $this->course->id, 'cmid' =>
|
||||
$this->assign->cmid]);
|
||||
$this->assertCount(1, $records);
|
||||
$this->assertEquals($event2->timecreated, array_shift($records)->timeaccess);
|
||||
|
||||
@ -154,15 +154,15 @@ class observer_test extends \advanced_testcase {
|
||||
'objectid' => $this->forum->id));
|
||||
$event->trigger();
|
||||
|
||||
// Teacher access chat activity.
|
||||
$event = \mod_chat\event\course_module_viewed::create(array('context' => \context_module::instance($this->chat->cmid),
|
||||
'objectid' => $this->chat->id));
|
||||
// Teacher access assignment activity.
|
||||
$event = \mod_assign\event\course_module_viewed::create(['context' => \context_module::instance($this->assign->cmid),
|
||||
'objectid' => $this->assign->id]);
|
||||
$event->trigger();
|
||||
|
||||
// Student access chat activity.
|
||||
// Student access assignment activity.
|
||||
$this->setUser($this->student);
|
||||
$event = \mod_chat\event\course_module_viewed::create(array('context' => \context_module::instance($this->chat->cmid),
|
||||
'objectid' => $this->chat->id));
|
||||
$event = \mod_assign\event\course_module_viewed::create(['context' => \context_module::instance($this->assign->cmid),
|
||||
'objectid' => $this->assign->id]);
|
||||
$event->trigger();
|
||||
|
||||
// Student access forum activity.
|
||||
@ -175,7 +175,7 @@ class observer_test extends \advanced_testcase {
|
||||
course_delete_module($this->forum->cmid);
|
||||
$records = $DB->count_records($this->table, array('cmid' => $this->forum->cmid));
|
||||
$this->assertEquals(0, $records);
|
||||
$records = $DB->count_records($this->table, array('cmid' => $this->chat->cmid));
|
||||
$records = $DB->count_records($this->table, ['cmid' => $this->assign->cmid]);
|
||||
$this->assertEquals(2, $records);
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
|
||||
$generator->enrol_user($student->id, $course->id, 'student');
|
||||
$generator->enrol_user($teacher->id, $course->id, 'teacher');
|
||||
$forum = $generator->create_module('forum', ['course' => $course]);
|
||||
$chat = $generator->create_module('chat', ['course' => $course]);
|
||||
$assign = $generator->create_module('assign', ['course' => $course]);
|
||||
|
||||
// Check nothing is found before block is populated.
|
||||
$contextlist1 = provider::get_contexts_for_userid($student->id);
|
||||
@ -72,8 +72,8 @@ class provider_test extends \core_privacy\tests\provider_testcase {
|
||||
$event->trigger();
|
||||
|
||||
$this->setUser($teacher);
|
||||
$event = \mod_chat\event\course_module_viewed::create(['context' => \context_module::instance($chat->cmid),
|
||||
'objectid' => $chat->id]);
|
||||
$event = \mod_assign\event\course_module_viewed::create(['context' => \context_module::instance($assign->cmid),
|
||||
'objectid' => $assign->id]);
|
||||
$event->trigger();
|
||||
|
||||
// Ensure provider only fetches the users's own context.
|
||||
@ -104,7 +104,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
|
||||
$generator->enrol_user($student->id, $course->id, 'student');
|
||||
$generator->enrol_user($teacher->id, $course->id, 'teacher');
|
||||
$forum = $generator->create_module('forum', ['course' => $course]);
|
||||
$chat = $generator->create_module('chat', ['course' => $course]);
|
||||
$assign = $generator->create_module('assign', ['course' => $course]);
|
||||
|
||||
// Check nothing is found before block is populated.
|
||||
$userlist1 = new \core_privacy\local\request\userlist($studentcontext, $component);
|
||||
@ -119,16 +119,16 @@ class provider_test extends \core_privacy\tests\provider_testcase {
|
||||
$event = \mod_forum\event\course_module_viewed::create(['context' => \context_module::instance($forum->cmid),
|
||||
'objectid' => $forum->id]);
|
||||
$event->trigger();
|
||||
$event = \mod_chat\event\course_module_viewed::create(['context' => \context_module::instance($chat->cmid),
|
||||
'objectid' => $chat->id]);
|
||||
$event = \mod_assign\event\course_module_viewed::create(['context' => \context_module::instance($assign->cmid),
|
||||
'objectid' => $assign->id]);
|
||||
$event->trigger();
|
||||
|
||||
$this->setUser($teacher);
|
||||
$event = \mod_forum\event\course_module_viewed::create(['context' => \context_module::instance($forum->cmid),
|
||||
'objectid' => $forum->id]);
|
||||
$event->trigger();
|
||||
$event = \mod_chat\event\course_module_viewed::create(['context' => \context_module::instance($chat->cmid),
|
||||
'objectid' => $chat->id]);
|
||||
$event = \mod_assign\event\course_module_viewed::create(['context' => \context_module::instance($assign->cmid),
|
||||
'objectid' => $assign->id]);
|
||||
$event->trigger();
|
||||
|
||||
// Ensure provider only fetches the user whose user context is checked.
|
||||
@ -182,15 +182,15 @@ class provider_test extends \core_privacy\tests\provider_testcase {
|
||||
$course = $generator->create_course();
|
||||
$generator->enrol_user($student->id, $course->id, 'student');
|
||||
$forum = $generator->create_module('forum', ['course' => $course]);
|
||||
$chat = $generator->create_module('chat', ['course' => $course]);
|
||||
$assign = $generator->create_module('assign', ['course' => $course]);
|
||||
|
||||
// Generate some recent activity.
|
||||
$this->setUser($student);
|
||||
$event = \mod_forum\event\course_module_viewed::create(['context' => \context_module::instance($forum->cmid),
|
||||
'objectid' => $forum->id]);
|
||||
$event->trigger();
|
||||
$event = \mod_chat\event\course_module_viewed::create(['context' => \context_module::instance($chat->cmid),
|
||||
'objectid' => $chat->id]);
|
||||
$event = \mod_assign\event\course_module_viewed::create(['context' => \context_module::instance($assign->cmid),
|
||||
'objectid' => $assign->id]);
|
||||
$event->trigger();
|
||||
|
||||
// Confirm data is present.
|
||||
@ -235,15 +235,15 @@ class provider_test extends \core_privacy\tests\provider_testcase {
|
||||
$course = $generator->create_course();
|
||||
$generator->enrol_user($student->id, $course->id, 'student');
|
||||
$forum = $generator->create_module('forum', ['course' => $course]);
|
||||
$chat = $generator->create_module('chat', ['course' => $course]);
|
||||
$assign = $generator->create_module('assign', ['course' => $course]);
|
||||
|
||||
// Generate some recent activity.
|
||||
$this->setUser($student);
|
||||
$event = \mod_forum\event\course_module_viewed::create(['context' => \context_module::instance($forum->cmid),
|
||||
'objectid' => $forum->id]);
|
||||
$event->trigger();
|
||||
$event = \mod_chat\event\course_module_viewed::create(['context' => \context_module::instance($chat->cmid),
|
||||
'objectid' => $chat->id]);
|
||||
$event = \mod_assign\event\course_module_viewed::create(['context' => \context_module::instance($assign->cmid),
|
||||
'objectid' => $assign->id]);
|
||||
$event->trigger();
|
||||
|
||||
// Confirm data is present.
|
||||
@ -283,7 +283,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
|
||||
$generator->enrol_user($student->id, $course->id, 'student');
|
||||
$generator->enrol_user($teacher->id, $course->id, 'teacher');
|
||||
$forum = $generator->create_module('forum', ['course' => $course]);
|
||||
$chat = $generator->create_module('chat', ['course' => $course]);
|
||||
$assign = $generator->create_module('assign', ['course' => $course]);
|
||||
|
||||
// Generate some recent activity for both users.
|
||||
$users = [$student, $teacher];
|
||||
@ -292,8 +292,8 @@ class provider_test extends \core_privacy\tests\provider_testcase {
|
||||
$event = \mod_forum\event\course_module_viewed::create(['context' => \context_module::instance($forum->cmid),
|
||||
'objectid' => $forum->id]);
|
||||
$event->trigger();
|
||||
$event = \mod_chat\event\course_module_viewed::create(['context' => \context_module::instance($chat->cmid),
|
||||
'objectid' => $chat->id]);
|
||||
$event = \mod_assign\event\course_module_viewed::create(['context' => \context_module::instance($assign->cmid),
|
||||
'objectid' => $assign->id]);
|
||||
$event->trigger();
|
||||
}
|
||||
|
||||
@ -353,7 +353,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
|
||||
$generator->enrol_user($student->id, $course->id, 'student');
|
||||
$generator->enrol_user($teacher->id, $course->id, 'teacher');
|
||||
$forum = $generator->create_module('forum', ['course' => $course]);
|
||||
$chat = $generator->create_module('chat', ['course' => $course]);
|
||||
$assign = $generator->create_module('assign', ['course' => $course]);
|
||||
|
||||
// Generate some recent activity for both users.
|
||||
$users = [$student, $teacher];
|
||||
@ -362,8 +362,8 @@ class provider_test extends \core_privacy\tests\provider_testcase {
|
||||
$event = \mod_forum\event\course_module_viewed::create(['context' => \context_module::instance($forum->cmid),
|
||||
'objectid' => $forum->id]);
|
||||
$event->trigger();
|
||||
$event = \mod_chat\event\course_module_viewed::create(['context' => \context_module::instance($chat->cmid),
|
||||
'objectid' => $chat->id]);
|
||||
$event = \mod_assign\event\course_module_viewed::create(['context' => \context_module::instance($assign->cmid),
|
||||
'objectid' => $assign->id]);
|
||||
$event->trigger();
|
||||
}
|
||||
|
||||
@ -433,7 +433,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
|
||||
$generator->enrol_user($student->id, $course->id, 'student');
|
||||
$generator->enrol_user($teacher->id, $course->id, 'teacher');
|
||||
$forum = $generator->create_module('forum', ['course' => $course]);
|
||||
$chat = $generator->create_module('chat', ['course' => $course]);
|
||||
$assign = $generator->create_module('assign', ['course' => $course]);
|
||||
|
||||
// Generate some recent activity for all users.
|
||||
$users = [$student, $teacher];
|
||||
@ -442,8 +442,8 @@ class provider_test extends \core_privacy\tests\provider_testcase {
|
||||
$event = \mod_forum\event\course_module_viewed::create(['context' => \context_module::instance($forum->cmid),
|
||||
'objectid' => $forum->id]);
|
||||
$event->trigger();
|
||||
$event = \mod_chat\event\course_module_viewed::create(['context' => \context_module::instance($chat->cmid),
|
||||
'objectid' => $chat->id]);
|
||||
$event = \mod_assign\event\course_module_viewed::create(['context' => \context_module::instance($assign->cmid),
|
||||
'objectid' => $assign->id]);
|
||||
$event->trigger();
|
||||
}
|
||||
|
||||
|
@ -42,8 +42,6 @@ class bulk_update_test extends \advanced_testcase {
|
||||
'assign-2' => ['assign', ['completion' => COMPLETION_TRACKING_MANUAL]],
|
||||
'book-1' => ['book', ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionview' => 1]],
|
||||
'book-2' => ['book', ['completion' => COMPLETION_TRACKING_MANUAL]],
|
||||
'chat-1' => ['chat', ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionview' => 1]],
|
||||
'chat-2' => ['chat', ['completion' => COMPLETION_TRACKING_MANUAL]],
|
||||
'choice-1' => ['choice', ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionsubmit' => 1]],
|
||||
'choice-2' => ['choice', ['completion' => COMPLETION_TRACKING_MANUAL]],
|
||||
'data-1' => ['data', ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionview' => 1]],
|
||||
@ -94,8 +92,6 @@ class bulk_update_test extends \advanced_testcase {
|
||||
],
|
||||
],
|
||||
'scorm-2' => ['scorm', ['completion' => COMPLETION_TRACKING_MANUAL]],
|
||||
'survey-1' => ['survey', ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionsubmit' => 1]],
|
||||
'survey-2' => ['survey', ['completion' => COMPLETION_TRACKING_MANUAL]],
|
||||
'url-1' => ['url', ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionview' => 1]],
|
||||
'url-2' => ['url', ['completion' => COMPLETION_TRACKING_MANUAL]],
|
||||
'wiki-1' => ['wiki', ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionview' => 1]],
|
||||
@ -158,11 +154,6 @@ class bulk_update_test extends \advanced_testcase {
|
||||
protected function create_course_and_modules($modulenames) {
|
||||
global $CFG, $PAGE;
|
||||
|
||||
// Chat and Survey modules are disabled by default, enable them for testing.
|
||||
$manager = \core_plugin_manager::resolve_plugininfo_class('mod');
|
||||
$manager::enable_plugin('chat', 1);
|
||||
$manager::enable_plugin('survey', 1);
|
||||
|
||||
$CFG->enablecompletion = true;
|
||||
$course = $this->getDataGenerator()->create_course(['enablecompletion' => 1], ['createsections' => true]);
|
||||
$PAGE->set_course($course);
|
||||
@ -215,7 +206,7 @@ class bulk_update_test extends \advanced_testcase {
|
||||
],
|
||||
'If at least one module does not support completionsubmit it can\'t be set' => [
|
||||
[
|
||||
'modulenames' => ['survey', 'wiki'],
|
||||
'modulenames' => ['assign', 'wiki'],
|
||||
'submitdata' => ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionview' => 1, 'completionsubmit' => 1],
|
||||
'validatedata' => [],
|
||||
'cmdata' => ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionview' => 1],
|
||||
|
@ -225,13 +225,18 @@ class restore_test extends \advanced_testcase {
|
||||
|
||||
$startdate = mktime(12, 0, 0, 7, 1, 2016); // 01-Jul-2016.
|
||||
|
||||
// Create two courses with different start dates,in each course create a chat that opens 1 week after the course start date.
|
||||
// Create two courses with different start dates, in each course create an assignment
|
||||
// that is due 1 week after the course start date.
|
||||
$c1 = $dg->create_course(['shortname' => 'SN', 'fullname' => 'FN', 'summary' => 'DESC', 'summaryformat' => FORMAT_MOODLE,
|
||||
'startdate' => $startdate]);
|
||||
$chat1 = $dg->create_module('chat', ['name' => 'First', 'course' => $c1->id, 'chattime' => $c1->startdate + 1 * WEEKSECS]);
|
||||
$assign1 = $dg->create_module('assign',
|
||||
['name' => 'First', 'course' => $c1->id, 'duedate' => $c1->startdate + 1 * WEEKSECS]
|
||||
);
|
||||
$c2 = $dg->create_course(['shortname' => 'A', 'fullname' => 'B', 'summary' => 'C', 'summaryformat' => FORMAT_PLAIN,
|
||||
'startdate' => $startdate + 2 * WEEKSECS]);
|
||||
$chat2 = $dg->create_module('chat', ['name' => 'Second', 'course' => $c2->id, 'chattime' => $c2->startdate + 1 * WEEKSECS]);
|
||||
$assign2 = $dg->create_module('assign',
|
||||
['name' => 'Second', 'course' => $c2->id, 'duedate' => $c2->startdate + 1 * WEEKSECS]
|
||||
);
|
||||
$backupid = $this->backup_course($c1->id);
|
||||
|
||||
// The information is restored but adapted because names are already taken.
|
||||
@ -242,12 +247,12 @@ class restore_test extends \advanced_testcase {
|
||||
$this->assertEquals(FORMAT_MOODLE, $c2->summaryformat);
|
||||
$this->assertEquals($startdate, $c2->startdate);
|
||||
|
||||
// Now course c2 has two chats - one ('Second') was already there and one ('First') was restored from the backup.
|
||||
// Now course c2 has two assignments - one ('Second') was already there and one ('First') was restored from the backup.
|
||||
// Their dates are exactly the same as they were in the original modules.
|
||||
$restoredchat1 = $DB->get_record('chat', ['name' => 'First', 'course' => $c2->id]);
|
||||
$restoredchat2 = $DB->get_record('chat', ['name' => 'Second', 'course' => $c2->id]);
|
||||
$this->assertEquals($chat1->chattime, $restoredchat1->chattime);
|
||||
$this->assertEquals($chat2->chattime, $restoredchat2->chattime);
|
||||
$restoredassign1 = $DB->get_record('assign', ['name' => 'First', 'course' => $c2->id]);
|
||||
$restoredassign2 = $DB->get_record('assign', ['name' => 'Second', 'course' => $c2->id]);
|
||||
$this->assertEquals($assign1->duedate, $restoredassign1->duedate);
|
||||
$this->assertEquals($assign2->duedate, $restoredassign2->duedate);
|
||||
}
|
||||
|
||||
public function test_async_restore_course_info_in_existing_course_delete_first(): void {
|
||||
@ -261,24 +266,29 @@ class restore_test extends \advanced_testcase {
|
||||
|
||||
$startdate = mktime(12, 0, 0, 7, 1, 2016); // 01-Jul-2016.
|
||||
|
||||
// Create two courses with different start dates,in each course create a chat that opens 1 week after the course start date.
|
||||
// Create two courses with different start dates, in each course create an assignment
|
||||
// that is due 1 week after the course start date.
|
||||
$c1 = $dg->create_course(['shortname' => 'SN', 'fullname' => 'FN', 'summary' => 'DESC', 'summaryformat' => FORMAT_MOODLE,
|
||||
'startdate' => $startdate]);
|
||||
$chat1 = $dg->create_module('chat', ['name' => 'First', 'course' => $c1->id, 'chattime' => $c1->startdate + 1 * WEEKSECS]);
|
||||
$assign1 = $dg->create_module('assign',
|
||||
['name' => 'First', 'course' => $c1->id, 'duedate' => $c1->startdate + 1 * WEEKSECS]
|
||||
);
|
||||
$c2 = $dg->create_course(['shortname' => 'A', 'fullname' => 'B', 'summary' => 'C', 'summaryformat' => FORMAT_PLAIN,
|
||||
'startdate' => $startdate + 2 * WEEKSECS]);
|
||||
$chat2 = $dg->create_module('chat', ['name' => 'Second', 'course' => $c2->id, 'chattime' => $c2->startdate + 1 * WEEKSECS]);
|
||||
$assign2 = $dg->create_module('assign',
|
||||
['name' => 'Second', 'course' => $c2->id, 'duedate' => $c2->startdate + 1 * WEEKSECS]
|
||||
);
|
||||
$backupid = $this->backup_course($c1->id);
|
||||
|
||||
// The information is restored and the existing course settings is modified.
|
||||
$c2 = $this->async_restore_to_existing_course($backupid, $c2->id, 2, backup::TARGET_CURRENT_DELETING);
|
||||
$this->assertEquals(FORMAT_MOODLE, $c2->summaryformat);
|
||||
|
||||
// Now course2 should have a new forum with the original forum deleted.
|
||||
$restoredchat1 = $DB->get_record('chat', ['name' => 'First', 'course' => $c2->id]);
|
||||
$restoredchat2 = $DB->get_record('chat', ['name' => 'Second', 'course' => $c2->id]);
|
||||
$this->assertEquals($chat1->chattime, $restoredchat1->chattime);
|
||||
$this->assertEmpty($restoredchat2);
|
||||
// Now course2 should have a new assignment with the original assignment deleted.
|
||||
$restoredassign1 = $DB->get_record('assign', ['name' => 'First', 'course' => $c2->id]);
|
||||
$restoredassign2 = $DB->get_record('assign', ['name' => 'Second', 'course' => $c2->id]);
|
||||
$this->assertEquals($assign1->duedate, $restoredassign1->duedate);
|
||||
$this->assertEmpty($restoredassign2);
|
||||
}
|
||||
|
||||
public function test_restore_existing_idnumber_in_new_course(): void {
|
||||
@ -434,13 +444,18 @@ class restore_test extends \advanced_testcase {
|
||||
|
||||
$startdate = mktime(12, 0, 0, 7, 1, 2016); // 01-Jul-2016.
|
||||
|
||||
// Create two courses with different start dates,in each course create a chat that opens 1 week after the course start date.
|
||||
// Create two courses with different start dates,in each course create an assignment
|
||||
// that opens 1 week after the course start date.
|
||||
$c1 = $dg->create_course(['shortname' => 'SN', 'fullname' => 'FN', 'summary' => 'DESC', 'summaryformat' => FORMAT_MOODLE,
|
||||
'startdate' => $startdate]);
|
||||
$chat1 = $dg->create_module('chat', ['name' => 'First', 'course' => $c1->id, 'chattime' => $c1->startdate + 1 * WEEKSECS]);
|
||||
$assign1 = $dg->create_module('assign',
|
||||
['name' => 'First', 'course' => $c1->id, 'duedate' => $c1->startdate + 1 * WEEKSECS]
|
||||
);
|
||||
$c2 = $dg->create_course(['shortname' => 'A', 'fullname' => 'B', 'summary' => 'C', 'summaryformat' => FORMAT_PLAIN,
|
||||
'startdate' => $startdate + 2 * WEEKSECS]);
|
||||
$chat2 = $dg->create_module('chat', ['name' => 'Second', 'course' => $c2->id, 'chattime' => $c2->startdate + 1 * WEEKSECS]);
|
||||
$assign2 = $dg->create_module('assign',
|
||||
['name' => 'Second', 'course' => $c2->id, 'duedate' => $c2->startdate + 1 * WEEKSECS]
|
||||
);
|
||||
$backupid = $this->backup_course($c1->id);
|
||||
|
||||
// The information is restored but adapted because names are already taken.
|
||||
@ -453,10 +468,10 @@ class restore_test extends \advanced_testcase {
|
||||
|
||||
// Now course c2 has two chats - one ('Second') was already there and one ('First') was restored from the backup.
|
||||
// Their dates are exactly the same as they were in the original modules.
|
||||
$restoredchat1 = $DB->get_record('chat', ['name' => 'First', 'course' => $c2->id]);
|
||||
$restoredchat2 = $DB->get_record('chat', ['name' => 'Second', 'course' => $c2->id]);
|
||||
$this->assertEquals($chat1->chattime, $restoredchat1->chattime);
|
||||
$this->assertEquals($chat2->chattime, $restoredchat2->chattime);
|
||||
$restoredassign1 = $DB->get_record('assign', ['name' => 'First', 'course' => $c2->id]);
|
||||
$restoredassign2 = $DB->get_record('assign', ['name' => 'Second', 'course' => $c2->id]);
|
||||
$this->assertEquals($assign1->duedate, $restoredassign1->duedate);
|
||||
$this->assertEquals($assign2->duedate, $restoredassign2->duedate);
|
||||
}
|
||||
|
||||
public function test_restore_course_shortname_in_existing_course_without_permissions(): void {
|
||||
@ -543,15 +558,20 @@ class restore_test extends \advanced_testcase {
|
||||
$dg->role_assign($manager->id, $u1->id);
|
||||
$dg->role_assign($roleid, $u1->id);
|
||||
|
||||
// Create two courses with different start dates,in each course create a chat that opens 1 week after the course start date.
|
||||
// Create two courses with different start dates, in each course create an assignment that
|
||||
// is due 1 week after the course start date.
|
||||
$startdate1 = mktime(12, 0, 0, 7, 1, 2016); // 01-Jul-2016.
|
||||
$startdate2 = mktime(12, 0, 0, 1, 13, 2000); // 13-Jan-2000.
|
||||
$c1 = $dg->create_course(['shortname' => 'SN', 'fullname' => 'FN', 'summary' => 'DESC', 'summaryformat' => FORMAT_MOODLE,
|
||||
'startdate' => $startdate1]);
|
||||
$chat1 = $dg->create_module('chat', ['name' => 'First', 'course' => $c1->id, 'chattime' => $c1->startdate + 1 * WEEKSECS]);
|
||||
$assign1 = $dg->create_module('assign',
|
||||
['name' => 'First', 'course' => $c1->id, 'duedate' => $c1->startdate + 1 * WEEKSECS]
|
||||
);
|
||||
$c2 = $dg->create_course(['shortname' => 'A', 'fullname' => 'B', 'summary' => 'C', 'summaryformat' => FORMAT_PLAIN,
|
||||
'startdate' => $startdate2]);
|
||||
$chat2 = $dg->create_module('chat', ['name' => 'Second', 'course' => $c2->id, 'chattime' => $c2->startdate + 1 * WEEKSECS]);
|
||||
$assign2 = $dg->create_module('assign',
|
||||
['name' => 'Second', 'course' => $c2->id, 'duedate' => $c2->startdate + 1 * WEEKSECS]
|
||||
);
|
||||
|
||||
// The startdate does not change.
|
||||
$backupid = $this->backup_course($c1->id);
|
||||
@ -562,13 +582,13 @@ class restore_test extends \advanced_testcase {
|
||||
$this->assertEquals(FORMAT_MOODLE, $restored->summaryformat);
|
||||
$this->assertEquals($startdate2, $restored->startdate);
|
||||
|
||||
// Now course c2 has two chats - one ('Second') was already there and one ('First') was restored from the backup.
|
||||
// Start date of the restored chat ('First') was changed to be 1 week after the c2 start date.
|
||||
$restoredchat1 = $DB->get_record('chat', ['name' => 'First', 'course' => $c2->id]);
|
||||
$restoredchat2 = $DB->get_record('chat', ['name' => 'Second', 'course' => $c2->id]);
|
||||
$this->assertNotEquals($chat1->chattime, $restoredchat1->chattime);
|
||||
$this->assertEquals($chat2->chattime, $restoredchat2->chattime);
|
||||
$this->assertEquals($c2->startdate + 1 * WEEKSECS, $restoredchat2->chattime);
|
||||
// Now course c2 has two assignments - one ('Second') was already there and one ('First') was restored from the backup.
|
||||
// Start date of the restored assignment ('First') was changed to be 1 week after the c2 start date.
|
||||
$restoredassign1 = $DB->get_record('assign', ['name' => 'First', 'course' => $c2->id]);
|
||||
$restoredassign2 = $DB->get_record('assign', ['name' => 'Second', 'course' => $c2->id]);
|
||||
$this->assertNotEquals($assign1->duedate, $restoredassign1->duedate);
|
||||
$this->assertEquals($assign2->duedate, $restoredassign2->duedate);
|
||||
$this->assertEquals($c2->startdate + 1 * WEEKSECS, $restoredassign2->duedate);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -18,13 +18,10 @@ Feature: Activity navigation
|
||||
| student1 | C1 | student |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C2 | student |
|
||||
And I enable "chat" "mod" plugin
|
||||
And I enable "survey" "mod" plugin
|
||||
And the following "activities" exist:
|
||||
| activity | name | intro | course | idnumber | section |
|
||||
| assign | Assignment 1 | Test assignment description | C1 | assign1 | 0 |
|
||||
| book | Book 1 | Test book description | C1 | book1 | 0 |
|
||||
| chat | Chat 1 | Test chat description | C1 | chat1 | 0 |
|
||||
| choice | Choice 1 | Test choice description | C1 | choice1 | 1 |
|
||||
| data | Database 1 | Test database description | C1 | data1 | 1 |
|
||||
| feedback | Feedback 1 | Test feedback description | C1 | feedback1 | 1 |
|
||||
@ -39,7 +36,6 @@ Feature: Activity navigation
|
||||
| quiz | Quiz 1 | Test quiz description | C1 | quiz1 | 4 |
|
||||
| resource | Resource 1 | Test resource description | C1 | resource1 | 5 |
|
||||
| scorm | Scorm 1 | Test scorm description | C1 | scorm1 | 5 |
|
||||
| survey | Survey 1 | Test survey description | C1 | survey1 | 5 |
|
||||
| url | Url 1 | Test url description | C1 | url1 | 6 |
|
||||
| wiki | Wiki 1 | Test wiki description | C1 | wiki1 | 6 |
|
||||
| workshop | Workshop 1 | Test workshop description | C1 | workshop1 | 6 |
|
||||
@ -74,12 +70,9 @@ Feature: Activity navigation
|
||||
And I should see "Book 1" in the "#next-activity-link" "css_element"
|
||||
And I follow "Book 1"
|
||||
And I should see "Assignment" in the "#prev-activity-link" "css_element"
|
||||
And I should see "Chat 1" in the "#next-activity-link" "css_element"
|
||||
And I follow "Chat 1"
|
||||
And I should see "Book 1" in the "#prev-activity-link" "css_element"
|
||||
And I should see "Choice 1" in the "#next-activity-link" "css_element"
|
||||
And I follow "Choice 1"
|
||||
And I should see "Chat 1" in the "#prev-activity-link" "css_element"
|
||||
And I should see "Book 1" in the "#prev-activity-link" "css_element"
|
||||
And I should see "Database 1" in the "#next-activity-link" "css_element"
|
||||
And I follow "Database 1"
|
||||
And I should see "Choice 1" in the "#prev-activity-link" "css_element"
|
||||
@ -117,12 +110,9 @@ Feature: Activity navigation
|
||||
And I should see "Scorm 1 (hidden)" in the "#next-activity-link" "css_element"
|
||||
And I follow "Scorm 1 (hidden)"
|
||||
And I should see "Resource 1 (hidden)" in the "#prev-activity-link" "css_element"
|
||||
And I should see "Survey 1 (hidden)" in the "#next-activity-link" "css_element"
|
||||
And I follow "Survey 1 (hidden)"
|
||||
And I should see "Scorm 1 (hidden)" in the "#prev-activity-link" "css_element"
|
||||
And I should see "Url 1" in the "#next-activity-link" "css_element"
|
||||
And I follow "Url 1"
|
||||
And I should see "Survey 1 (hidden)" in the "#prev-activity-link" "css_element"
|
||||
And I should see "Scorm 1 (hidden)" in the "#prev-activity-link" "css_element"
|
||||
And I should see "Wiki 1" in the "#next-activity-link" "css_element"
|
||||
And I follow "Wiki 1"
|
||||
And I should see "Url 1" in the "#prev-activity-link" "css_element"
|
||||
@ -141,12 +131,9 @@ Feature: Activity navigation
|
||||
And I should see "Book 1" in the "#next-activity-link" "css_element"
|
||||
And I follow "Book 1"
|
||||
And I should see "Assignment" in the "#prev-activity-link" "css_element"
|
||||
And I should see "Chat 1" in the "#next-activity-link" "css_element"
|
||||
And I follow "Chat 1"
|
||||
And I should see "Book 1" in the "#prev-activity-link" "css_element"
|
||||
And I should see "Choice 1" in the "#next-activity-link" "css_element"
|
||||
And I follow "Choice 1"
|
||||
And I should see "Chat 1" in the "#prev-activity-link" "css_element"
|
||||
And I should see "Book 1" in the "#prev-activity-link" "css_element"
|
||||
And I should see "Database 1" in the "#next-activity-link" "css_element"
|
||||
And I follow "Database 1"
|
||||
And I should see "Choice 1" in the "#prev-activity-link" "css_element"
|
||||
@ -200,7 +187,6 @@ Feature: Activity navigation
|
||||
And the "Jump to..." select box should not contain "Label 1"
|
||||
# Check drop down menu contents.
|
||||
And the "Jump to..." select box should contain "Book 1"
|
||||
And the "Jump to..." select box should contain "Chat 1"
|
||||
And the "Jump to..." select box should contain "Choice 1"
|
||||
And the "Jump to..." select box should contain "Database 1"
|
||||
And the "Jump to..." select box should contain "Feedback 1"
|
||||
@ -218,7 +204,6 @@ Feature: Activity navigation
|
||||
# Activities in hidden sections will be rendered with a '(hidden)' text.
|
||||
And the "Jump to..." select box should contain "Resource 1 (hidden)"
|
||||
And the "Jump to..." select box should contain "Scorm 1 (hidden)"
|
||||
And the "Jump to..." select box should contain "Survey 1 (hidden)"
|
||||
# Jump to an activity somewhere in the middle.
|
||||
When I select "Page 1" from the "Jump to..." singleselect
|
||||
Then I should see "Page 1"
|
||||
@ -253,10 +238,8 @@ Feature: Activity navigation
|
||||
# Activities in hidden sections will not be listed for students.
|
||||
And the "Jump to..." select box should not contain "Resource 1"
|
||||
And the "Jump to..." select box should not contain "Scorm 1"
|
||||
And the "Jump to..." select box should not contain "Survey 1"
|
||||
# Only activities visible to students will be listed.
|
||||
And the "Jump to..." select box should contain "Book 1"
|
||||
And the "Jump to..." select box should contain "Chat 1"
|
||||
And the "Jump to..." select box should contain "Choice 1"
|
||||
And the "Jump to..." select box should contain "Database 1"
|
||||
And the "Jump to..." select box should contain "Feedback 1"
|
||||
|
@ -16,10 +16,8 @@ Feature: Display activity and resource description
|
||||
| teacher1 | C1 | editingteacher |
|
||||
|
||||
Scenario Outline: Display activity and resource descriptions
|
||||
Given I enable "chat" "mod" plugin
|
||||
And I enable "survey" "mod" plugin
|
||||
# Generate activity/resource with description
|
||||
And the following "activities" exist:
|
||||
Given the following "activities" exist:
|
||||
| activity | course | name | intro | showdescription |
|
||||
| <acttype> | C1 | <actname> | <actname> intro | 1 |
|
||||
When I am on the "Course 1" course page logged in as teacher1
|
||||
@ -31,7 +29,6 @@ Feature: Display activity and resource description
|
||||
| acttype | actname |
|
||||
| assign | Assign 1 |
|
||||
| book | Book 1 |
|
||||
| chat | Chat 1 |
|
||||
| data | Database 1 |
|
||||
| feedback | Feedback 1 |
|
||||
| forum | Forum 1 |
|
||||
@ -45,7 +42,6 @@ Feature: Display activity and resource description
|
||||
| glossary | Glossary 1 |
|
||||
| scorm | Scorm 1 |
|
||||
| lesson | Lesson 1 |
|
||||
| survey | Survey 1 |
|
||||
| url | URL 1 |
|
||||
| wiki | Wiki 1 |
|
||||
| workshop | Workshop 1 |
|
||||
|
@ -762,11 +762,6 @@ $string['taskh5pcleanup'] = 'Unused H5P files cleanup';
|
||||
$string['iconvrequired'] = 'Installing ICONV extension is required.';
|
||||
$string['igbinary322buggyversion'] = 'The php-igbinary extension installed on the site can lead to problems when running with PHP 7.2. You are recommended to either upgrade to php-igbinary 3.2.5 or later, or alternatively to upgrade to PHP 7.3 or later.';
|
||||
$string['ignore'] = 'Ignore';
|
||||
$string['importantupdates_content'] = '<p>In the next Moodle 5.0, planned for release in April 2025, the Chat and Survey activities will
|
||||
be removed from core Moodle. They will be available as plugins in the
|
||||
<a href="https://moodle.org/plugins/">Moodle plugins directory</a>.</p>
|
||||
<p>If you wish to continue using Chat or Survey in your site, you will be able to install them as plugins before upgrading to Moodle 5.0.</p>';
|
||||
$string['importantupdates_title'] = 'Important update about Chat and Survey activities';
|
||||
$string['includemoduleuserdata'] = 'Include module user data';
|
||||
$string['incompatibleblocks'] = 'Incompatible blocks';
|
||||
$string['indexdata'] = 'Index data';
|
||||
@ -1666,3 +1661,10 @@ $string['registration_help'] = 'By registering:
|
||||
* You will receive security alerts
|
||||
* You can activate mobile app push notifications from your site
|
||||
* You are contributing to our Moodle statistics of the worldwide community';
|
||||
|
||||
// Deprecated since Moodle 5.0.
|
||||
$string['importantupdates_content'] = '<p>In the next Moodle 5.0, planned for release in April 2025, the Chat and Survey activities will
|
||||
be removed from core Moodle. They will be available as plugins in the
|
||||
<a href="https://moodle.org/plugins/">Moodle plugins directory</a>.</p>
|
||||
<p>If you wish to continue using Chat or Survey in your site, you will be able to install them as plugins before upgrading to Moodle 5.0.</p>';
|
||||
$string['importantupdates_title'] = 'Important update about Chat and Survey activities';
|
||||
|
@ -142,3 +142,5 @@ configgeneralquestionbank,core_backup
|
||||
generalquestionbank,core_backup
|
||||
cannotdeletecategoryquestions,core_error
|
||||
errordeletingquestionsfromcategory,core_question
|
||||
importantupdates_content,core_admin
|
||||
importantupdates_title,core_admin
|
@ -137,7 +137,6 @@ class publicpaths extends check {
|
||||
'404' => [
|
||||
'mod/README.txt',
|
||||
'mod/book/README.md',
|
||||
'mod/chat/README.txt',
|
||||
],
|
||||
],
|
||||
[
|
||||
|
@ -34,7 +34,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* \mod_chat\event\course_module_instance_list_viewed extends \core\event\course_module_instance_list_viewed
|
||||
* \mod_assign\event\course_module_instance_list_viewed extends \core\event\course_module_instance_list_viewed
|
||||
*
|
||||
* @package core
|
||||
* @since Moodle 2.7
|
||||
|
@ -115,15 +115,6 @@ abstract class restore_date_testcase extends advanced_testcase {
|
||||
* @return array
|
||||
*/
|
||||
protected function create_course_and_module($modulename, $record = []) {
|
||||
if ($modulename == 'chat') {
|
||||
$manager = \core_plugin_manager::resolve_plugininfo_class('mod');
|
||||
$manager::enable_plugin('chat', 1);
|
||||
}
|
||||
if ($modulename == 'survey') {
|
||||
$manager = \core_plugin_manager::resolve_plugininfo_class('mod');
|
||||
$manager::enable_plugin('survey', 1);
|
||||
}
|
||||
|
||||
// Create a course with specific start date.
|
||||
$record = (array)$record;
|
||||
$generator = $this->getDataGenerator();
|
||||
|
@ -312,7 +312,6 @@
|
||||
"assign",
|
||||
"bigbluebuttonbn",
|
||||
"book",
|
||||
"chat",
|
||||
"choice",
|
||||
"data",
|
||||
"feedback",
|
||||
@ -330,7 +329,6 @@
|
||||
"resource",
|
||||
"scorm",
|
||||
"subsection",
|
||||
"survey",
|
||||
"url",
|
||||
"wiki",
|
||||
"workshop"
|
||||
@ -622,7 +620,9 @@
|
||||
"jabber"
|
||||
],
|
||||
"mod": [
|
||||
"assignment"
|
||||
"assignment",
|
||||
"chat",
|
||||
"survey"
|
||||
],
|
||||
"portfolio": [
|
||||
"boxnet",
|
||||
|
@ -50,7 +50,7 @@ class moodlenet_get_share_info_activity_test extends externallib_advanced_testca
|
||||
|
||||
// Generate course and activities.
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$activity1 = $this->getDataGenerator()->create_module('chat', ['course' => $course->id, 'name' => 'Chat activity']);
|
||||
$activity1 = $this->getDataGenerator()->create_module('page', ['course' => $course->id, 'name' => 'Page activity']);
|
||||
$activity2 = $this->getDataGenerator()->create_module('assign', ['course' => $course->id, 'name' => 'Assign activity']);
|
||||
$activity3 = $this->getDataGenerator()->create_module('quiz', ['course' => $course->id, 'name' => 'Quiz activity']);
|
||||
|
||||
@ -98,7 +98,7 @@ class moodlenet_get_share_info_activity_test extends externallib_advanced_testca
|
||||
$result = external_api::clean_returnvalue(moodlenet_get_share_info_activity::execute_returns(), $result);
|
||||
$this->assertTrue($result['status']);
|
||||
$this->assertEquals($activity1->name, $result['name']);
|
||||
$this->assertEquals(get_string('modulename', 'mod_chat'), $result['type']);
|
||||
$this->assertEquals(get_string('modulename', 'mod_page'), $result['type']);
|
||||
$this->assertEquals($issuer->get_display_name(), $result['server']);
|
||||
$this->assertEquals($expectedsupporturl, $result['supportpageurl']);
|
||||
|
||||
|
@ -32,12 +32,11 @@ class mod_test extends advanced_testcase {
|
||||
public function test_get_enabled_plugins(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// The bigbluebuttonbn and chat plugins are disabled by default.
|
||||
// The bigbluebuttonbn is disabled by default.
|
||||
// Check all default formats.
|
||||
$plugins = mod::get_enabled_plugins();
|
||||
$this->assertArrayHasKey('assign', $plugins);
|
||||
$this->assertArrayHasKey('forum', $plugins);
|
||||
$this->assertArrayNotHasKey('chat', $plugins);
|
||||
$this->assertArrayNotHasKey('bigbluebuttonbn', $plugins);
|
||||
|
||||
// Disable assignment.
|
||||
@ -46,7 +45,6 @@ class mod_test extends advanced_testcase {
|
||||
$plugins = mod::get_enabled_plugins();
|
||||
$this->assertArrayHasKey('forum', $plugins);
|
||||
$this->assertArrayNotHasKey('assign', $plugins);
|
||||
$this->assertArrayNotHasKey('chat', $plugins);
|
||||
$this->assertArrayNotHasKey('bigbluebuttonbn', $plugins);
|
||||
}
|
||||
}
|
||||
|
@ -454,72 +454,67 @@ class statslib_test extends \advanced_testcase {
|
||||
* defaults for a new Moodle 2.3 install.
|
||||
*/
|
||||
public function test_statslib_get_action_names(): void {
|
||||
$basepostactions = array (
|
||||
0 => 'add',
|
||||
1 => 'delete',
|
||||
2 => 'edit',
|
||||
3 => 'add mod',
|
||||
4 => 'delete mod',
|
||||
5 => 'edit section',
|
||||
6 => 'loginas',
|
||||
7 => 'new',
|
||||
8 => 'unenrol',
|
||||
9 => 'update',
|
||||
10 => 'update mod',
|
||||
11 => 'upload',
|
||||
12 => 'submit',
|
||||
13 => 'submit for grading',
|
||||
14 => 'talk',
|
||||
15 => 'choose',
|
||||
16 => 'choose again',
|
||||
17 => 'record delete',
|
||||
18 => 'add discussion',
|
||||
19 => 'add post',
|
||||
20 => 'delete discussion',
|
||||
21 => 'delete post',
|
||||
22 => 'move discussion',
|
||||
23 => 'prune post',
|
||||
24 => 'update post',
|
||||
25 => 'add category',
|
||||
26 => 'add entry',
|
||||
27 => 'approve entry',
|
||||
28 => 'delete category',
|
||||
29 => 'delete entry',
|
||||
30 => 'edit category',
|
||||
31 => 'update entry',
|
||||
32 => 'end',
|
||||
33 => 'start',
|
||||
34 => 'attempt',
|
||||
35 => 'close attempt',
|
||||
36 => 'preview',
|
||||
37 => 'editquestions',
|
||||
38 => 'delete attempt',
|
||||
39 => 'manualgrade',
|
||||
40 => 'enrol',
|
||||
);
|
||||
$basepostactions = [
|
||||
'add',
|
||||
'delete',
|
||||
'edit',
|
||||
'add mod',
|
||||
'delete mod',
|
||||
'edit section',
|
||||
'loginas',
|
||||
'new',
|
||||
'unenrol',
|
||||
'update',
|
||||
'update mod',
|
||||
'upload',
|
||||
'submit',
|
||||
'submit for grading',
|
||||
'choose',
|
||||
'choose again',
|
||||
'record delete',
|
||||
'add discussion',
|
||||
'add post',
|
||||
'delete discussion',
|
||||
'delete post',
|
||||
'move discussion',
|
||||
'prune post',
|
||||
'update post',
|
||||
'add category',
|
||||
'add entry',
|
||||
'approve entry',
|
||||
'delete category',
|
||||
'delete entry',
|
||||
'edit category',
|
||||
'update entry',
|
||||
'end',
|
||||
'start',
|
||||
'attempt',
|
||||
'close attempt',
|
||||
'preview',
|
||||
'editquestions',
|
||||
'delete attempt',
|
||||
'manualgrade',
|
||||
'enrol',
|
||||
];
|
||||
|
||||
$baseviewactions = array (
|
||||
0 => 'view',
|
||||
1 => 'view all',
|
||||
2 => 'history',
|
||||
3 => 'view submission',
|
||||
4 => 'view feedback',
|
||||
5 => 'print',
|
||||
6 => 'report',
|
||||
7 => 'view discussion',
|
||||
8 => 'search',
|
||||
9 => 'forum',
|
||||
10 => 'forums',
|
||||
11 => 'subscribers',
|
||||
12 => 'view forum',
|
||||
13 => 'view entry',
|
||||
14 => 'review',
|
||||
15 => 'pre-view',
|
||||
16 => 'download',
|
||||
17 => 'view form',
|
||||
18 => 'view graph',
|
||||
19 => 'view report',
|
||||
);
|
||||
$baseviewactions = [
|
||||
'view',
|
||||
'view all',
|
||||
'history',
|
||||
'view submission',
|
||||
'view feedback',
|
||||
'print',
|
||||
'report',
|
||||
'view discussion',
|
||||
'search',
|
||||
'forum',
|
||||
'forums',
|
||||
'subscribers',
|
||||
'view forum',
|
||||
'view entry',
|
||||
'review',
|
||||
'pre-view',
|
||||
];
|
||||
|
||||
$postactions = stats_get_action_names('post');
|
||||
|
||||
|
@ -1342,7 +1342,7 @@ class moodle_content_writer_test extends advanced_testcase {
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$misccoursecxt = \context_coursecat::instance($course->category);
|
||||
$coursecontext = \context_course::instance($course->id);
|
||||
$cm = $this->getDataGenerator()->create_module('chat', ['course' => $course->id]);
|
||||
$cm = $this->getDataGenerator()->create_module('assign', ['course' => $course->id]);
|
||||
$modulecontext = \context_module::instance($cm->cmid);
|
||||
|
||||
$writer->set_context($modulecontext)->export_data([], $data);
|
||||
@ -1382,7 +1382,7 @@ class moodle_content_writer_test extends advanced_testcase {
|
||||
'paper' => 'data.json',
|
||||
'Category Category 1 _.' . $misccoursecxt->id => [
|
||||
'Course Test course 1 _.' . $coursecontext->id => [
|
||||
'Chat Chat 1 _.' . $modulecontext->id => 'data.json',
|
||||
'Assignment Assignment 1 _.' . $modulecontext->id => 'data.json',
|
||||
'grades' => 'data.json'
|
||||
]
|
||||
],
|
||||
@ -1401,7 +1401,7 @@ class moodle_content_writer_test extends advanced_testcase {
|
||||
'System _.1/data.json' => 'data_file_1',
|
||||
'System _.1/paper/data.json' => 'data_file_2',
|
||||
'System _.1/Category Category 1 _.' . $misccoursecxt->id . '/Course Test course 1 _.' .
|
||||
$coursecontext->id . '/Chat Chat 1 _.' . $modulecontext->id . '/data.json' => 'data_file_3',
|
||||
$coursecontext->id . '/Assignment Assignment 1 _.' . $modulecontext->id . '/data.json' => 'data_file_3',
|
||||
'System _.1/Category Category 1 _.' . $misccoursecxt->id . '/Course Test course 1 _.' .
|
||||
$coursecontext->id . '/grades/data.json' => 'data_file_4',
|
||||
'System _.1/Category Course category 1 _.' . $categorycontext->id . '/data.json' => 'data_file_5',
|
||||
@ -1414,7 +1414,7 @@ class moodle_content_writer_test extends advanced_testcase {
|
||||
'data_file_1' => 'System _.1/data.js',
|
||||
'data_file_2' => 'System _.1/paper/data.js',
|
||||
'data_file_3' => 'System _.1/Category Category 1 _.' . $misccoursecxt->id . '/Course Test course 1 _.' .
|
||||
$coursecontext->id . '/Chat Chat 1 _.' . $modulecontext->id . '/data.js',
|
||||
$coursecontext->id . '/Assignment Assignment 1 _.' . $modulecontext->id . '/data.js',
|
||||
'data_file_4' => 'System _.1/Category Category 1 _.' . $misccoursecxt->id . '/Course Test course 1 _.' .
|
||||
$coursecontext->id . '/grades/data.js',
|
||||
'data_file_5' => 'System _.1/Category Course category 1 _.' . $categorycontext->id . '/data.js',
|
||||
@ -1458,9 +1458,9 @@ class moodle_content_writer_test extends advanced_testcase {
|
||||
'name' => 'Course Test course 1 ',
|
||||
'context' => $coursecontext,
|
||||
'children' => [
|
||||
'Chat Chat 1 _.' . $modulecontext->id => (object) [
|
||||
'Assignment Assignment 1 _.' . $modulecontext->id => (object) [
|
||||
'itemtype' => 'treeitem',
|
||||
'name' => 'Chat Chat 1 ',
|
||||
'name' => 'Assignment Assignment 1 ',
|
||||
'context' => $modulecontext,
|
||||
'children' => [
|
||||
'data.json' => (object) [
|
||||
@ -1562,9 +1562,9 @@ class moodle_content_writer_test extends advanced_testcase {
|
||||
'name' => 'Course Test course 1 ',
|
||||
'context' => $coursecontext,
|
||||
'children' => [
|
||||
'Chat Chat 1 _.' . $modulecontext->id => (object) [
|
||||
'Assignment Assignment 1 _.' . $modulecontext->id => (object) [
|
||||
'itemtype' => 'treeitem',
|
||||
'name' => 'Chat Chat 1 ',
|
||||
'name' => 'Assignment Assignment 1 ',
|
||||
'context' => $modulecontext,
|
||||
'children' => [
|
||||
'data.json' => (object) [
|
||||
|
Loading…
x
Reference in New Issue
Block a user