Make Moodle Code Checker happy

This commit is contained in:
Mark Nelson 2022-01-10 17:25:42 +08:00
parent 12d8122c14
commit 8bc26b9508
6 changed files with 83 additions and 51 deletions

View file

@ -21,6 +21,13 @@
* @copyright 2018 Dmitrii Metelkin <dmitriim@catalyst-au.net> * @copyright 2018 Dmitrii Metelkin <dmitriim@catalyst-au.net>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
namespace customcertelement_daterange;
use stdClass;
use advanced_testcase;
use fake_datarange_element;
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
global $CFG; global $CFG;
@ -34,7 +41,7 @@ require_once($CFG->dirroot . '/mod/customcert/element/daterange/tests/fixtures/f
* @copyright 2018 Dmitrii Metelkin <dmitriim@catalyst-au.net> * @copyright 2018 Dmitrii Metelkin <dmitriim@catalyst-au.net>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
class customcertelement_daterange_element_test extends advanced_testcase { class element_test extends advanced_testcase {
/** /**
* Helper function to build element data. * Helper function to build element data.
@ -82,7 +89,7 @@ class customcertelement_daterange_element_test extends advanced_testcase {
* @param array $dataranges A list of dataranges. * @param array $dataranges A list of dataranges.
* @param string $fallbackstring Fall back strin * @param string $fallbackstring Fall back strin
* *
* @return \fake_datarange_element * @return fake_datarange_element
*/ */
protected function get_datarange_element(array $dataranges, $fallbackstring = '') { protected function get_datarange_element(array $dataranges, $fallbackstring = '') {
$datarangedata = $this->build_datarange_data($dataranges, $fallbackstring); $datarangedata = $this->build_datarange_data($dataranges, $fallbackstring);

View file

@ -23,6 +23,14 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
namespace mod_customcert;
use grade_item;
use grade_grade;
use context_module;
use context_system;
use advanced_testcase;
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
global $CFG; global $CFG;
@ -35,7 +43,7 @@ global $CFG;
* @copyright 2017 Mark Nelson <markn@moodle.com> * @copyright 2017 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
class mod_customcert_element_helper_testcase extends advanced_testcase { class element_helper_test extends advanced_testcase {
/** /**
* Test set up. * Test set up.
@ -58,7 +66,7 @@ class mod_customcert_element_helper_testcase extends advanced_testcase {
// Get the template to add elements to. // Get the template to add elements to.
$template = $DB->get_record('customcert_templates', array('contextid' => context_module::instance($customcert->cmid)->id)); $template = $DB->get_record('customcert_templates', array('contextid' => context_module::instance($customcert->cmid)->id));
$template = new \mod_customcert\template($template); $template = new template($template);
// Add a page to the template. // Add a page to the template.
$pageid = $template->add_page(); $pageid = $template->add_page();
@ -68,12 +76,12 @@ class mod_customcert_element_helper_testcase extends advanced_testcase {
$element->name = 'Test element'; $element->name = 'Test element';
$element->element = 'testelement'; $element->element = 'testelement';
$element->pageid = $pageid; $element->pageid = $pageid;
$element->sequence = \mod_customcert\element_helper::get_element_sequence($element->pageid); $element->sequence = element_helper::get_element_sequence($element->pageid);
$element->timecreated = time(); $element->timecreated = time();
$element->id = $DB->insert_record('customcert_elements', $element); $element->id = $DB->insert_record('customcert_elements', $element);
// Confirm the correct course id is returned. // Confirm the correct course id is returned.
$this->assertEquals($course->id, \mod_customcert\element_helper::get_courseid($element->id)); $this->assertEquals($course->id, element_helper::get_courseid($element->id));
} }
/** /**
@ -83,7 +91,7 @@ class mod_customcert_element_helper_testcase extends advanced_testcase {
global $DB, $SITE; global $DB, $SITE;
// Add a template to the site. // Add a template to the site.
$template = \mod_customcert\template::create('Site template', context_system::instance()->id); $template = template::create('Site template', context_system::instance()->id);
// Add a page to the template. // Add a page to the template.
$pageid = $template->add_page(); $pageid = $template->add_page();
@ -93,12 +101,12 @@ class mod_customcert_element_helper_testcase extends advanced_testcase {
$element->name = 'Test element'; $element->name = 'Test element';
$element->element = 'testelement'; $element->element = 'testelement';
$element->pageid = $pageid; $element->pageid = $pageid;
$element->sequence = \mod_customcert\element_helper::get_element_sequence($element->pageid); $element->sequence = element_helper::get_element_sequence($element->pageid);
$element->timecreated = time(); $element->timecreated = time();
$element->id = $DB->insert_record('customcert_elements', $element); $element->id = $DB->insert_record('customcert_elements', $element);
// Confirm the correct course id is returned. // Confirm the correct course id is returned.
$this->assertEquals($SITE->id, \mod_customcert\element_helper::get_courseid($element->id)); $this->assertEquals($SITE->id, element_helper::get_courseid($element->id));
} }
/** /**
@ -115,7 +123,7 @@ class mod_customcert_element_helper_testcase extends advanced_testcase {
// Get the template to add elements to. // Get the template to add elements to.
$template = $DB->get_record('customcert_templates', array('contextid' => context_module::instance($customcert->cmid)->id)); $template = $DB->get_record('customcert_templates', array('contextid' => context_module::instance($customcert->cmid)->id));
$template = new \mod_customcert\template($template); $template = new template($template);
// Add a page to the template. // Add a page to the template.
$pageid = $template->add_page(); $pageid = $template->add_page();
@ -125,13 +133,13 @@ class mod_customcert_element_helper_testcase extends advanced_testcase {
$element->name = 'Test element'; $element->name = 'Test element';
$element->element = 'testelement'; $element->element = 'testelement';
$element->pageid = $pageid; $element->pageid = $pageid;
$element->sequence = \mod_customcert\element_helper::get_element_sequence($element->pageid); $element->sequence = element_helper::get_element_sequence($element->pageid);
$element->timecreated = time(); $element->timecreated = time();
$element->id = $DB->insert_record('customcert_elements', $element); $element->id = $DB->insert_record('customcert_elements', $element);
// Confirm the correct course module id is returned. // Confirm the correct course module id is returned.
$this->assertEquals(context_module::instance($customcert->cmid), $this->assertEquals(context_module::instance($customcert->cmid),
\mod_customcert\element_helper::get_context($element->id)); element_helper::get_context($element->id));
} }
/** /**
@ -141,7 +149,7 @@ class mod_customcert_element_helper_testcase extends advanced_testcase {
global $DB; global $DB;
// Add a template to the site. // Add a template to the site.
$template = \mod_customcert\template::create('Site template', context_system::instance()->id); $template = template::create('Site template', context_system::instance()->id);
// Add a page to the template. // Add a page to the template.
$pageid = $template->add_page(); $pageid = $template->add_page();
@ -151,12 +159,12 @@ class mod_customcert_element_helper_testcase extends advanced_testcase {
$element->name = 'Test element'; $element->name = 'Test element';
$element->element = 'testelement'; $element->element = 'testelement';
$element->pageid = $pageid; $element->pageid = $pageid;
$element->sequence = \mod_customcert\element_helper::get_element_sequence($element->pageid); $element->sequence = element_helper::get_element_sequence($element->pageid);
$element->timecreated = time(); $element->timecreated = time();
$element->id = $DB->insert_record('customcert_elements', $element); $element->id = $DB->insert_record('customcert_elements', $element);
// Confirm the correct course module id is returned. // Confirm the correct course module id is returned.
$this->assertEquals(context_system::instance(), \mod_customcert\element_helper::get_context($element->id)); $this->assertEquals(context_system::instance(), element_helper::get_context($element->id));
} }
/** /**
@ -190,7 +198,7 @@ class mod_customcert_element_helper_testcase extends advanced_testcase {
); );
// Confirm the function returns the correct number of grade items. // Confirm the function returns the correct number of grade items.
$gradeitems = \mod_customcert\element_helper::get_grade_items($course); $gradeitems = element_helper::get_grade_items($course);
$this->assertCount(6, $gradeitems); $this->assertCount(6, $gradeitems);
$this->assertArrayHasKey($assign1->cmid, $gradeitems); $this->assertArrayHasKey($assign1->cmid, $gradeitems);
$this->assertArrayHasKey($assign2->cmid, $gradeitems); $this->assertArrayHasKey($assign2->cmid, $gradeitems);
@ -244,7 +252,7 @@ class mod_customcert_element_helper_testcase extends advanced_testcase {
$grade->insert(); $grade->insert();
// Check that the user received the grade. // Check that the user received the grade.
$grade = \mod_customcert\element_helper::get_mod_grade_info( $grade = element_helper::get_mod_grade_info(
$assign->cmid, $assign->cmid,
GRADE_DISPLAY_TYPE_PERCENTAGE, GRADE_DISPLAY_TYPE_PERCENTAGE,
$student1->id $student1->id
@ -256,7 +264,7 @@ class mod_customcert_element_helper_testcase extends advanced_testcase {
$this->assertEquals($time, $grade->get_dategraded()); $this->assertEquals($time, $grade->get_dategraded());
// Check that the user we did not grade has no grade. // Check that the user we did not grade has no grade.
$grade = \mod_customcert\element_helper::get_mod_grade_info( $grade = element_helper::get_mod_grade_info(
$assign->cmid, $assign->cmid,
GRADE_DISPLAY_TYPE_PERCENTAGE, GRADE_DISPLAY_TYPE_PERCENTAGE,
$student2->id $student2->id
@ -304,7 +312,7 @@ class mod_customcert_element_helper_testcase extends advanced_testcase {
$grade->insert(); $grade->insert();
// Check that the user received the grade. // Check that the user received the grade.
$grade = \mod_customcert\element_helper::get_course_grade_info( $grade = element_helper::get_course_grade_info(
$course->id, $course->id,
GRADE_DISPLAY_TYPE_PERCENTAGE, GRADE_DISPLAY_TYPE_PERCENTAGE,
$student1->id $student1->id
@ -316,7 +324,7 @@ class mod_customcert_element_helper_testcase extends advanced_testcase {
$this->assertEquals($time, $grade->get_dategraded()); $this->assertEquals($time, $grade->get_dategraded());
// Check that the user we did not grade has no grade. // Check that the user we did not grade has no grade.
$grade = \mod_customcert\element_helper::get_course_grade_info( $grade = element_helper::get_course_grade_info(
$course->id, $course->id,
GRADE_DISPLAY_TYPE_PERCENTAGE, GRADE_DISPLAY_TYPE_PERCENTAGE,
$student2->id $student2->id
@ -366,7 +374,7 @@ class mod_customcert_element_helper_testcase extends advanced_testcase {
$grade->insert(); $grade->insert();
// Check that the user received the grade. // Check that the user received the grade.
$grade = \mod_customcert\element_helper::get_grade_item_info( $grade = element_helper::get_grade_item_info(
$gi->id, $gi->id,
GRADE_DISPLAY_TYPE_PERCENTAGE, GRADE_DISPLAY_TYPE_PERCENTAGE,
$student1->id $student1->id
@ -378,7 +386,7 @@ class mod_customcert_element_helper_testcase extends advanced_testcase {
$this->assertEquals($time, $grade->get_dategraded()); $this->assertEquals($time, $grade->get_dategraded());
// Check that the user we did not grade has no grade. // Check that the user we did not grade has no grade.
$grade = \mod_customcert\element_helper::get_grade_item_info( $grade = element_helper::get_grade_item_info(
$gi->id, $gi->id,
GRADE_DISPLAY_TYPE_PERCENTAGE, GRADE_DISPLAY_TYPE_PERCENTAGE,
$student2->id $student2->id

View file

@ -23,6 +23,13 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
namespace mod_customcert;
use stdClass;
use context_course;
use advanced_testcase;
use mod_customcert\task\email_certificate_task;
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
/** /**
@ -33,7 +40,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2017 Mark Nelson <markn@moodle.com> * @copyright 2017 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
class mod_customcert_task_email_certificate_task_testcase extends advanced_testcase { class email_certificate_task_test extends advanced_testcase {
/** /**
* Test set up. * Test set up.
@ -60,7 +67,7 @@ class mod_customcert_task_email_certificate_task_testcase extends advanced_testc
// Run the task. // Run the task.
$sink = $this->redirectEmails(); $sink = $this->redirectEmails();
$task = new \mod_customcert\task\email_certificate_task(); $task = new email_certificate_task();
$task->execute(); $task->execute();
$emails = $sink->get_messages(); $emails = $sink->get_messages();
@ -96,7 +103,7 @@ class mod_customcert_task_email_certificate_task_testcase extends advanced_testc
$template->id = $customcert->templateid; $template->id = $customcert->templateid;
$template->name = 'A template'; $template->name = 'A template';
$template->contextid = context_course::instance($course->id)->id; $template->contextid = context_course::instance($course->id)->id;
$template = new \mod_customcert\template($template); $template = new template($template);
// Add a page to this template. // Add a page to this template.
$pageid = $template->add_page(); $pageid = $template->add_page();
@ -109,7 +116,7 @@ class mod_customcert_task_email_certificate_task_testcase extends advanced_testc
// Run the task. // Run the task.
$sink = $this->redirectEmails(); $sink = $this->redirectEmails();
$task = new \mod_customcert\task\email_certificate_task(); $task = new email_certificate_task();
$task->execute(); $task->execute();
$emails = $sink->get_messages(); $emails = $sink->get_messages();
@ -148,7 +155,7 @@ class mod_customcert_task_email_certificate_task_testcase extends advanced_testc
$template->id = $customcert->templateid; $template->id = $customcert->templateid;
$template->name = 'A template'; $template->name = 'A template';
$template->contextid = context_course::instance($course->id)->id; $template->contextid = context_course::instance($course->id)->id;
$template = new \mod_customcert\template($template); $template = new template($template);
// Add a page to this template. // Add a page to this template.
$pageid = $template->add_page(); $pageid = $template->add_page();
@ -167,7 +174,7 @@ class mod_customcert_task_email_certificate_task_testcase extends advanced_testc
// Run the task. // Run the task.
$sink = $this->redirectEmails(); $sink = $this->redirectEmails();
$task = new \mod_customcert\task\email_certificate_task(); $task = new email_certificate_task();
$task->execute(); $task->execute();
$emails = $sink->get_messages(); $emails = $sink->get_messages();
@ -192,7 +199,7 @@ class mod_customcert_task_email_certificate_task_testcase extends advanced_testc
// Now, run the task again and ensure we did not issue any more certificates. // Now, run the task again and ensure we did not issue any more certificates.
$sink = $this->redirectEmails(); $sink = $this->redirectEmails();
$task = new \mod_customcert\task\email_certificate_task(); $task = new email_certificate_task();
$task->execute(); $task->execute();
$emails = $sink->get_messages(); $emails = $sink->get_messages();
@ -233,7 +240,7 @@ class mod_customcert_task_email_certificate_task_testcase extends advanced_testc
$template->id = $customcert->templateid; $template->id = $customcert->templateid;
$template->name = 'A template'; $template->name = 'A template';
$template->contextid = context_course::instance($course->id)->id; $template->contextid = context_course::instance($course->id)->id;
$template = new \mod_customcert\template($template); $template = new template($template);
// Add a page to this template. // Add a page to this template.
$pageid = $template->add_page(); $pageid = $template->add_page();
@ -246,7 +253,7 @@ class mod_customcert_task_email_certificate_task_testcase extends advanced_testc
// Run the task. // Run the task.
$sink = $this->redirectEmails(); $sink = $this->redirectEmails();
$task = new \mod_customcert\task\email_certificate_task(); $task = new email_certificate_task();
$task->execute(); $task->execute();
$emails = $sink->get_messages(); $emails = $sink->get_messages();
@ -286,7 +293,7 @@ class mod_customcert_task_email_certificate_task_testcase extends advanced_testc
$template->id = $customcert->templateid; $template->id = $customcert->templateid;
$template->name = 'A template'; $template->name = 'A template';
$template->contextid = context_course::instance($course->id)->id; $template->contextid = context_course::instance($course->id)->id;
$template = new \mod_customcert\template($template); $template = new template($template);
// Add a page to this template. // Add a page to this template.
$pageid = $template->add_page(); $pageid = $template->add_page();
@ -299,7 +306,7 @@ class mod_customcert_task_email_certificate_task_testcase extends advanced_testc
// Run the task. // Run the task.
$sink = $this->redirectEmails(); $sink = $this->redirectEmails();
$task = new \mod_customcert\task\email_certificate_task(); $task = new email_certificate_task();
$task->execute(); $task->execute();
$emails = $sink->get_messages(); $emails = $sink->get_messages();
@ -337,7 +344,7 @@ class mod_customcert_task_email_certificate_task_testcase extends advanced_testc
$template->id = $customcert->templateid; $template->id = $customcert->templateid;
$template->name = 'A template'; $template->name = 'A template';
$template->contextid = context_course::instance($course->id)->id; $template->contextid = context_course::instance($course->id)->id;
$template = new \mod_customcert\template($template); $template = new template($template);
// Add a page to this template. // Add a page to this template.
$pageid = $template->add_page(); $pageid = $template->add_page();
@ -353,7 +360,7 @@ class mod_customcert_task_email_certificate_task_testcase extends advanced_testc
// Run the task. // Run the task.
$sink = $this->redirectEmails(); $sink = $this->redirectEmails();
$task = new \mod_customcert\task\email_certificate_task(); $task = new email_certificate_task();
$task->execute(); $task->execute();
$emails = $sink->get_messages(); $emails = $sink->get_messages();
@ -392,7 +399,7 @@ class mod_customcert_task_email_certificate_task_testcase extends advanced_testc
$template->id = $customcert->templateid; $template->id = $customcert->templateid;
$template->name = 'A template'; $template->name = 'A template';
$template->contextid = context_course::instance($course->id)->id; $template->contextid = context_course::instance($course->id)->id;
$template = new \mod_customcert\template($template); $template = new template($template);
// Add a page to this template. // Add a page to this template.
$pageid = $template->add_page(); $pageid = $template->add_page();
@ -405,7 +412,7 @@ class mod_customcert_task_email_certificate_task_testcase extends advanced_testc
// Run the task. // Run the task.
$sink = $this->redirectEmails(); $sink = $this->redirectEmails();
$task = new \mod_customcert\task\email_certificate_task(); $task = new email_certificate_task();
$task->execute(); $task->execute();
$emails = $sink->get_messages(); $emails = $sink->get_messages();

View file

@ -23,6 +23,11 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
namespace mod_customcert;
use external_api;
use advanced_testcase;
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
global $CFG; global $CFG;
@ -35,7 +40,7 @@ global $CFG;
* @copyright 2018 Mark Nelson <markn@moodle.com> * @copyright 2018 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
class mod_customcert_external_test_testcase extends advanced_testcase { class external_test extends advanced_testcase {
/** /**
* Test set up. * Test set up.
@ -67,15 +72,15 @@ class mod_customcert_external_test_testcase extends advanced_testcase {
$this->getDataGenerator()->enrol_user($student2->id, $course->id); $this->getDataGenerator()->enrol_user($student2->id, $course->id);
// Issue them both certificates. // Issue them both certificates.
$i1 = \mod_customcert\certificate::issue_certificate($customcert->id, $student1->id); $i1 = certificate::issue_certificate($customcert->id, $student1->id);
$i2 = \mod_customcert\certificate::issue_certificate($customcert->id, $student2->id); $i2 = certificate::issue_certificate($customcert->id, $student2->id);
$this->assertEquals(2, $DB->count_records('customcert_issues')); $this->assertEquals(2, $DB->count_records('customcert_issues'));
$result = \mod_customcert\external::delete_issue($customcert->id, $i2); $result = external::delete_issue($customcert->id, $i2);
// We need to execute the return values cleaning process to simulate the web service server. // We need to execute the return values cleaning process to simulate the web service server.
external_api::clean_returnvalue(\mod_customcert\external::delete_issue_returns(), $result); external_api::clean_returnvalue(external::delete_issue_returns(), $result);
$issues = $DB->get_records('customcert_issues'); $issues = $DB->get_records('customcert_issues');
$this->assertCount(1, $issues); $this->assertCount(1, $issues);
@ -105,14 +110,14 @@ class mod_customcert_external_test_testcase extends advanced_testcase {
$this->getDataGenerator()->enrol_user($student2->id, $course->id); $this->getDataGenerator()->enrol_user($student2->id, $course->id);
// Issue them both certificates. // Issue them both certificates.
$i1 = \mod_customcert\certificate::issue_certificate($customcert->id, $student1->id); $i1 = certificate::issue_certificate($customcert->id, $student1->id);
$i2 = \mod_customcert\certificate::issue_certificate($customcert->id, $student2->id); $i2 = certificate::issue_certificate($customcert->id, $student2->id);
$this->assertEquals(2, $DB->count_records('customcert_issues')); $this->assertEquals(2, $DB->count_records('customcert_issues'));
// Try and delete without logging in. // Try and delete without logging in.
$this->expectException('require_login_exception'); $this->expectException('require_login_exception');
\mod_customcert\external::delete_issue($customcert->id, $i2); external::delete_issue($customcert->id, $i2);
} }
/** /**
@ -138,13 +143,13 @@ class mod_customcert_external_test_testcase extends advanced_testcase {
$this->getDataGenerator()->enrol_user($student2->id, $course->id); $this->getDataGenerator()->enrol_user($student2->id, $course->id);
// Issue them both certificates. // Issue them both certificates.
$i1 = \mod_customcert\certificate::issue_certificate($customcert->id, $student1->id); $i1 = certificate::issue_certificate($customcert->id, $student1->id);
$i2 = \mod_customcert\certificate::issue_certificate($customcert->id, $student2->id); $i2 = certificate::issue_certificate($customcert->id, $student2->id);
$this->assertEquals(2, $DB->count_records('customcert_issues')); $this->assertEquals(2, $DB->count_records('customcert_issues'));
// Try and delete without the required capability. // Try and delete without the required capability.
$this->expectException('required_capability_exception'); $this->expectException('required_capability_exception');
\mod_customcert\external::delete_issue($customcert->id, $i2); external::delete_issue($customcert->id, $i2);
} }
} }

View file

@ -22,6 +22,11 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
namespace mod_customcert;
use stdClass;
use context_module;
use context_system;
use mod_customcert\privacy\provider; use mod_customcert\privacy\provider;
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
@ -33,7 +38,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2018 Mark Nelson <markn@moodle.com> * @copyright 2018 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
class mod_customcert_privacy_provider_testcase extends \core_privacy\tests\provider_testcase { class privacy_provider_test extends \core_privacy\tests\provider_testcase {
/** /**
* Test for provider::get_contexts_for_userid(). * Test for provider::get_contexts_for_userid().
@ -293,7 +298,7 @@ class mod_customcert_privacy_provider_testcase extends \core_privacy\tests\provi
$customcertissue = new stdClass(); $customcertissue = new stdClass();
$customcertissue->customcertid = $customcertid; $customcertissue->customcertid = $customcertid;
$customcertissue->userid = $userid; $customcertissue->userid = $userid;
$customcertissue->code = \mod_customcert\certificate::generate_code(); $customcertissue->code = certificate::generate_code();
$customcertissue->timecreated = time() + $i; $customcertissue->timecreated = time() + $i;
// Insert the record into the database. // Insert the record into the database.