Merge branch 'MDL-77350-402' of https://github.com/meirzamoodle/moodle into MOODLE_402_STABLE
This commit is contained in:
@@ -168,7 +168,6 @@ foreach ($filterdata->services as $i => $serviceid) {
|
||||
$table->define_baseurl($baseurl);
|
||||
|
||||
$table->attributes['class'] = 'admintable generaltable';
|
||||
$table->data = [];
|
||||
$table->out(30, false);
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
|
||||
+6
@@ -45,6 +45,12 @@ require_once($CFG->dirroot . '/webservice/tests/helpers.php');
|
||||
*/
|
||||
class external_test extends externallib_advanced_testcase {
|
||||
|
||||
/** @var int custom profile field1 ID. */
|
||||
protected $field1;
|
||||
|
||||
/** @var int custom profile field2 ID. */
|
||||
protected $field2;
|
||||
|
||||
/**
|
||||
* Set up for every test
|
||||
*/
|
||||
|
||||
@@ -86,6 +86,18 @@ require_once($CFG->dirroot.'/auth/ldap/locallib.php');
|
||||
*/
|
||||
class auth_plugin_ldap extends auth_plugin_base {
|
||||
|
||||
/** @var string */
|
||||
protected $roleauth;
|
||||
|
||||
/** @var string */
|
||||
public $pluginconfig;
|
||||
|
||||
/** @var LDAP\Connection LDAP connection. */
|
||||
protected $ldapconnection;
|
||||
|
||||
/** @var int */
|
||||
protected $ldapconns = 0;
|
||||
|
||||
/**
|
||||
* Init plugin config from database settings depending on the plugin auth type.
|
||||
*/
|
||||
|
||||
@@ -32,6 +32,9 @@ require_once($CFG->libdir.'/authlib.php');
|
||||
*/
|
||||
class auth_plugin_mnet extends auth_plugin_base {
|
||||
|
||||
/** @var mnet_environment mnet environment. */
|
||||
protected $mnet;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
|
||||
@@ -37,7 +37,7 @@ class frontend extends \core_availability\frontend {
|
||||
/**
|
||||
* @var array Cached init parameters
|
||||
*/
|
||||
protected $cacheparams = [];
|
||||
protected $cacheinitparams = [];
|
||||
|
||||
/**
|
||||
* @var string IDs of course, cm, and section for cache (if any)
|
||||
|
||||
@@ -81,7 +81,7 @@ class backpack_api2p1 {
|
||||
if (!empty($externalbackpack)) {
|
||||
$this->externalbackpack = $externalbackpack;
|
||||
$this->backpackapiversion = $externalbackpack->apiversion;
|
||||
$this->get_clientid = $this->get_clientid($externalbackpack->oauth2_issuerid);
|
||||
$this->get_clientid($externalbackpack->oauth2_issuerid);
|
||||
|
||||
if (!($this->tokendata = $this->get_stored_token($externalbackpack->id))
|
||||
&& $this->backpackapiversion != OPEN_BADGES_V2P1) {
|
||||
|
||||
@@ -67,6 +67,12 @@ class backpack_api2p1_mapping {
|
||||
/** @var boolean Differentiate the function that can be called on a user backpack or a site backpack. */
|
||||
private $isuserbackpack;
|
||||
|
||||
/** @var mixed List of parameters for this method. */
|
||||
protected $postparams;
|
||||
|
||||
/** @var int OpenBadges version 1 or 2. */
|
||||
protected $backpackapiversion;
|
||||
|
||||
/**
|
||||
* Create a mapping.
|
||||
*
|
||||
|
||||
@@ -79,6 +79,12 @@ class backpack_api_mapping {
|
||||
/** @var string Error string from authentication request. */
|
||||
private static $authenticationerror = '';
|
||||
|
||||
/** @var mixed List of parameters for this method. */
|
||||
protected $postparams;
|
||||
|
||||
/** @var int OpenBadges version 1 or 2. */
|
||||
protected $backpackapiversion;
|
||||
|
||||
/**
|
||||
* Create a mapping.
|
||||
*
|
||||
|
||||
@@ -129,6 +129,24 @@ class badge {
|
||||
/** @var array Badge criteria */
|
||||
public $criteria = array();
|
||||
|
||||
/** @var int|null Total users which have the award. Called from badges_get_badges() */
|
||||
public $awards;
|
||||
|
||||
/** @var string|null The name of badge status. Called from badges_get_badges() */
|
||||
public $statstring;
|
||||
|
||||
/** @var int|null The date the badges were issued. Called from badges_get_badges() */
|
||||
public $dateissued;
|
||||
|
||||
/** @var string|null Unique hash. Called from badges_get_badges() */
|
||||
public $uniquehash;
|
||||
|
||||
/** @var string|null Message format. Called from file_prepare_standard_editor() */
|
||||
public $messageformat;
|
||||
|
||||
/** @var array Message editor. Called from file_prepare_standard_editor() */
|
||||
public $message_editor = [];
|
||||
|
||||
/**
|
||||
* Constructs with badge details.
|
||||
*
|
||||
@@ -240,7 +258,16 @@ class badge {
|
||||
foreach (get_object_vars($this) as $k => $v) {
|
||||
$fordb->{$k} = $v;
|
||||
}
|
||||
// TODO: We need to making it more simple.
|
||||
// Since the variables are not exist in the badge table,
|
||||
// unsetting them is a must to avoid errors.
|
||||
unset($fordb->criteria);
|
||||
unset($fordb->awards);
|
||||
unset($fordb->statstring);
|
||||
unset($fordb->dateissued);
|
||||
unset($fordb->uniquehash);
|
||||
unset($fordb->messageformat);
|
||||
unset($fordb->message_editor);
|
||||
|
||||
$fordb->timemodified = time();
|
||||
if ($DB->update_record_raw('badge', $fordb)) {
|
||||
|
||||
@@ -39,6 +39,12 @@ use core_badges\external\backpack_exporter;
|
||||
*/
|
||||
class external_backpacks_page implements \renderable {
|
||||
|
||||
/** @var \moodle_url Badges backpacks URL. */
|
||||
protected $url;
|
||||
|
||||
/** @var array List the backpacks at site level. */
|
||||
protected $backpacks = [];
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param \moodle_url $url
|
||||
|
||||
@@ -48,9 +48,9 @@ class external_backpacks_table extends table_sql {
|
||||
public function __construct() {
|
||||
parent::__construct('backpacks');
|
||||
|
||||
$this->context = \context_system::instance();
|
||||
$context = \context_system::instance();
|
||||
// This object should not be used without the right permissions.
|
||||
require_capability('moodle/badges:manageglobalsettings', $this->context);
|
||||
require_capability('moodle/badges:manageglobalsettings', $context);
|
||||
|
||||
// Define columns in the table.
|
||||
$this->define_table_columns();
|
||||
|
||||
@@ -128,6 +128,24 @@ abstract class award_criteria {
|
||||
*/
|
||||
public $params = array();
|
||||
|
||||
/**
|
||||
* Criteria type.
|
||||
* @var string
|
||||
*/
|
||||
public $criteriatype;
|
||||
|
||||
/**
|
||||
* Required parameters.
|
||||
* @var string
|
||||
*/
|
||||
public $required_param = '';
|
||||
|
||||
/**
|
||||
* Optional parameters.
|
||||
* @var array
|
||||
*/
|
||||
public $optional_params = [];
|
||||
|
||||
/**
|
||||
* The base constructor
|
||||
*
|
||||
|
||||
@@ -35,6 +35,9 @@ class block_glossary_random extends block_base {
|
||||
*/
|
||||
protected $glossarycm = null;
|
||||
|
||||
/** @var stdClass course data. */
|
||||
public $course;
|
||||
|
||||
function init() {
|
||||
$this->title = get_string('pluginname','block_glossary_random');
|
||||
}
|
||||
|
||||
@@ -855,9 +855,6 @@ class block_tree extends block_list {
|
||||
$this->get_required_javascript();
|
||||
$this->get_content();
|
||||
$content = $output->tree_block_contents($this->content->items,array('class'=>'block_tree list'));
|
||||
if (isset($this->id) && !is_numeric($this->id)) {
|
||||
$content = $output->box($content, 'block_tree_box', $this->id);
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,6 +152,9 @@ class main implements renderable, templatable {
|
||||
*/
|
||||
private $customfieldvalue;
|
||||
|
||||
/** @var bool true if grouping selector should be shown, otherwise false. */
|
||||
protected $displaygroupingselector;
|
||||
|
||||
/**
|
||||
* main constructor.
|
||||
* Initialize the user preferences
|
||||
|
||||
@@ -32,6 +32,33 @@ require_once($CFG->dirroot . '/mod/assign/tests/generator.php');
|
||||
class observer_test extends \advanced_testcase {
|
||||
use \mod_assign_test_generator;
|
||||
|
||||
/** @var string Table name. */
|
||||
protected $table;
|
||||
|
||||
/** @var \stdClass course data. */
|
||||
protected $course;
|
||||
|
||||
/** @var \stdClass student data. */
|
||||
protected $student;
|
||||
|
||||
/** @var \stdClass teacher data. */
|
||||
protected $teacher;
|
||||
|
||||
/** @var \stdClass student role. */
|
||||
protected $studentrole;
|
||||
|
||||
/** @var \stdClass teacher role. */
|
||||
protected $teacherrole;
|
||||
|
||||
/** @var \stdClass course forum. */
|
||||
protected $forum;
|
||||
|
||||
/** @var \stdClass course glossary. */
|
||||
protected $glossary;
|
||||
|
||||
/** @var \stdClass course chat. */
|
||||
protected $chat;
|
||||
|
||||
/**
|
||||
* Set up for every test
|
||||
*/
|
||||
|
||||
@@ -68,6 +68,69 @@ class blog_entry implements renderable {
|
||||
/** @var StdClass Data needed to render the entry */
|
||||
public $renderable;
|
||||
|
||||
/** @var string summary format. */
|
||||
public string $summaryformat;
|
||||
|
||||
/** @var array summary editor. */
|
||||
public array $summary_editor;
|
||||
|
||||
/** @var string */
|
||||
public $summarytrust;
|
||||
|
||||
/** @var int course associated with the blog post. */
|
||||
public $courseassoc;
|
||||
|
||||
/** @var string module associated with the blog post. */
|
||||
public $modassoc;
|
||||
|
||||
/** @var mixed attachment. */
|
||||
public $attachment_filemanager;
|
||||
|
||||
/** @var string blog post body. */
|
||||
public $body;
|
||||
|
||||
/** @var int attachment entry id. */
|
||||
public $entryid;
|
||||
|
||||
/** @var string|null submit button. */
|
||||
public $submitbutton;
|
||||
|
||||
/** @var string|null user alias. */
|
||||
public $useridalias;
|
||||
|
||||
/** @var string|null user picture. */
|
||||
public $picture;
|
||||
|
||||
/** @var string|null user first name. */
|
||||
public $firstname;
|
||||
|
||||
/** @var string|null user middle name. */
|
||||
public $middlename;
|
||||
|
||||
/** @var string|null user last name. */
|
||||
public $lastname;
|
||||
|
||||
/** @var string|null user first name phonetic. */
|
||||
public $firstnamephonetic;
|
||||
|
||||
/** @var string|null user last name phonetic. */
|
||||
public $lastnamephonetic;
|
||||
|
||||
/** @var string|null user alternate name. */
|
||||
public $alternatename;
|
||||
|
||||
/** @var string|null user email address. */
|
||||
public $email;
|
||||
|
||||
/** @var string */
|
||||
public $action;
|
||||
|
||||
/** @var string|null user picture description. */
|
||||
public $imagealt;
|
||||
|
||||
/** @var int module instance id. */
|
||||
public $modid;
|
||||
|
||||
/**
|
||||
* Constructor. If given an id, will fetch the corresponding record from the DB.
|
||||
*
|
||||
|
||||
+3
@@ -48,6 +48,9 @@ class external_test extends \advanced_testcase {
|
||||
private $tagid;
|
||||
private $postid;
|
||||
|
||||
/** @var string publish state. */
|
||||
protected $publishstate;
|
||||
|
||||
protected function setUp(): void {
|
||||
global $DB, $CFG;
|
||||
parent::setUp();
|
||||
|
||||
Vendored
+6
@@ -65,6 +65,12 @@ class cache_config {
|
||||
*/
|
||||
protected $configdefinitionmappings = array();
|
||||
|
||||
/**
|
||||
* The locking mappings that have been configured.
|
||||
* @var array
|
||||
*/
|
||||
protected $configlockmappings = [];
|
||||
|
||||
/**
|
||||
* An array of configured cache lock instances.
|
||||
* @var array
|
||||
|
||||
Vendored
+8
@@ -59,6 +59,12 @@ class cachestore_dummy extends cache_store {
|
||||
*/
|
||||
protected $store = array();
|
||||
|
||||
/**
|
||||
* Cache definition
|
||||
* @var cache_definition
|
||||
*/
|
||||
protected $definition;
|
||||
|
||||
/**
|
||||
* Constructs a dummy store instance.
|
||||
* @param string $name
|
||||
@@ -119,6 +125,8 @@ class cachestore_dummy extends cache_store {
|
||||
} else {
|
||||
$this->persist = !$definition->use_static_acceleration();
|
||||
}
|
||||
|
||||
$this->definition = $definition;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+13
@@ -173,6 +173,19 @@ class cache implements cache_loader {
|
||||
*/
|
||||
protected $subloader = false;
|
||||
|
||||
/**
|
||||
* Gets set to true if the cache writes (set|delete) must have a manual lock created first.
|
||||
* @var bool
|
||||
*/
|
||||
protected $requirelockingbeforewrite = false;
|
||||
|
||||
/**
|
||||
* Gets set to true if the cache's primary store natively supports locking.
|
||||
* If it does then we use that, otherwise we need to instantiate a second store to use for locking.
|
||||
* @var cache_store|null
|
||||
*/
|
||||
protected $nativelocking = null;
|
||||
|
||||
/**
|
||||
* Creates a new cache instance for a pre-defined definition.
|
||||
*
|
||||
|
||||
@@ -1066,6 +1066,18 @@ class calendar_information {
|
||||
/** @var string The calendar's view mode. */
|
||||
protected $viewmode;
|
||||
|
||||
/** @var \stdClass course data. */
|
||||
public $course;
|
||||
|
||||
/** @var int day. */
|
||||
protected $day;
|
||||
|
||||
/** @var int month. */
|
||||
protected $month;
|
||||
|
||||
/** @var int year. */
|
||||
protected $year;
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
|
||||
@@ -75,7 +75,10 @@ class event_factory_test extends \advanced_testcase {
|
||||
}
|
||||
|
||||
if ($expectedattributevalue) {
|
||||
$this->assertEquals($instance->testattribute, $expectedattributevalue);
|
||||
$this->assertEquals(
|
||||
$instance->get_description()->get_value(),
|
||||
$expectedattributevalue
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -368,7 +371,6 @@ class event_factory_test extends \advanced_testcase {
|
||||
'location' => 'Test location',
|
||||
],
|
||||
'actioncallbackapplier' => function(event_interface $event) {
|
||||
$event->testattribute = 'Hello';
|
||||
return $event;
|
||||
},
|
||||
'visibilitycallbackapplier' => function(event_interface $event) {
|
||||
@@ -403,7 +405,6 @@ class event_factory_test extends \advanced_testcase {
|
||||
'location' => 'Test location',
|
||||
],
|
||||
'actioncallbackapplier' => function(event_interface $event) {
|
||||
$event->testattribute = 'Hello';
|
||||
return $event;
|
||||
},
|
||||
'visibilitycallbackapplier' => function(event_interface $event) {
|
||||
@@ -438,7 +439,6 @@ class event_factory_test extends \advanced_testcase {
|
||||
'location' => 'Test location',
|
||||
],
|
||||
'actioncallbackapplier' => function(event_interface $event) {
|
||||
$event->testattribute = 'Hello';
|
||||
return $event;
|
||||
},
|
||||
'visibilitycallbackapplier' => function(event_interface $event) {
|
||||
|
||||
@@ -96,6 +96,8 @@ class comment {
|
||||
private static $comment_page = null;
|
||||
/** @var string comment itemid component in non-javascript UI */
|
||||
private static $comment_component = null;
|
||||
/** @var stdClass comment paramaters for callback. */
|
||||
protected $comment_param;
|
||||
|
||||
/**
|
||||
* Construct function of comment class, initialise
|
||||
|
||||
@@ -27,6 +27,24 @@ class comment_manager {
|
||||
/** @var int The number of comments to display per page */
|
||||
private $perpage;
|
||||
|
||||
/** @var stdClass Course data. */
|
||||
protected $course;
|
||||
|
||||
/** @var context|bool To store the context object or false if not found. */
|
||||
protected $context;
|
||||
|
||||
/** @var stdClass Course module. */
|
||||
protected $cm;
|
||||
|
||||
/** @var course_modinfo Module information for course, or null if resetting. */
|
||||
protected $modinfo;
|
||||
|
||||
/** @var string plugin type. */
|
||||
protected $plugintype;
|
||||
|
||||
/** @var string plugin name. */
|
||||
protected $pluginname;
|
||||
|
||||
/**
|
||||
* Constructs the comment_manage object
|
||||
*/
|
||||
|
||||
@@ -53,6 +53,9 @@ class competency extends persistent {
|
||||
/** @var competency Object before update. */
|
||||
protected $beforeupdate = null;
|
||||
|
||||
/** @var competency|null To store new parent. */
|
||||
protected $newparent;
|
||||
|
||||
/**
|
||||
* Return the definition of the properties of this model.
|
||||
*
|
||||
|
||||
@@ -25,6 +25,36 @@ namespace core_competency;
|
||||
*/
|
||||
class competency_override_test extends \advanced_testcase {
|
||||
|
||||
/** @var \stdClass course record. */
|
||||
protected $course;
|
||||
|
||||
/** @var \stdClass user record. */
|
||||
protected $user;
|
||||
|
||||
/** @var \stdClass block instance record. */
|
||||
protected $scale;
|
||||
|
||||
/** @var competency_framework loading competency frameworks from the DB. */
|
||||
protected $framework;
|
||||
|
||||
/** @var plan loading competency plans from the DB. */
|
||||
protected $plan;
|
||||
|
||||
/** @var competency loading competency from the DB. */
|
||||
protected $comp1;
|
||||
|
||||
/** @var competency loading competency from the DB. */
|
||||
protected $comp2;
|
||||
|
||||
/** @var \stdClass course module. */
|
||||
protected $cm;
|
||||
|
||||
/** @var \completion_info completion information. */
|
||||
protected $completion;
|
||||
|
||||
/** @var \context_course context course. */
|
||||
protected $context;
|
||||
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminUser();
|
||||
|
||||
+5
-2
@@ -94,8 +94,11 @@ class external_test extends externallib_advanced_testcase {
|
||||
/** @var string catscaleconfiguration */
|
||||
protected $scaleconfiguration3 = null;
|
||||
|
||||
/** @var string catscaleconfiguration */
|
||||
protected $catscaleconfiguration4 = null;
|
||||
/** @var string category scale configuration. */
|
||||
protected $scaleconfiguration4 = null;
|
||||
|
||||
/** @var \core_course_category course category record. */
|
||||
protected $othercategory = null;
|
||||
|
||||
/**
|
||||
* Setup function- we will create a course and add an assign instance to it.
|
||||
|
||||
@@ -66,6 +66,8 @@ class completion_completion extends data_object {
|
||||
/* @var int Flag to trigger cron aggregation (timestamp) */
|
||||
public $reaggregate;
|
||||
|
||||
/** @var float user's course grade. */
|
||||
public $gradefinal;
|
||||
|
||||
/**
|
||||
* Finds and returns a data_object instance based on params.
|
||||
|
||||
@@ -152,6 +152,12 @@ abstract class completion_criteria extends data_object {
|
||||
/* @var int Role ID that has the ability to mark a user as complete (for role completion) */
|
||||
public $role;
|
||||
|
||||
/** @var string course instance. */
|
||||
public $courseinstance;
|
||||
|
||||
/** @var mixed time end. */
|
||||
public $timeend;
|
||||
|
||||
/**
|
||||
* Finds and returns all data_object instances based on params.
|
||||
*
|
||||
|
||||
@@ -64,6 +64,9 @@ abstract class data_object {
|
||||
/* @var int The primary key */
|
||||
public $id;
|
||||
|
||||
/** @var int completed status. */
|
||||
public $completedself;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. Optionally (and by default) attempts to fetch corresponding row from DB.
|
||||
|
||||
@@ -79,6 +79,8 @@ class section implements named_templatable, renderable {
|
||||
/** @var bool if the section is considered stealth */
|
||||
protected $isstealth = false;
|
||||
|
||||
/** @var string control menu class. */
|
||||
protected $controlmenuclass;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
||||
@@ -40,6 +40,9 @@ class enrol_ldap_plugin extends enrol_plugin {
|
||||
*/
|
||||
protected $userobjectclass;
|
||||
|
||||
/** @var LDAP\Connection LDAP connection. */
|
||||
protected $ldapconnection;
|
||||
|
||||
/**
|
||||
* Constructor for the plugin. In addition to calling the parent
|
||||
* constructor, we define and 'fix' some settings depending on the
|
||||
|
||||
@@ -29,6 +29,9 @@ class admin_setting_configtext_trim_lower extends admin_setting_configtext {
|
||||
/* @var boolean whether to lowercase the value or not before writing in to the db */
|
||||
private $lowercase;
|
||||
|
||||
/** @var bool To store enable/disabled status of the input field. */
|
||||
protected $enabled;
|
||||
|
||||
/**
|
||||
* Constructor: uses parent::__construct
|
||||
*
|
||||
|
||||
@@ -13,6 +13,9 @@ class OAuthConsumer {
|
||||
public $key;
|
||||
public $secret;
|
||||
|
||||
/** @var string|null To store callback_url. */
|
||||
protected $callback_url;
|
||||
|
||||
function __construct($key, $secret, $callback_url=NULL) {
|
||||
$this->key = $key;
|
||||
$this->secret = $secret;
|
||||
|
||||
@@ -7,3 +7,4 @@ In future releases we should look into using a supported library.
|
||||
2022-01-20 - MDL-73523 - Conditional openssl_free_key() use, deprecated by PHP 8.0
|
||||
2022-03-05 - MDL-73520 - replace deprecated php_errormsg with error_get_last(), deprecated by PHP 8.0
|
||||
2023-05-03 - MDL-77840 - Throw exception on openssl_sign to avoid null reaching base64_encode, deprecated by PHP 8.1
|
||||
2023-05-17 - MDL-77350 - Added $callback_url property to class OAuthConsumer to comply with PHP 8.2
|
||||
|
||||
+3
-2
@@ -351,6 +351,9 @@ class course_enrolment_table extends html_table implements renderable {
|
||||
'alternatename', 'username', 'idnumber', 'email', 'phone1', 'phone2',
|
||||
'institution', 'department', 'lastaccess', 'lastcourseaccess');
|
||||
|
||||
/** @var bool To store status of Other users page. */
|
||||
public $otherusers;
|
||||
|
||||
/**
|
||||
* Constructs the table
|
||||
*
|
||||
@@ -644,8 +647,6 @@ class course_enrolment_users_table extends course_enrolment_table {
|
||||
*/
|
||||
class course_enrolment_other_users_table extends course_enrolment_table {
|
||||
|
||||
public $otherusers = true;
|
||||
|
||||
/**
|
||||
* Constructs the table
|
||||
*
|
||||
|
||||
@@ -59,6 +59,9 @@ class favourite {
|
||||
/** @var int $timemodified the time at which the last modification of the favourite took place.*/
|
||||
public $timemodified;
|
||||
|
||||
/** @var string $uniquekey favourite unique key.*/
|
||||
public $uniquekey;
|
||||
|
||||
/**
|
||||
* Favourite constructor.
|
||||
* @param string $component the frankenstyle name of the component containing the favourited item. E.g. 'core_course'.
|
||||
|
||||
@@ -95,7 +95,8 @@ class favourite_repository implements favourite_repository_interface {
|
||||
'ordering' => false,
|
||||
'timecreated' => false,
|
||||
'timemodified' => false,
|
||||
'id' => false
|
||||
'id' => false,
|
||||
'uniquekey' => false
|
||||
];
|
||||
|
||||
$requiredfields = array_filter($allowedfields, function($field) {
|
||||
|
||||
@@ -81,28 +81,6 @@ class repository_test extends \advanced_testcase {
|
||||
$favouritesrepo->add($favcourse);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that malformed favourites cannot be saved.
|
||||
*/
|
||||
public function test_add_malformed_favourite() {
|
||||
list($user1context, $user2context, $course1context, $course2context) = $this->setup_users_and_courses();
|
||||
|
||||
// Create a favourites repository and favourite a course.
|
||||
$favouritesrepo = new favourite_repository($user1context);
|
||||
|
||||
$favcourse = new favourite(
|
||||
'core_course',
|
||||
'course',
|
||||
$course1context->instanceid,
|
||||
$course1context->id,
|
||||
$user1context->instanceid
|
||||
);
|
||||
$favcourse->something = 'something';
|
||||
|
||||
$this->expectException('moodle_exception');
|
||||
$favouritesrepo->add($favcourse);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that incomplete favourites cannot be saved.
|
||||
*/
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
var $temp_dir;
|
||||
var $error;
|
||||
|
||||
/** @var bool To store value of supported_platform. */
|
||||
protected $supported_platform;
|
||||
|
||||
/**
|
||||
* Constructor - create temporary directories and build paths to
|
||||
* external 'helper' binaries.
|
||||
|
||||
@@ -285,7 +285,7 @@ class media_videojs_plugin extends core_media_player_native {
|
||||
$url = reset($urls);
|
||||
|
||||
// Check against regex.
|
||||
if (preg_match($this->get_regex_youtube(), $url->out(false), $this->matches)) {
|
||||
if (preg_match($this->get_regex_youtube(), $url->out(false), $matches)) {
|
||||
$this->youtube = true;
|
||||
return array($url);
|
||||
}
|
||||
|
||||
@@ -34,6 +34,9 @@ require_once($CFG->dirroot . '/message/output/popup/tests/base.php');
|
||||
class api_test extends \advanced_testcase {
|
||||
use \message_popup_test_helper;
|
||||
|
||||
/** @var \phpunit_message_sink message redirection. */
|
||||
public $messagesink;
|
||||
|
||||
/**
|
||||
* Test set up.
|
||||
*
|
||||
|
||||
@@ -37,6 +37,9 @@ require_once($CFG->dirroot . '/message/output/popup/tests/base.php');
|
||||
class externallib_test extends \advanced_testcase {
|
||||
use message_popup_test_helper;
|
||||
|
||||
/** @var \phpunit_message_sink message redirection. */
|
||||
public $messagesink;
|
||||
|
||||
/**
|
||||
* Test set up.
|
||||
*
|
||||
|
||||
@@ -52,7 +52,6 @@ class attempt {
|
||||
*/
|
||||
public function __construct(stdClass $record) {
|
||||
$this->record = $record;
|
||||
$this->results = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,6 +50,9 @@ class portfolio_plugin_mahara extends portfolio_plugin_pull_base {
|
||||
private $totalsize; // total size of all included files added together
|
||||
private $continueurl; // if we've been sent back a specific url to continue to (eg folder id)
|
||||
|
||||
/** @var mnet_environment the equivalent of old $MNET global. */
|
||||
public $mnet;
|
||||
|
||||
protected function init() {
|
||||
$this->mnet = get_mnet_environment();
|
||||
}
|
||||
|
||||
@@ -46,6 +46,45 @@ require_once($CFG->dirroot . '/rating/lib.php');
|
||||
*/
|
||||
class externallib_test extends externallib_advanced_testcase {
|
||||
|
||||
/** @var \stdClass course record. */
|
||||
protected $course;
|
||||
|
||||
/** @var \stdClass user record. */
|
||||
protected $student1;
|
||||
|
||||
/** @var \stdClass user record. */
|
||||
protected $teacher1;
|
||||
|
||||
/** @var \stdClass user record. */
|
||||
protected $student2;
|
||||
|
||||
/** @var \stdClass user record. */
|
||||
protected $teacher2;
|
||||
|
||||
/** @var \stdClass user record. */
|
||||
protected $student3;
|
||||
|
||||
/** @var \stdClass user record. */
|
||||
protected $teacher3;
|
||||
|
||||
/** @var \stdClass activity record. */
|
||||
protected $forum;
|
||||
|
||||
/** @var \stdClass activity record. */
|
||||
protected $discussion;
|
||||
|
||||
/** @var int context instance ID. */
|
||||
protected $contextid;
|
||||
|
||||
/** @var \stdClass forum post. */
|
||||
protected $post;
|
||||
|
||||
/** @var \stdClass a fieldset object, false or exception if error not found. */
|
||||
protected $studentrole;
|
||||
|
||||
/** @var \stdClass a fieldset object, false or exception if error not found. */
|
||||
protected $teacherrole;
|
||||
|
||||
/*
|
||||
* Set up for every test
|
||||
*/
|
||||
|
||||
@@ -55,6 +55,8 @@ class report implements renderable, templatable {
|
||||
protected $moduleid;
|
||||
/** @var array $competencies */
|
||||
protected $competencies;
|
||||
/** @var int The user id */
|
||||
protected $userid;
|
||||
|
||||
/**
|
||||
* Construct this renderable.
|
||||
|
||||
@@ -37,6 +37,10 @@ require_once($CFG->libdir . '/tablelib.php');
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class infectedfiles_table extends \table_sql implements \renderable {
|
||||
|
||||
/** @var int current page. */
|
||||
protected $page;
|
||||
|
||||
/**
|
||||
* Table constructor
|
||||
*
|
||||
|
||||
@@ -137,10 +137,6 @@ if (!empty($reportlog->selectedlogreader)) {
|
||||
|
||||
echo $output->reader_selector($reportlog);
|
||||
|
||||
if ($mode === 'all') {
|
||||
$reportlog->selecteddate = 0;
|
||||
}
|
||||
|
||||
// Print the graphic chart accordingly to the mode (all, today).
|
||||
echo '<div class="graph">';
|
||||
report_log_print_graph($course, $user, $mode, 0, $logreader);
|
||||
|
||||
@@ -63,7 +63,6 @@ class lib_test extends \advanced_testcase {
|
||||
|
||||
public function setUp(): void {
|
||||
$this->user = $this->getDataGenerator()->create_user();
|
||||
$this->user2 = $this->getDataGenerator()->create_user();
|
||||
$this->course = $this->getDataGenerator()->create_course();
|
||||
$this->tree = new \core_user\output\myprofile\tree();
|
||||
$this->coursecontext = \context_course::instance($this->course->id);
|
||||
|
||||
@@ -147,7 +147,6 @@ if (!empty($instanceid) && !empty($roleid)) {
|
||||
}
|
||||
|
||||
$table = new flexible_table('course-participation-'.$course->id.'-'.$cm->id.'-'.$roleid);
|
||||
$table->course = $course;
|
||||
|
||||
$actionheader = !empty($action) ? get_string($action) : get_string('allactions');
|
||||
|
||||
|
||||
@@ -32,6 +32,9 @@ defined('MOODLE_INTERNAL') || die();
|
||||
*/
|
||||
class report_progress_helper_testcase extends advanced_testcase {
|
||||
|
||||
/** @var testing_data_generator data generator.*/
|
||||
protected $generator;
|
||||
|
||||
/**
|
||||
* Set up testcase.
|
||||
*/
|
||||
|
||||
@@ -66,6 +66,13 @@ abstract class base {
|
||||
*/
|
||||
protected static $levels = [CONTEXT_SYSTEM];
|
||||
|
||||
/**
|
||||
* An area id from the componentname and the area name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $areaid;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
||||
@@ -54,6 +54,9 @@ abstract class base_activity extends base_mod {
|
||||
*/
|
||||
protected static $levels = [CONTEXT_MODULE];
|
||||
|
||||
/** @var array activity data instance. */
|
||||
public $activitiesdata = [];
|
||||
|
||||
/**
|
||||
* Returns recordset containing all activities within the given context.
|
||||
*
|
||||
|
||||
@@ -42,6 +42,33 @@ require_once($CFG->dirroot . '/search/tests/fixtures/mock_search_area.php');
|
||||
*/
|
||||
class provider_test extends \core_privacy\tests\provider_testcase {
|
||||
|
||||
/** @var \search_simpledb\engine database engine. */
|
||||
protected $engine;
|
||||
|
||||
/** @var \testable_core_search core search class adapted to unit test. */
|
||||
protected $search;
|
||||
|
||||
/** @var \core_search_generator core search generator class adapted to unit test. */
|
||||
protected $generator = null;
|
||||
|
||||
/** @var \stdClass course record.*/
|
||||
protected $c1;
|
||||
|
||||
/** @var \stdClass course record.*/
|
||||
protected $c2;
|
||||
|
||||
/** @var \context_course context instance. */
|
||||
protected $c1context;
|
||||
|
||||
/** @var \context_course context instance. */
|
||||
protected $c2context;
|
||||
|
||||
/** @var \stdClass user record. */
|
||||
protected $u1;
|
||||
|
||||
/** @var \stdClass user record. */
|
||||
protected $u2;
|
||||
|
||||
public function setUp(): void {
|
||||
global $DB;
|
||||
|
||||
|
||||
@@ -40,6 +40,9 @@ class engine extends \core_search\engine {
|
||||
/** @var array Schema updates applied */
|
||||
protected $schemaupdates = [];
|
||||
|
||||
/** @var array delete of course index. */
|
||||
protected $deletes = [];
|
||||
|
||||
public function is_installed() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -74,6 +74,15 @@ class core_tag_tag {
|
||||
/** @var int option to hide standard tags when editing item tags */
|
||||
const HIDE_STANDARD = 2;
|
||||
|
||||
/** @var int|null tag context ID. */
|
||||
public $taginstancecontextid;
|
||||
|
||||
/** @var int|null time modification. */
|
||||
public $timemodified;
|
||||
|
||||
/** @var int|null 0 if not flagged or positive integer if flagged. */
|
||||
public $flag;
|
||||
|
||||
/**
|
||||
* Constructor. Use functions get(), get_by_name(), etc.
|
||||
*
|
||||
@@ -83,6 +92,9 @@ class core_tag_tag {
|
||||
if (empty($record->id)) {
|
||||
throw new coding_exception("Record must contain at least field 'id'");
|
||||
}
|
||||
// The following three variables must be added because the database ($record) does not contain them.
|
||||
$this->taginstancecontextid = $record->taginstancecontextid ?? null;
|
||||
$this->flag = $record->flag ?? null;
|
||||
$this->record = $record;
|
||||
}
|
||||
|
||||
|
||||
@@ -1255,6 +1255,9 @@ abstract class webservice_base_server extends webservice_server {
|
||||
/** @var array List of struct classes generated for the web service methods. */
|
||||
protected $servicestructs;
|
||||
|
||||
/** @var string service class name. */
|
||||
protected $serviceclass;
|
||||
|
||||
/**
|
||||
* This method parses the request input, it needs to get:
|
||||
* 1/ user authentication - username+password or token
|
||||
|
||||
Reference in New Issue
Block a user