dbnschools / moodle-theme_fordson

Theme for Moodle 3.3+
42 stars 40 forks source link

php unit error for classes/output/core/course_renderer.php:49 #105

Closed mnods closed 3 years ago

mnods commented 4 years ago

Hi, finally gotten around to updating to 3.7 (latest) and we're getting a phpunit error as follows:

23:54:29.491 There was 1 error: 23:54:29.491 23:54:29.491 1) core_component_testcase::test_get_component_classes_in_namespace 23:54:30.040 Undefined property: stdClass::$coursetilestyle 23:54:30.040 23:54:30.040 /opt/data/go-agent/pipelines/Moodle_Upgrade/moodle/theme/fordson/classes/output/core/course_renderer.php:49 23:54:30.040 /opt/data/go-agent/pipelines/Moodle_Upgrade/moodle/lib/classes/component.php:129 23:54:30.040 /opt/data/go-agent/pipelines/Moodle_Upgrade/moodle/lib/classes/component.php:969 23:54:30.040 /opt/data/go-agent/pipelines/Moodle_Upgrade/moodle/lib/tests/component_test.php:515 23:54:30.040 /opt/data/go-agent/pipelines/Moodle_Upgrade/moodle/lib/phpunit/classes/advanced_testcase.php:80

Cheers

dbnschools commented 4 years ago

Open up the Fordson Settings in Site Admin and re-save them. There might be a few new settings introduced in the update that didn't get saved.

mnods commented 4 years ago

Hi, haven't figured out how to fix yet but we've bypassed the test for now to get other things done. also, the test environment builds from scratch so all the settings would be as default in fordson. I thought it might be something to do with the $cfg needing declaring - something to do with these changes i assume? https://github.com/moodle/moodle/commit/0d6a45d2febf98b9e4c65b6428e5d012c112faab#diff-a1aa9b9a92e626322fed7697c5593041

dbnschools commented 4 years ago

Try changing line 49 of course_renderer.php from this: if ($PAGE->theme->settings->coursetilestyle < 10) { to this: if (isset($PAGE->theme->settings->coursetilestyle) && $PAGE->theme->settings->coursetilestyle < 10) {