diff options
author | Valentin Popov <info@valentineus.link> | 2018-06-07 10:20:26 +0300 |
---|---|---|
committer | Valentin Popov <info@valentineus.link> | 2018-06-07 10:20:26 +0300 |
commit | a517252897fb880186073085a6b4763d5c275771 (patch) | |
tree | 34745e233fdc90f5358c0aaec6aad8ae42af7c2d | |
parent | fc6e5bd8a8230ae1a8c27c093c7b5339bd4fa49c (diff) | |
download | tool_apisiteadmins-a517252897fb880186073085a6b4763d5c275771.tar.xz tool_apisiteadmins-a517252897fb880186073085a6b4763d5c275771.zip |
Small qualitative changes
Signed-off-by: Valentin Popov <info@valentineus.link>
-rw-r--r-- | tests/api_test.php | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/tests/api_test.php b/tests/api_test.php index c435e71..a0c6fef 100644 --- a/tests/api_test.php +++ b/tests/api_test.php @@ -24,11 +24,14 @@ defined("MOODLE_INTERNAL") || die(); +global $CFG; + require_once(__DIR__ . "/../lib.php"); /** * Test 'tool_apisiteadmins' class. * + * @category phpunit * @group tool_apisiteadmins * @copyright 2018 "Valentin Popov" <info@valentineus.link> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later @@ -36,8 +39,6 @@ require_once(__DIR__ . "/../lib.php"); */ class tool_apisiteadmins_api_testcase extends advanced_testcase { public function test_adding_and_deleting_administrator() { - global $CFG; - $this->resetAfterTest(true); $user = $this->getDataGenerator()->create_user(); @@ -67,8 +68,6 @@ class tool_apisiteadmins_api_testcase extends advanced_testcase { * @depends test_adding_and_deleting_administrator */ public function test_changing_main_administrator() { - global $CFG; - $this->resetAfterTest(true); $user1 = $this->getDataGenerator()->create_user(); @@ -79,15 +78,14 @@ class tool_apisiteadmins_api_testcase extends advanced_testcase { tool_apisiteadmins::add_user($user2->id); $this->assertArrayHasKey($user1->id, get_admins()); $this->assertArrayHasKey($user2->id, get_admins()); + $this->assertCount(3, get_admins()); /* Sets first user main */ tool_apisiteadmins::set_main($user1->id); - $this->assertCount(3, get_admins()); $this->assertEquals($user1, get_admin()); /* Sets second user main */ tool_apisiteadmins::set_main($user2->id); - $this->assertCount(3, get_admins()); $this->assertEquals($user2, get_admin()); } @@ -95,8 +93,6 @@ class tool_apisiteadmins_api_testcase extends advanced_testcase { * @depends test_adding_and_deleting_administrator */ public function test_deleting_all_administrators() { - global $CFG; - $this->resetAfterTest(true); $this->assertCount(1, get_admins()); @@ -112,8 +108,6 @@ class tool_apisiteadmins_api_testcase extends advanced_testcase { * @depends test_adding_and_deleting_administrator */ public function test_exception_adding_check() { - global $CFG; - $this->expectException(moodle_exception::class); $this->resetAfterTest(true); @@ -127,8 +121,6 @@ class tool_apisiteadmins_api_testcase extends advanced_testcase { * @depends test_adding_and_deleting_administrator */ public function test_exception_removal_check() { - global $CFG; - $this->expectException(moodle_exception::class); $this->resetAfterTest(true); |