From 9975f5e2dcbab0d89803745c7e429b97b9a3e802 Mon Sep 17 00:00:00 2001 From: Sara Arjona Date: Wed, 27 Jan 2021 17:52:55 +0100 Subject: [PATCH] MDL-70725 oauth2: move expectException to separate method --- lib/tests/oauth2_test.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/tests/oauth2_test.php b/lib/tests/oauth2_test.php index 62ce7613755..26fd9e21512 100644 --- a/lib/tests/oauth2_test.php +++ b/lib/tests/oauth2_test.php @@ -44,9 +44,6 @@ class core_oauth2_testcase extends advanced_testcase { \core\oauth2\api::create_standard_issuer('microsoft'); \core\oauth2\api::create_standard_issuer('nextcloud', 'https://dummy.local/nextcloud/'); - $this->expectException(\moodle_exception::class); - \core\oauth2\api::create_standard_issuer('nextcloud'); - $issuers = \core\oauth2\api::get_all_issuers(); $this->assertEquals($issuers[0]->get('name'), 'Google'); @@ -72,6 +69,17 @@ class core_oauth2_testcase extends advanced_testcase { $this->assertEquals($issuers[2]->get('name'), 'Nextcloud'); } + /** + * Tests the crud operations on oauth2 issuers. + */ + public function test_create_nextcloud_without_url() { + $this->resetAfterTest(); + $this->setAdminUser(); + + $this->expectException(\moodle_exception::class); + \core\oauth2\api::create_standard_issuer('nextcloud'); + } + /** * Tests we can list and delete each of the persistents related to an issuer. */