From 9ec87b0e87ffa869b8ed88bc96edac3e3410041b Mon Sep 17 00:00:00 2001 From: Andrew Hancox Date: Mon, 3 Apr 2017 09:32:35 +0100 Subject: [PATCH] Removed dependency on Moodle 31 --- auth.php | 8 ++++---- tests/auth_plugin_test.php | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/auth.php b/auth.php index b4e7008..ae009f3 100644 --- a/auth.php +++ b/auth.php @@ -603,14 +603,14 @@ class auth_plugin_userkey extends auth_plugin_base { $mappingfield = $this->get_mapping_field(); if ($this->should_create_user() || $this->should_update_user()) { - $parameters['firstname'] = new external_value(core_user::get_property_type('firstname'), 'The first name(s) of the user', VALUE_OPTIONAL); - $parameters['lastname'] = new external_value(core_user::get_property_type('lastname'), 'The family name of the user', VALUE_OPTIONAL); + $parameters['firstname'] = new external_value(PARAM_NOTAGS, 'The first name(s) of the user', VALUE_OPTIONAL); + $parameters['lastname'] = new external_value(PARAM_NOTAGS, 'The family name of the user', VALUE_OPTIONAL); if ($mappingfield != 'email') { - $parameters['email'] = new external_value(core_user::get_property_type('email'), 'A valid and unique email address', VALUE_OPTIONAL); + $parameters['email'] = new external_value(PARAM_RAW_TRIMMED, 'A valid and unique email address', VALUE_OPTIONAL); } if ($mappingfield != 'username') { - $parameters['username'] = new external_value(core_user::get_property_type('username'), 'A valid and unique username', VALUE_OPTIONAL); + $parameters['username'] = new external_value(PARAM_USERNAME, 'A valid and unique username', VALUE_OPTIONAL); } } diff --git a/tests/auth_plugin_test.php b/tests/auth_plugin_test.php index e2ab780..ee7db07 100644 --- a/tests/auth_plugin_test.php +++ b/tests/auth_plugin_test.php @@ -599,10 +599,10 @@ class auth_plugin_userkey_testcase extends advanced_testcase { $this->auth = new auth_plugin_userkey(); $expected = array( 'ip' => new external_value(PARAM_HOST, 'User IP address'), - 'firstname' => new external_value(core_user::get_property_type('firstname'), 'The first name(s) of the user', VALUE_OPTIONAL), - 'lastname' => new external_value(core_user::get_property_type('lastname'), 'The family name of the user', VALUE_OPTIONAL), - 'email' => new external_value(core_user::get_property_type('email'), 'A valid and unique email address', VALUE_OPTIONAL), - 'username' => new external_value(core_user::get_property_type('username'), 'A valid and unique username', VALUE_OPTIONAL), + 'firstname' => new external_value(PARAM_NOTAGS, 'The first name(s) of the user', VALUE_OPTIONAL), + 'lastname' => new external_value(PARAM_NOTAGS, 'The family name of the user', VALUE_OPTIONAL), + 'email' => new external_value(PARAM_RAW_TRIMMED, 'A valid and unique email address', VALUE_OPTIONAL), + 'username' => new external_value(PARAM_USERNAME, 'A valid and unique username', VALUE_OPTIONAL), ); $actual = $this->auth->get_request_login_url_user_parameters(); $this->assertEquals($expected, $actual); @@ -613,10 +613,10 @@ class auth_plugin_userkey_testcase extends advanced_testcase { $this->auth = new auth_plugin_userkey(); $expected = array( 'ip' => new external_value(PARAM_HOST, 'User IP address'), - 'firstname' => new external_value(core_user::get_property_type('firstname'), 'The first name(s) of the user', VALUE_OPTIONAL), - 'lastname' => new external_value(core_user::get_property_type('lastname'), 'The family name of the user', VALUE_OPTIONAL), - 'email' => new external_value(core_user::get_property_type('email'), 'A valid and unique email address', VALUE_OPTIONAL), - 'username' => new external_value(core_user::get_property_type('username'), 'A valid and unique username', VALUE_OPTIONAL), + 'firstname' => new external_value(PARAM_NOTAGS, 'The first name(s) of the user', VALUE_OPTIONAL), + 'lastname' => new external_value(PARAM_NOTAGS, 'The family name of the user', VALUE_OPTIONAL), + 'email' => new external_value(PARAM_RAW_TRIMMED, 'A valid and unique email address', VALUE_OPTIONAL), + 'username' => new external_value(PARAM_USERNAME, 'A valid and unique username', VALUE_OPTIONAL), ); $actual = $this->auth->get_request_login_url_user_parameters(); $this->assertEquals($expected, $actual);