Skip to content

Issue #157: CI fixes #158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 8, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion classes/customfield/cmsuserlist_handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function get_instance_context(int $instanceid = 0): \context {
*
* @return bool
*/
public function uses_categories() : bool {
public function uses_categories(): bool {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion classes/form/cms_types_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public function add_action_buttons($cancel = true, $submitlabel=null) {
if ($cancel) {
$buttonarray[] = &$mform->createElement('cancel');
}
$mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);
$mform->addGroup($buttonarray, 'buttonar', '', [' '], false);
$mform->closeHeaderBefore('buttonar');
}

Expand Down
2 changes: 1 addition & 1 deletion classes/local/datasource/roles.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ public function config_backup_define_structure(\backup_nested_element $parent) {
$cmstype = $this->cms->get_type();
$config = $cmstype->get_custom_data('roles_config');
$source = is_null($config) ? [] : [
['list' => implode(',', $config->list), 'duplicates' => $config->duplicates]
['list' => implode(',', $config->list), 'duplicates' => $config->duplicates],
];
$roles->set_source_array($source);
}
Expand Down
5 changes: 3 additions & 2 deletions classes/local/datasource/userlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,8 @@ public function instance_backup_define_structure(\backup_nested_element $parent)

$fields = new \backup_nested_element('userlistfields');
if ($DB->get_manager()->field_exists('customfield_data', 'valuetrust')) {
$field = new \backup_nested_element('userlistfield', ['id'], ['shortname', 'type', 'value', 'valueformat', 'valuetrust']);
$field = new \backup_nested_element('userlistfield', ['id'],
['shortname', 'type', 'value', 'valueformat', 'valuetrust']);
} else {
$field = new \backup_nested_element('userlistfield', ['id'], ['shortname', 'type', 'value', 'valueformat']);
}
Expand All @@ -546,7 +547,7 @@ function ($arr) {
},
$fielddata
)
)
),
];
$fieldsforbackup = array_merge($fieldsforbackup, $this->cfhandler->get_instance_data_for_backup($id));
// Backup annotations. Check for function existence for the sake of backward compatibility.
Expand Down
10 changes: 5 additions & 5 deletions classes/local/model/cms_types.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,23 +68,23 @@ protected static function define_properties(): array {
],
'description' => [
'type' => PARAM_RAW,
'default' => ''
'default' => '',
],
'descriptionformat' => [
'type' => PARAM_INT,
'default' => 1
'default' => 1,
],
'title_mustache' => [
'type' => PARAM_TEXT,
'default' => ''
'default' => '',
],
'mustache' => [
'type' => PARAM_RAW,
'default' => '{{{debug}}}'
'default' => '{{{debug}}}',
],
'datasources' => [
'type' => PARAM_TEXT,
'default' => ''
'default' => '',
],
'customdata' => [
'type' => PARAM_TEXT,
Expand Down
2 changes: 0 additions & 2 deletions classes/search/activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

namespace mod_cms\search;

defined('MOODLE_INTERNAL') || die();

use mod_cms\local\model\cms;
use mod_cms\local\renderer;

Expand Down
3 changes: 2 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@
* @copyright 2023, Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

require_once('../../config.php');

// TODO: This is a stub.

$id = required_param('id', PARAM_INT); // Course id.

$course = $DB->get_record('course', array('id' => $id), '*', MUST_EXIST);
$course = $DB->get_record('course', ['id' => $id], '*', MUST_EXIST);

require_login($course);
30 changes: 15 additions & 15 deletions lang/en/cms.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,36 +26,36 @@
defined('MOODLE_INTERNAL') || die();

$string['addnewtype'] = 'Add new content type';
$string['chooser:show'] = 'Show in activity chooser';
$string['chooser:hide'] = 'Hide in activity chooser';
$string['chooser:show'] = 'Show in activity chooser';
$string['customfield_manage_heading'] = 'Manage custom fields for content type "{$a}"';
$string['datasources'] = 'Datasources';
$string['datasources_desc'] = 'This is a performance measure. Select datasources to be included in this type. Only selected datasources will be configurable,
or editable at the instance level, or be called upon to provide data. Some datasources are always included and do not appear in
this list.';
$string['editcontenttype'] = 'Edit content type';
$string['export'] = 'Export';
$string['import'] = 'Import';
$string['idnumber'] = 'ID number';
$string['idnumber_help'] = 'An identifier to uniquely label this CMS type. This will be used in backup and restoring. It must be unique within the system, and ideally, unique universally.';
$string['idnumber_exists'] = 'Id number \'{$a}\' already exists in the system.';
$string['idnumber_help'] = 'An identifier to uniquely label this CMS type. This will be used in backup and restoring. It must be unique within the system, and ideally, unique universally.';
$string['import'] = 'Import';
$string['import_cms_type'] = 'Import content type';
$string['import_file'] = 'Import file';
$string['manage_types_return'] = 'Return to manage types';
$string['managetypes'] = 'Manage content types';
$string['maxgrade'] = 'Default max grade';
$string['maxgrade_desc'] = 'The default max grade when creating a new custom content type instance.';
$string['modulename'] = 'CMS';
$string['modulenameplural'] = 'CMS';
$string['newcontenttype'] = 'Add new content type';
$string['pluginname'] = 'CMS';
$string['settings'] = 'Custom content type settings';
$string['table:name'] = 'Custom content type';
$string['table:numinstances'] = 'Number of instances';
$string['pluginadministration'] = 'Plugin administration';
$string['pluginname'] = 'CMS';
$string['preview_with_hint'] = 'Preview (click "{$a}" to update)';
$string['customfield_manage_heading'] = 'Manage custom fields for content type "{$a}"';
$string['manage_types_return'] = 'Return to manage types';
$string['sample_value'] = 'Sample value';
$string['settings'] = 'Custom content type settings';
$string['some_name'] = 'Some name';
$string['import_file'] = 'Import file';
$string['import_cms_type'] = 'Import content type';
$string['datasources'] = 'Datasources';
$string['datasources_desc'] = 'This is a performance measure. Select datasources to be included in this type. Only selected datasources will be configurable,
or editable at the instance level, or be called upon to provide data. Some datasources are always included and do not appear in
this list.';
$string['table:name'] = 'Custom content type';
$string['table:numinstances'] = 'Number of instances';
$string['visibility_updated'] = 'Visibility updated';

// Cache defs.
Expand Down
8 changes: 4 additions & 4 deletions tests/cms_instance_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* @copyright 2023, Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class cms_instance_test extends \advanced_testcase {
final class cms_instance_test extends \advanced_testcase {
use test_import1_trait;

/**
Expand All @@ -49,7 +49,7 @@ protected function setUp(): void {
* @covers \mod_cms\local\lib::add_instance
* @throws \coding_exception
*/
public function test_add_instance() {
public function test_add_instance(): void {
$cmstype = $this->import();

// Create a course.
Expand Down Expand Up @@ -80,7 +80,7 @@ public function test_add_instance() {
* @covers \mod_cms\local\lib::add_instance
* @throws \coding_exception
*/
public function test_update_instance() {
public function test_update_instance(): void {
$cmstype = $this->import();

// Create a course.
Expand Down Expand Up @@ -113,7 +113,7 @@ public function test_update_instance() {
*
* @covers \mod_cms\local\lib::delete_instance
*/
public function test_delete_instance() {
public function test_delete_instance(): void {
$cmstype = $this->import();

// Create a course.
Expand Down
12 changes: 6 additions & 6 deletions tests/cms_types_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* @copyright 2023, Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class cms_types_test extends \advanced_testcase {
final class cms_types_test extends \advanced_testcase {
/** Test data for import/export. */
public const IMPORT_DATAFILE = __DIR__ . '/fixtures/type_data.json';

Expand All @@ -54,7 +54,7 @@ protected function setUp(): void {
* @param string $mustache
* @param bool $valid
*/
public function test_mustache_validity(string $field, string $mustache, bool $valid) {
public function test_mustache_validity(string $field, string $mustache, bool $valid): void {
$cmstype = new cms_types();
$cmstype->set($field, $mustache);

Expand All @@ -71,7 +71,7 @@ public function test_mustache_validity(string $field, string $mustache, bool $va
*
* @return array[]
*/
public function mustache_validity_datasource(): array {
public static function mustache_validity_datasource(): array {
return [
['title_mustache', 'test', true],
['title_mustache', '{{test}}', true],
Expand All @@ -92,7 +92,7 @@ public function mustache_validity_datasource(): array {
* @param string|null $idnumber
* @param bool $valid
*/
public function test_idnumber(?string $idnumber, bool $valid) {
public function test_idnumber(?string $idnumber, bool $valid): void {

$cmstype = new cms_types();
$cmstype->set('name', 'name');
Expand All @@ -115,7 +115,7 @@ public function test_idnumber(?string $idnumber, bool $valid) {
*
* @return array[]
*/
public function idnumber_validity_datasource(): array {
public static function idnumber_validity_datasource(): array {
return [
[null, false],
['', false],
Expand All @@ -133,7 +133,7 @@ public function idnumber_validity_datasource(): array {
* @covers \mod_cms\local\model\cms_types::get_cache_key
* @covers \mod_cms\local\model\cms_types::get_icon_metadata
*/
public function test_import() {
public function test_import(): void {
$importdata = json_decode(file_get_contents(self::IMPORT_DATAFILE));
$cmstype = new cms_types();
$cmstype->set_from_import($importdata);
Expand Down
8 changes: 4 additions & 4 deletions tests/datasource_base_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* @copyright 2023, Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class datasource_base_test extends \advanced_testcase {
final class datasource_base_test extends \advanced_testcase {
/**
* Set up before each test
*/
Expand All @@ -43,7 +43,7 @@ protected function setUp(): void {
* @covers \mod_cms\local\datasource\base::register_datasources
* @covers \mod_cms\local\datasource\base::add_datasource_class
*/
public function test_get_datasources() {
public function test_get_datasources(): void {
$cmstype = new cms_types();
$cmstype->set('name', 'somename');
$cmstype->set('idnumber', 'test-name');
Expand Down Expand Up @@ -71,7 +71,7 @@ public function test_get_datasources() {
* @param string $classname
* @param string $errormessage
*/
public function test_add_datasource_class_errors(string $classname, string $errormessage) {
public function test_add_datasource_class_errors(string $classname, string $errormessage): void {
// Make sure the datasources are there.
dsbase::register_datasources();

Expand All @@ -87,7 +87,7 @@ public function test_add_datasource_class_errors(string $classname, string $erro
*
* @return array[]
*/
public function add_datasource_class_provider() {
public static function add_datasource_class_provider(): array {
return [
['not_a_namespace\\not_a_class', get_string('error:class_missing', 'mod_cms', 'not_a_namespace\\not_a_class')],
['mod_cms\\local\\lib', get_string('error:must_be_base', 'mod_cms', 'mod_cms\\local\\lib')],
Expand Down
Loading
Loading