-
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
11 changed files
with
53 additions
and
45 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
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
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
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 |
---|---|---|
|
@@ -17,8 +17,6 @@ | |
|
||
namespace report_customsql\external; | ||
|
||
use core_external\external_api; | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
global $CFG; | ||
|
@@ -74,16 +72,16 @@ public function test_get_users_site_config() { | |
$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); | ||
$result = \external_api::clean_returnvalue(get_users::execute_returns(), $result); | ||
|
||
$this->assertEquals([ | ||
[ | ||
'id' => $admin->id, | ||
'fullname' => fullname($admin), | ||
'identity' => '[email protected]', | ||
'hasidentity' => true, | ||
'profileimageurlsmall' => $defaultuserimage, | ||
], | ||
[ | ||
'id' => $admin->id, | ||
'fullname' => fullname($admin), | ||
'identity' => '[email protected]', | ||
'hasidentity' => true, | ||
'profileimageurlsmall' => $defaultuserimage, | ||
], | ||
], $result); | ||
} | ||
|
||
|
@@ -92,23 +90,23 @@ public function test_get_users_site_viewreports() { | |
$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); | ||
$result = \external_api::clean_returnvalue(get_users::execute_returns(), $result); | ||
|
||
$this->assertEquals([ | ||
[ | ||
'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' => $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); | ||
} | ||
|
||
|
@@ -117,7 +115,7 @@ public function test_get_users_customsql_view() { | |
$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); | ||
$result = \external_api::clean_returnvalue(get_users::execute_returns(), $result); | ||
|
||
$this->assertEquals([ | ||
[ | ||
|
@@ -145,11 +143,13 @@ public function test_get_users_customsql_view() { | |
} | ||
|
||
public function test_get_users_serch_without_admins() { | ||
global $OUTPUT; | ||
|
||
[, $manager] = $this->setup_users(); | ||
$defaultuserimage = 'https://www.example.com/moodle/theme/image.php/_s/boost/core/1/u/f2'; | ||
$defaultuserimage = $OUTPUT->image_url('u/f2'); | ||
|
||
$result = get_users::execute('Man', 'report/customsql:view'); | ||
$result = external_api::clean_returnvalue(get_users::execute_returns(), $result); | ||
$result = \external_api::clean_returnvalue(get_users::execute_returns(), $result); | ||
|
||
$this->assertEquals([ | ||
[ | ||
|
@@ -167,16 +167,16 @@ public function test_get_users_serch_with_admin() { | |
$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); | ||
$result = \external_api::clean_returnvalue(get_users::execute_returns(), $result); | ||
|
||
$this->assertEquals([ | ||
[ | ||
'id' => $admin->id, | ||
'fullname' => fullname($admin), | ||
'identity' => '[email protected]', | ||
'hasidentity' => true, | ||
'profileimageurlsmall' => $defaultuserimage, | ||
], | ||
[ | ||
'id' => $admin->id, | ||
'fullname' => fullname($admin), | ||
'identity' => '[email protected]', | ||
'hasidentity' => true, | ||
'profileimageurlsmall' => $defaultuserimage, | ||
], | ||
], $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