Closed yao9394 closed 3 years ago
This PR is an updated version of https://github.com/catalyst/moodle-auth_outage/pull/218 And for [Totara 13] we also need https://github.com/catalyst/moodle-auth_outage/pull/219 Thanks
looks like we need to change the expectexception stuff to stuff like this too:
$this->expectException(\moodle_exception::class);
not sure if it's backwards compatible though.
HI @danmarsden
Thanks for your feedback. are you referring to the warning like this?
The @expectedException, @expectedExceptionCode, @expectedExceptionMessage, and @expectedExceptionMessageRegExp annotations are deprecated. They will be removed in PHPUnit 9. Refactor your test to use expectException(), expectExceptionCode(), expectExceptionMessage(), or expectExceptionMessageMatches() instead.
I am not seeing anything related to expectException(), I might have missed something, please let me know.
Cheers, John Y
yeah that's it - I had to add this (and remove the phdoc comments)
diff --git a/server/auth/saml2/tests/phpunit/metadata_parser_test.php b/server/auth/saml2/tests/phpunit/metadata_parser_test.php
index e17807931ee..4c8bbbcfba0 100644
--- a/server/auth/saml2/tests/phpunit/metadata_parser_test.php
+++ b/server/auth/saml2/tests/phpunit/metadata_parser_test.php
@@ -48,6 +48,7 @@ class auth_saml2_metadata_parser_testcase extends basic_testcase {
/**
*/
public function test_parse_metadata_fail() {
+ $this->expectException(\moodle_exception::class);
$malformedxml = <<<XML
<EntitiesDescriptor Name="https://your-federation.org/metadata/federation-name.xml"
xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
diff --git a/server/auth/saml2/tests/phpunit/metadata_writer_test.php b/server/auth/saml2/tests/phpunit/metadata_writer_test.php
index 3393d5e02c6..9a7fcd18035 100644
--- a/server/auth/saml2/tests/phpunit/metadata_writer_test.php
+++ b/server/auth/saml2/tests/phpunit/metadata_writer_test.php
@@ -50,6 +50,7 @@ class auth_saml2_metadata_writer_testcase extends basic_testcase {
/**
*/
public function test_write_empty_filename() {
+ $this->expectException(\coding_exception::class);
$filename = '';
$content = 'Test data';
haha - too many windows/patches... it's saml2 :-)
Opened a new branch and created a new pull request combining this and https://github.com/catalyst/moodle-auth_outage/pull/219
Declaration must be compatible with PHPUnit\Framework\TestCase methods