From 9bb156ee7561af83e1438cd39911083a2cee46ac Mon Sep 17 00:00:00 2001 From: Rajesh Taneja Date: Thu, 2 Feb 2017 14:16:52 +0800 Subject: [PATCH] MDL-57853 phpunit: Remove use of setExpectedException --- admin/tool/usertours/tests/manager_test.php | 2 +- enrol/lti/tests/helper_test.php | 2 +- message/output/popup/tests/externallib_test.php | 8 ++++---- user/tests/externallib_test.php | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/admin/tool/usertours/tests/manager_test.php b/admin/tool/usertours/tests/manager_test.php index 321ff065051..bffecb32f7c 100644 --- a/admin/tool/usertours/tests/manager_test.php +++ b/admin/tool/usertours/tests/manager_test.php @@ -118,7 +118,7 @@ class tool_usertours_manager_testcase extends advanced_testcase { $rcm = $rc->getMethod($function); $rcm->setAccessible(true); - $this->setExpectedException('moodle_exception', 'A required parameter (sesskey) was missing'); + $this->expectException('moodle_exception'); $rcm->invokeArgs($manager, $arguments); } diff --git a/enrol/lti/tests/helper_test.php b/enrol/lti/tests/helper_test.php index 6583665f262..09c58042694 100644 --- a/enrol/lti/tests/helper_test.php +++ b/enrol/lti/tests/helper_test.php @@ -516,7 +516,7 @@ class enrol_lti_helper_testcase extends advanced_testcase { $document->load(realpath(__DIR__ . '/fixtures/input.xml')); $xpath = new \DOMXpath($document); - $this->setExpectedException("coding_exception"); + $this->expectException('coding_exception'); $function->invokeArgs(null, [$xpath, $parameters]); } diff --git a/message/output/popup/tests/externallib_test.php b/message/output/popup/tests/externallib_test.php index 137573bb85f..a8ca638bf5a 100644 --- a/message/output/popup/tests/externallib_test.php +++ b/message/output/popup/tests/externallib_test.php @@ -57,7 +57,7 @@ class message_popup_externallib_testcase extends advanced_testcase { public function test_get_popup_notifications_no_user_exception() { $this->resetAfterTest(true); - $this->setExpectedException('moodle_exception'); + $this->expectException('moodle_exception'); $result = message_popup_external::get_popup_notifications(-2132131, false, 0, 0); } @@ -72,7 +72,7 @@ class message_popup_externallib_testcase extends advanced_testcase { $user = $this->getDataGenerator()->create_user(); $this->setUser($user); - $this->setExpectedException('moodle_exception'); + $this->expectException('moodle_exception'); $result = message_popup_external::get_popup_notifications($sender->id, false, 0, 0); } @@ -141,7 +141,7 @@ class message_popup_externallib_testcase extends advanced_testcase { public function test_get_unread_popup_notification_count_invalid_user_exception() { $this->resetAfterTest(true); - $this->setExpectedException('moodle_exception'); + $this->expectException('moodle_exception'); $result = message_popup_external::get_unread_popup_notification_count(-2132131, 0); } @@ -156,7 +156,7 @@ class message_popup_externallib_testcase extends advanced_testcase { $user = $this->getDataGenerator()->create_user(); $this->setUser($user); - $this->setExpectedException('moodle_exception'); + $this->expectException('moodle_exception'); $result = message_popup_external::get_unread_popup_notification_count($sender->id, 0); } diff --git a/user/tests/externallib_test.php b/user/tests/externallib_test.php index d7345e716d9..16405ae184e 100644 --- a/user/tests/externallib_test.php +++ b/user/tests/externallib_test.php @@ -868,7 +868,7 @@ class core_user_externallib_testcase extends externallib_advanced_testcase { $anotheruser = self::getDataGenerator()->create_user(); $this->setUser($anotheruser); - $this->setExpectedException('required_capability_exception'); + $this->expectException('required_capability_exception'); $result = core_user_external::get_user_preferences('', $user->id); } -- 2.11.4.GIT