-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
66 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,9 +67,11 @@ protected function setup_users(): array { | |
return [$admin, $manager, $coursecreateor]; | ||
} | ||
|
||
public function test_get_users_site_config() { | ||
public function test_get_users_site_config(): void { | ||
global $OUTPUT; | ||
$defaultuserimage = $OUTPUT->image_url('u/f2'); | ||
|
||
[$admin] = $this->setup_users(); | ||
$defaultuserimage = 'https://www.example.com/moodle/theme/image.php/_s/boost/core/1/u/f2'; | ||
|
||
$result = get_users::execute('', 'moodle/site:config'); | ||
$result = \external_api::clean_returnvalue(get_users::execute_returns(), $result); | ||
|
@@ -85,9 +87,11 @@ public function test_get_users_site_config() { | |
], $result); | ||
} | ||
|
||
public function test_get_users_site_viewreports() { | ||
public function test_get_users_site_viewreports(): void { | ||
global $OUTPUT; | ||
$defaultuserimage = $OUTPUT->image_url('u/f2'); | ||
|
||
[$admin, $manager] = $this->setup_users(); | ||
$defaultuserimage = 'https://www.example.com/moodle/theme/image.php/_s/boost/core/1/u/f2'; | ||
|
||
$result = get_users::execute('', 'moodle/site:viewreports'); | ||
$result = \external_api::clean_returnvalue(get_users::execute_returns(), $result); | ||
|
@@ -110,43 +114,47 @@ public function test_get_users_site_viewreports() { | |
], $result); | ||
} | ||
|
||
public function test_get_users_customsql_view() { | ||
public function test_get_users_customsql_view(): void { | ||
global $OUTPUT; | ||
$defaultuserimage = $OUTPUT->image_url('u/f2'); | ||
|
||
[$admin, $manager, $coursecreateor] = $this->setup_users(); | ||
$defaultuserimage = 'https://www.example.com/moodle/theme/image.php/_s/boost/core/1/u/f2'; | ||
|
||
$result = get_users::execute('', 'report/customsql:view'); | ||
$result = \external_api::clean_returnvalue(get_users::execute_returns(), $result); | ||
|
||
$this->assertEquals([ | ||
[ | ||
'id' => $coursecreateor->id, | ||
'fullname' => fullname($coursecreateor), | ||
'identity' => '[email protected]', | ||
'hasidentity' => true, | ||
'profileimageurlsmall' => $defaultuserimage, | ||
], | ||
[ | ||
'id' => $manager->id, | ||
'fullname' => fullname($manager), | ||
'identity' => '[email protected]', | ||
'hasidentity' => true, | ||
'profileimageurlsmall' => $defaultuserimage, | ||
], | ||
[ | ||
'id' => $admin->id, | ||
'fullname' => fullname($admin), | ||
'identity' => '[email protected]', | ||
'hasidentity' => true, | ||
'profileimageurlsmall' => $defaultuserimage, | ||
], | ||
[ | ||
'id' => $coursecreateor->id, | ||
'fullname' => fullname($coursecreateor), | ||
'identity' => '[email protected]', | ||
'hasidentity' => true, | ||
'profileimageurlsmall' => $defaultuserimage, | ||
], | ||
[ | ||
'id' => $manager->id, | ||
'fullname' => fullname($manager), | ||
'identity' => '[email protected]', | ||
'hasidentity' => true, | ||
'profileimageurlsmall' => $defaultuserimage, | ||
], | ||
[ | ||
'id' => $admin->id, | ||
'fullname' => fullname($admin), | ||
'identity' => '[email protected]', | ||
'hasidentity' => true, | ||
'profileimageurlsmall' => $defaultuserimage, | ||
], | ||
], $result); | ||
} | ||
|
||
public function test_get_users_serch_without_admins() { | ||
public function test_get_users_serch_without_admins(): void { | ||
global $OUTPUT; | ||
$defaultuserimage = $OUTPUT->image_url('u/f2'); | ||
|
||
global $OUTPUT; | ||
|
||
[, $manager] = $this->setup_users(); | ||
$defaultuserimage = $OUTPUT->image_url('u/f2'); | ||
|
||
$result = get_users::execute('Man', 'report/customsql:view'); | ||
$result = \external_api::clean_returnvalue(get_users::execute_returns(), $result); | ||
|
@@ -162,9 +170,11 @@ public function test_get_users_serch_without_admins() { | |
], $result); | ||
} | ||
|
||
public function test_get_users_serch_with_admin() { | ||
public function test_get_users_serch_with_admin(): void { | ||
global $OUTPUT; | ||
$defaultuserimage = $OUTPUT->image_url('u/f2'); | ||
|
||
[$admin] = $this->setup_users(); | ||
$defaultuserimage = 'https://www.example.com/moodle/theme/image.php/_s/boost/core/1/u/f2'; | ||
|
||
$result = get_users::execute('n U', 'report/customsql:view'); | ||
$result = \external_api::clean_returnvalue(get_users::execute_returns(), $result); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters