From 199738d5e69b30153f5c655b82843479ffd567c7 Mon Sep 17 00:00:00 2001 From: Binon Date: Fri, 20 Jun 2025 11:01:11 +0100 Subject: [PATCH] Fixing the failure when catalogue id is null --- local/telconfig/classes/course_data_builder.php | 2 +- local/telconfig/tests/course_data_builder_test.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/local/telconfig/classes/course_data_builder.php b/local/telconfig/classes/course_data_builder.php index f210d8588a3..b7db93fd8fa 100644 --- a/local/telconfig/classes/course_data_builder.php +++ b/local/telconfig/classes/course_data_builder.php @@ -48,7 +48,7 @@ public static function build_course_metadata($course): array { 'course_id' => $course->id, 'authored_date' => date('Y-m-d', $course->startdate), 'authors' => $authors, - 'catalogue_ids' => [],//[$course->category], + 'catalogue_ids' => ['1'],//[$course->category], 'description' => format_text($course->summary, FORMAT_HTML), 'keywords' => array_values($keywords), 'location_paths' => [], // category hierarchy if needed diff --git a/local/telconfig/tests/course_data_builder_test.php b/local/telconfig/tests/course_data_builder_test.php index 523166550fa..820bb1e1ed5 100644 --- a/local/telconfig/tests/course_data_builder_test.php +++ b/local/telconfig/tests/course_data_builder_test.php @@ -58,7 +58,7 @@ public function test_build_course_metadata_returns_expected_array() { $this->assertSame($course->id, $result['course_id']); $this->assertSame(date('Y-m-d', $course->startdate), $result['authored_date']); $this->assertContains(fullname($teacher), $result['authors']); - $this->assertEquals([], $result['catalogue_ids']); + $this->assertEquals(['1'], $result['catalogue_ids']); $this->assertSame(format_text($course->summary, FORMAT_HTML), $result['description']); $this->assertEquals(['tag1', 'tag2'], $result['keywords']); $this->assertIsArray($result['location_paths']);