MDL-81765 mod_subsection: disable mod subsection by default

This commit is contained in:
ferranrecio
2024-07-08 13:34:28 +02:00
parent c7742b7a23
commit 0ccafe76f6
10 changed files with 40 additions and 5 deletions
@@ -1432,6 +1432,9 @@ class stateactions_test extends \advanced_testcase {
$this->resetAfterTest();
$this->setAdminUser();
$manager = \core_plugin_manager::resolve_plugininfo_class('mod');
$manager::enable_plugin('subsection', 1);
$course = $this->getDataGenerator()->create_course();
$subsection = $this->getDataGenerator()->create_module('subsection', ['course' => $course]);
$otheractvity = $this->getDataGenerator()->create_module('forum', ['course' => $course]);
@@ -1511,6 +1514,9 @@ class stateactions_test extends \advanced_testcase {
$this->resetAfterTest();
$this->setAdminUser();
$manager = \core_plugin_manager::resolve_plugininfo_class('mod');
$manager::enable_plugin('subsection', 1);
$course = $this->getDataGenerator()->create_course();
$subsection = $this->getDataGenerator()->create_module('subsection', ['course' => $course]);
$otheractvity = $this->getDataGenerator()->create_module('forum', ['course' => $course]);
+8
View File
@@ -1795,6 +1795,10 @@ class modinfolib_test extends advanced_testcase {
*/
public function test_get_sections_delegated_by_cm(): void {
$this->resetAfterTest();
$manager = \core_plugin_manager::resolve_plugininfo_class('mod');
$manager::enable_plugin('subsection', 1);
$course = $this->getDataGenerator()->create_course(['numsections' => 1]);
$modinfo = get_fast_modinfo($course);
@@ -1823,6 +1827,10 @@ class modinfolib_test extends advanced_testcase {
*/
public function test_get_delegated_section_info(): void {
$this->resetAfterTest();
$manager = \core_plugin_manager::resolve_plugininfo_class('mod');
$manager::enable_plugin('subsection', 1);
$course = $this->getDataGenerator()->create_course(['numsections' => 1]);
// Add a section delegated by a course module.
+4
View File
@@ -27,6 +27,10 @@
* Custom code to be run on installing the plugin.
*/
function xmldb_subsection_install() {
global $DB;
// Disable the chat activity module on new installs by default.
$DB->set_field('modules', 'visible', 0, ['name' => 'subsection']);
return true;
}
@@ -5,7 +5,8 @@ Feature: The module menu replaces the section menu when accessing the subsection
I need to see the module action menu in the section page.
Background:
Given the following "users" exist:
Given I enable "subsection" "mod" plugin
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
@@ -5,7 +5,8 @@ Feature: Teachers create and destroy subsections
I need to create and destroy subsections
Background:
Given the following "users" exist:
Given I enable "subsection" "mod" plugin
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
@@ -5,7 +5,8 @@ Feature: Teachers navigate to subsections
I need to navigate to subsections
Background:
Given the following "users" exist:
Given I enable "subsection" "mod" plugin
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
@@ -5,7 +5,8 @@ Feature: Teachers can rename subsections
I need to sync subsection and activity names
Background:
Given the following "users" exist:
Given I enable "subsection" "mod" plugin
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
@@ -47,6 +47,9 @@ final class sectiondelegate_test extends \advanced_testcase {
$this->resetAfterTest();
$this->setAdminUser();
$manager = \core_plugin_manager::resolve_plugininfo_class('mod');
$manager::enable_plugin('subsection', 1);
$course = $this->getDataGenerator()->create_course(['format' => 'topics', 'numsections' => 1]);
$this->getDataGenerator()->create_module('subsection', ['course' => $course->id, 'section' => 1]);
@@ -40,6 +40,9 @@ final class sectiondelegatemodule_test extends \advanced_testcase {
public function test_get_parent_section(): void {
$this->resetAfterTest();
$manager = \core_plugin_manager::resolve_plugininfo_class('mod');
$manager::enable_plugin('subsection', 1);
$course = $this->getDataGenerator()->create_course(['format' => 'topics', 'numsections' => 2]);
$module = $this->getDataGenerator()->create_module('subsection', (object)['course' => $course->id, 'section' => 2]);
@@ -63,6 +66,9 @@ final class sectiondelegatemodule_test extends \advanced_testcase {
public function test_get_cm(): void {
$this->resetAfterTest();
$manager = \core_plugin_manager::resolve_plugininfo_class('mod');
$manager::enable_plugin('subsection', 1);
$course = $this->getDataGenerator()->create_course(['format' => 'topics', 'numsections' => 1]);
$module = $this->getDataGenerator()->create_module('subsection', (object)['course' => $course->id, 'section' => 1]);
@@ -86,6 +92,9 @@ final class sectiondelegatemodule_test extends \advanced_testcase {
public function test_get_course(): void {
$this->resetAfterTest();
$manager = \core_plugin_manager::resolve_plugininfo_class('mod');
$manager::enable_plugin('subsection', 1);
$course = $this->getDataGenerator()->create_course(['format' => 'topics', 'numsections' => 1]);
$module = $this->getDataGenerator()->create_module('subsection', (object)['course' => $course->id, 'section' => 1]);
@@ -5,7 +5,8 @@ Feature: Subsections are shown in reports
I need to see sections and subsections structure in reports
Background:
Given the following "users" exist:
Given I enable "subsection" "mod" plugin
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist: