Skip to content

Commit 0586b4e

Browse files
authored
Merge pull request #874 from SashaAnastasi/TOTARA_19-t19_fixes
[T19] Fixes for totara19
2 parents a04ae0a + 34a395d commit 0586b4e

13 files changed

+23
-23
lines changed

tests/auth_test.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
1616

17-
namespace auth_saml2;
18-
1917
/**
2018
* Unit tests for auth class.
2119
*
@@ -27,7 +25,7 @@
2725
* @copyright 2021 Moodle Pty Ltd <support@moodle.com>
2826
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2927
*/
30-
class auth_saml2_test extends \core_phpunit\testcase {
28+
class auth_saml2_auth_test extends \core_phpunit\testcase {
3129
/**
3230
* Set up
3331
*/
@@ -100,7 +98,7 @@ protected function get_mocked_auth(): \auth_saml2\auth {
10098
// exception message. This is needed to check $msg argument and stop
10199
// execution like original method does.
102100
$auth = $this->getMockBuilder(\auth_saml2\auth::class)
103-
->setMethods(['error_page'])->getMock();
101+
->onlyMethods(['error_page'])->getMock();
104102

105103
$auth->expects($this->once())
106104
->method('error_page')
@@ -800,7 +798,7 @@ public function test_should_login_redirect($cfg, $config, $param, $multiidp, $se
800798
*
801799
* @return array of testcases
802800
*/
803-
public function provider_should_login_redirect(): array {
801+
public static function provider_should_login_redirect(): array {
804802
$midp = (new \moodle_url('/auth/saml2/selectidp.php'))->out();
805803
return [
806804
// Login normal, dual login on.
@@ -967,7 +965,7 @@ public function test_check_whitelisted_ip_redirect($saml, $remoteip, $whitelist,
967965
*
968966
* @return array
969967
*/
970-
public function provider_check_whitelisted_ip_redirect(): array {
968+
public static function provider_check_whitelisted_ip_redirect(): array {
971969
return [
972970
'saml off, no ip, no redirect' => ['off', '1.2.3.4', '', false],
973971
'saml not specified, junk, no redirect' => [null, '1.2.3.4', 'qwer1234!@#qwer', false],
@@ -982,7 +980,7 @@ public function provider_check_whitelisted_ip_redirect(): array {
982980
*
983981
* @return array
984982
*/
985-
public function provider_is_access_allowed(): array {
983+
public static function provider_is_access_allowed(): array {
986984
return [
987985
'' => [[
988986
['uid' => 'test'], // User don't have groups attribute.
@@ -1206,7 +1204,7 @@ public function test_update_custom_user_profile_fields($attributes): void {
12061204
*
12071205
* @return array of testcases
12081206
*/
1209-
public function provider_update_custom_user_profile_fields(): array {
1207+
public static function provider_update_custom_user_profile_fields(): array {
12101208
return [
12111209
[['testfield' => ['Test data']]],
12121210
[['secondfield' => ['A different string']]],
@@ -1253,7 +1251,7 @@ public function test_missing_user_custom_profile_fields($attributes): void {
12531251
*
12541252
* @return array of testcases
12551253
*/
1256-
public function provider_missing_user_custom_profile_fields(): array {
1254+
public static function provider_missing_user_custom_profile_fields(): array {
12571255
return array(
12581256
array(['missingfield' => array('Test data')]),
12591257
array(['secondfield' => array('A different string')]),
@@ -1292,7 +1290,7 @@ public function test_invalid_map_user_profile_fields($mapping, $attributes): voi
12921290
*
12931291
* @return array of testcases
12941292
*/
1295-
public function provider_invalid_map_user_profile_fields(): array {
1293+
public static function provider_invalid_map_user_profile_fields(): array {
12961294
return [
12971295
[
12981296
['field' => 'userame', 'mapping' => 'invalid'],

tests/form_regenerate_test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
* @package auth_saml2
3131
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3232
*/
33-
class auth_saml2_form_regenerate_testcase extends \core_phpunit\testcase {
33+
class auth_saml2_form_regenerate_test extends \core_phpunit\testcase {
3434
public function test_regenerate_certificate_form() {
3535
global $CFG, $DB, $USER;
3636
$this->resetAfterTest();

tests/generator_test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* @copyright 2021 Moodle Pty Ltd <support@moodle.com>
2727
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2828
*/
29-
class generator_testcase extends \core_phpunit\testcase {
29+
class generator_test extends \core_phpunit\testcase {
3030
/**
3131
* Set up
3232
*/

tests/group_rule_test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
* @copyright Catalyst IT
3131
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3232
*/
33-
class auth_saml2_group_rule_test_testcase extends \core_phpunit\testcase {
33+
class auth_saml2_group_rule_test extends \core_phpunit\testcase {
3434

3535
/**
3636
* Test we can get list of rules from config string.

tests/locallib_test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* @copyright Brendan Heywood <brendan@catalyst-au.net>
3535
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3636
*/
37-
class auth_saml2_locallib_testcase extends \core_phpunit\testcase {
37+
class auth_saml2_locallib_test extends \core_phpunit\testcase {
3838
/**
3939
* Regression test for Issue 132.
4040
*/

tests/metadata_fetcher_test.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* @copyright Copyright (c) 2017 Blackboard Inc. (http://www.blackboard.com)
3232
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3333
*/
34-
class auth_saml2_metadata_fetcher_testcase extends \core_phpunit\testcase {
34+
class auth_saml2_metadata_fetcher_test extends \core_phpunit\testcase {
3535

3636
/** @var \Prophecy\Prophet */
3737
protected $prophet;
@@ -50,6 +50,7 @@ public function setUp(): void {
5050
*/
5151
protected function tearDown(): void {
5252
$this->prophet = null; // Required for Totara 12+ support (see issue #578).
53+
parent::tearDown();
5354
}
5455

5556
public function test_fetch_metadata_404() {

tests/metadata_parser_test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* @copyright Copyright (c) 2017 Blackboard Inc. (http://www.blackboard.com)
3232
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3333
*/
34-
class auth_saml2_metadata_parser_testcase extends \core_phpunit\testcase {
34+
class auth_saml2_metadata_parser_test extends \core_phpunit\testcase {
3535

3636
public function test_parse_metadata() {
3737
$xml = file_get_contents(__DIR__ . '/fixtures/metadata.xml');

tests/metadata_refresh_test.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
* @copyright Copyright (c) 2017 Blackboard Inc. (http://www.blackboard.com)
3333
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3434
*/
35-
class auth_saml2_metadata_refresh_testcase extends \core_phpunit\testcase {
35+
class auth_saml2_metadata_refresh_test extends \core_phpunit\testcase {
3636

3737
/** @var \Prophecy\Prophet */
3838
protected $prophet;
@@ -52,6 +52,7 @@ public function setUp(): void {
5252
*/
5353
protected function tearDown(): void {
5454
$this->prophet = null; // Required for Totara 12+ support (see issue #578).
55+
parent::tearDown();
5556
}
5657

5758
public function test_metadata_refresh_disabled() {

tests/metadata_writer_test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* @copyright Copyright (c) 2017 Blackboard Inc. (http://www.blackboard.com)
3232
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3333
*/
34-
class auth_saml2_metadata_writer_testcase extends \core_phpunit\testcase {
34+
class auth_saml2_metadata_writer_test extends \core_phpunit\testcase {
3535

3636
public function test_write_default_path() {
3737
global $CFG;

tests/redis_store_test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* @copyright Copyright (c) 2017 Blackboard Inc. (http://www.blackboard.com)
3232
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3333
*/
34-
class auth_saml2_redis_store_testcase extends \core_phpunit\testcase {
34+
class auth_saml2_redis_store_test extends \core_phpunit\testcase {
3535

3636
/**
3737
* @var null|\Redis

0 commit comments

Comments
 (0)