Skip to content
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

Add create instance to generator #122 #128

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Changes from all commits
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
18 changes: 17 additions & 1 deletion tests/generator/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,27 @@
* @copyright 2024, Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class mod_cms_generator extends \component_generator_base {
class mod_cms_generator extends testing_module_generator {

/** @var int */
protected $cmstypecount = 0;

/**
* Create new cms module instance
*
* @param array|stdClass $record
* @param array $options
* @return stdClass
*/
public function create_instance($record = null, array $options = null) {
$record = (object) (array) $record;

// Simple setup to pass core_calendar\container_test::test_delete_module_delete_events.
$record->typeid = 0;

return parent::create_instance($record, (array) $options);
}

/**
* Get generator for custom fields.
* @return core_customfield_generator
Expand Down
Loading