MDL-45242 Lib: Replace calls to deprecated functions

In all cases changes have been kept to a minimum while not making
the code completely horrible. For example, there are many instances
where it would probably be better to rewrite a query entirely, but
I have not done that (in order to reduce the risk of changes).
This commit is contained in:
sam marshall
2021-03-10 10:57:10 +00:00
parent 3f003455f3
commit 558cc1b85e
152 changed files with 612 additions and 394 deletions
+16 -2
View File
@@ -33,6 +33,11 @@ require_once($CFG->libdir . '/outputcomponents.php');
*/
class core_outputcomponents_testcase extends advanced_testcase {
/**
* Tests user_picture::fields.
*
* @deprecated since Moodle 3.11 MDL-45242
*/
public function test_fields_aliasing() {
$fields = user_picture::fields();
$fields = array_map('trim', explode(',', $fields));
@@ -60,10 +65,16 @@ class core_outputcomponents_testcase extends advanced_testcase {
$this->assertContains($expected, $returned, "Expected pattern '$expected' not returned");
}
$this->assertContains("custom1 AS prefixcustom1", $returned, "Expected pattern 'custom1 AS prefixcustom1' not returned");
// Deprecation warnings for user_picture::fields.
$this->assertDebuggingCalledCount(2);
}
/**
* Tests user_picture::unalias.
*/
public function test_fields_unaliasing() {
$fields = user_picture::fields();
$fields = implode(',', \core\user_fields::get_picture_fields());
$fields = array_map('trim', explode(',', $fields));
$fakerecord = new stdClass();
@@ -86,8 +97,11 @@ class core_outputcomponents_testcase extends advanced_testcase {
$this->assertSame('Value of custom1', $returned->custom1);
}
/**
* Tests user_picture::unalias with null values.
*/
public function test_fields_unaliasing_null() {
$fields = user_picture::fields();
$fields = implode(',', \core\user_fields::get_picture_fields());
$fields = array_map('trim', explode(',', $fields));
$fakerecord = new stdClass();