diff --git a/course/format/tests/stateactions_test.php b/course/format/tests/stateactions_test.php index 9aa21ecdef8..1d9bacebc2c 100644 --- a/course/format/tests/stateactions_test.php +++ b/course/format/tests/stateactions_test.php @@ -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]); diff --git a/lib/tests/modinfolib_test.php b/lib/tests/modinfolib_test.php index e7f084ef9e9..84c1099560a 100644 --- a/lib/tests/modinfolib_test.php +++ b/lib/tests/modinfolib_test.php @@ -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. diff --git a/mod/subsection/db/install.php b/mod/subsection/db/install.php index 6ee6ac8c899..6578ac2bcd3 100644 --- a/mod/subsection/db/install.php +++ b/mod/subsection/db/install.php @@ -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; } diff --git a/mod/subsection/tests/behat/subsection_actionmenu.feature b/mod/subsection/tests/behat/subsection_actionmenu.feature index 084a0c9d453..a7008e0b53a 100644 --- a/mod/subsection/tests/behat/subsection_actionmenu.feature +++ b/mod/subsection/tests/behat/subsection_actionmenu.feature @@ -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: diff --git a/mod/subsection/tests/behat/subsection_handling.feature b/mod/subsection/tests/behat/subsection_handling.feature index 64365667f2c..0224555f3b8 100644 --- a/mod/subsection/tests/behat/subsection_handling.feature +++ b/mod/subsection/tests/behat/subsection_handling.feature @@ -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: diff --git a/mod/subsection/tests/behat/subsection_navigation.feature b/mod/subsection/tests/behat/subsection_navigation.feature index 3ee554d29d9..e34012781a5 100644 --- a/mod/subsection/tests/behat/subsection_navigation.feature +++ b/mod/subsection/tests/behat/subsection_navigation.feature @@ -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: diff --git a/mod/subsection/tests/behat/subsection_rename.feature b/mod/subsection/tests/behat/subsection_rename.feature index 18c14f2748d..cba16f2ef44 100644 --- a/mod/subsection/tests/behat/subsection_rename.feature +++ b/mod/subsection/tests/behat/subsection_rename.feature @@ -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: diff --git a/mod/subsection/tests/courseformat/sectiondelegate_test.php b/mod/subsection/tests/courseformat/sectiondelegate_test.php index b4213213816..13129dd3753 100644 --- a/mod/subsection/tests/courseformat/sectiondelegate_test.php +++ b/mod/subsection/tests/courseformat/sectiondelegate_test.php @@ -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]); diff --git a/mod/subsection/tests/courseformat/sectiondelegatemodule_test.php b/mod/subsection/tests/courseformat/sectiondelegatemodule_test.php index 1d28f7eb7a2..16c1a8aad67 100644 --- a/mod/subsection/tests/courseformat/sectiondelegatemodule_test.php +++ b/mod/subsection/tests/courseformat/sectiondelegatemodule_test.php @@ -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]); diff --git a/report/outline/tests/behat/subsection_reports.feature b/report/outline/tests/behat/subsection_reports.feature index e038b929337..29e4dd1b17d 100644 --- a/report/outline/tests/behat/subsection_reports.feature +++ b/report/outline/tests/behat/subsection_reports.feature @@ -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: