From 486ecb1b897cf14cf7e713e1dc3f44f766bcbabc Mon Sep 17 00:00:00 2001 From: Simey Lameze Date: Tue, 14 Nov 2017 11:26:33 +0800 Subject: [PATCH] MDL-60637 core_group: fix unit tests failures --- group/tests/externallib_test.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/group/tests/externallib_test.php b/group/tests/externallib_test.php index dcbb0ef2742..fff4079f1e7 100644 --- a/group/tests/externallib_test.php +++ b/group/tests/externallib_test.php @@ -106,9 +106,8 @@ class core_group_externallib_testcase extends externallib_advanced_testcase { $froups = core_group_external::create_groups(array($group3)); $this->fail('Exception expected due to already existing idnumber.'); } catch (moodle_exception $e) { - $this->assertInstanceOf('invalid_parameter_exception', $e); - $this->assertEquals('Invalid parameter value detected (Group with the same idnumber already exists)', - $e->getMessage()); + $this->assertInstanceOf('moodle_exception', $e); + $this->assertEquals(get_string('idnumbertaken', 'error'), $e->getMessage()); } // Call without required capability @@ -258,9 +257,8 @@ class core_group_externallib_testcase extends externallib_advanced_testcase { $groupings = core_group_external::create_groupings(array($grouping1data)); $this->fail('Exception expected due to already existing idnumber.'); } catch (moodle_exception $e) { - $this->assertInstanceOf('invalid_parameter_exception', $e); - $this->assertEquals('Invalid parameter value detected (Grouping with the same idnumber already exists)', - $e->getMessage()); + $this->assertInstanceOf('moodle_exception', $e); + $this->assertEquals(get_string('idnumbertaken', 'error'), $e->getMessage()); } // No exception should be triggered. @@ -285,9 +283,8 @@ class core_group_externallib_testcase extends externallib_advanced_testcase { $groupings = core_group_external::update_groupings(array($grouping2data)); $this->fail('Exception expected due to already existing idnumber.'); } catch (moodle_exception $e) { - $this->assertInstanceOf('invalid_parameter_exception', $e); - $this->assertEquals('Invalid parameter value detected (A different grouping with the same idnumber already exists)', - $e->getMessage()); + $this->assertInstanceOf('moodle_exception', $e); + $this->assertEquals(get_string('idnumbertaken', 'error'), $e->getMessage()); } }