From 772c763e6b290eb7f90611c2086ec3dc51a231db Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Tue, 1 Oct 2024 19:57:46 +1300 Subject: [PATCH] MDL-83310 course: remove hard-coded list of course formats from test. --- course/tests/courselib_test.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/course/tests/courselib_test.php b/course/tests/courselib_test.php index 095e93e7a91..039f749aea0 100644 --- a/course/tests/courselib_test.php +++ b/course/tests/courselib_test.php @@ -7490,7 +7490,7 @@ class courselib_test extends advanced_testcase { } /** - * Tests get_sorted_course_formats returns all plugins in cases where plugins are installed now, + * Tests get_sorted_course_formats returns plugins in cases where plugins are * installed previously but no longer exist, or not installed yet. * * @covers ::get_sorted_course_formats() @@ -7500,11 +7500,7 @@ class courselib_test extends advanced_testcase { $this->resetAfterTest(); - // By default returns all course formats. - $formats = get_sorted_course_formats(); - $this->assertEquals(['singleactivity', 'social', 'topics', 'weeks'], $formats); - - // If there is an extra format installed that no longer exists, include in list (at start). + // If there is an extra format installed that no longer exists, include in list (at end). $DB->insert_record('config_plugins', [ 'plugin' => 'format_frogs', 'name' => 'version', @@ -7512,12 +7508,12 @@ class courselib_test extends advanced_testcase { ]); \core_plugin_manager::reset_caches(); $formats = get_sorted_course_formats(); - $this->assertEquals(['frogs', 'singleactivity', 'social', 'topics', 'weeks'], $formats); + $this->assertContains('frogs', $formats); // If one of the formats is not installed yet, we still return it. $DB->delete_records('config_plugins', ['plugin' => 'format_weeks']); \core_plugin_manager::reset_caches(); $formats = get_sorted_course_formats(); - $this->assertEquals(['frogs', 'singleactivity', 'social', 'topics', 'weeks'], $formats); + $this->assertContains('weeks', $formats); } }