Skip to content

Commit 9bc6456

Browse files
authored
Merge pull request #128 from catalyst/add-create-instance
Add create instance to generator #122
2 parents 6afcda1 + 6ecc72c commit 9bc6456

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

tests/generator/lib.php

+17-1
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,27 @@
2626
* @copyright 2024, Catalyst IT
2727
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2828
*/
29-
class mod_cms_generator extends \component_generator_base {
29+
class mod_cms_generator extends testing_module_generator {
3030

3131
/** @var int */
3232
protected $cmstypecount = 0;
3333

34+
/**
35+
* Create new cms module instance
36+
*
37+
* @param array|stdClass $record
38+
* @param array $options
39+
* @return stdClass
40+
*/
41+
public function create_instance($record = null, array $options = null) {
42+
$record = (object) (array) $record;
43+
44+
// Simple setup to pass core_calendar\container_test::test_delete_module_delete_events.
45+
$record->typeid = 0;
46+
47+
return parent::create_instance($record, (array) $options);
48+
}
49+
3450
/**
3551
* Get generator for custom fields.
3652
* @return core_customfield_generator

0 commit comments

Comments
 (0)