Compare commits

..

103 Commits

Author SHA1 Message Date
Huong Nguyen 3d7496dacd Moodle release 4.1.15 2024-12-06 13:12:41 +07:00
Huong Nguyen 253eece808 weekly release 4.1.14+ 2024-12-05 22:33:11 +07:00
Huong Nguyen 65e7470b92 MDL-83921 competency: Update unit tests with latest changes 2024-12-05 18:42:42 +08:00
Huong Nguyen bd115c5e1a MDL-82379 core_user: Move email change token to user private access key 2024-12-05 13:38:54 +08:00
Huong Nguyen 3b680fa554 MDL-83921 competency: Bump version 2024-12-05 11:22:32 +07:00
Michael Hawkins 0b0f121e89 MDL-83921 competency: Match web service capability check with page check 2024-12-05 11:22:25 +07:00
Huong Nguyen 7c98470586 MDL-82963 Tag: Improve validation for users tagged with sepecified tag 2024-12-05 11:03:37 +08:00
Laurent David 6807076172 MDL-82757 mod_data: Improve group access handling
* Improved handling of group access to ensure correct visibility of records.
2024-12-04 02:50:19 +00:00
Jun Pataleta b34c006bfd MDL-61316 core: Fix session gc unit tests 2024-12-04 02:50:19 +00:00
meirzamoodle 9555192935 MDL-61316 core: Removed 5x multiplier from guest session expiration 2024-12-04 02:50:19 +00:00
Huong Nguyen e25bcf9ede Merge branch 'MDL-82946-401' of https://github.com/lameze/moodle into MOODLE_401_STABLE 2024-12-04 09:40:19 +07:00
Angelia Dela Cruz 311adf5f6f MDL-82946 qbank: Behat coverage for questions bulk actions 2024-12-03 10:44:28 +08:00
Sara Arjona 6fb1e19c1e weekly release 4.1.14+ 2024-11-29 12:37:13 +01:00
Jun Pataleta 585780a182 MDL-83470 environment: Put back Oracle support for now
Even though Oracle support is planned to be dropped for 5.0, the
actual issue that drops it (MDL-83172) has not yet landed. So, it's
better to keep this in environment.xml for now and defer its removal
from environment.xml in MDL-83172.
2024-11-28 16:06:46 +07:00
Huong Nguyen 52ce316caa Merge branch 'MDL-83470-401' of https://github.com/junpataleta/moodle into MOODLE_401_STABLE 2024-11-28 11:04:39 +07:00
Huong Nguyen bb31fe88fb Merge branch 'MDL-83643-401' of https://github.com/lameze/moodle into MOODLE_401_STABLE 2024-11-28 09:22:37 +07:00
Andrew Nicols 4fdafd4263 MDL-83788 mod_glossary: Correct assertions for assertArrayHasKey 2024-11-27 13:26:01 +11:00
Jun Pataleta 6374ec5013 weekly release 4.1.14+ 2024-11-22 22:27:13 +08:00
Jun Pataleta 329357ccff MDL-83470 core: Define environment requirements for Moodle 5.0 2024-11-21 17:35:43 +08:00
Andrew Nicols 2d69b8442e Merge branch 'MDL-83551-401' of https://github.com/lameze/moodle into MOODLE_401_STABLE 2024-11-21 12:27:21 +08:00
Jun Pataleta 953d1b8254 Merge branch 'MDL-81521-401' of https://github.com/andrewnicols/moodle into MOODLE_401_STABLE 2024-11-19 15:15:36 +08:00
Huong Nguyen 693115bebb Merge branch 'MDL-83610-401' of https://github.com/marinaglancy/moodle into MOODLE_401_STABLE 2024-11-19 09:29:29 +07:00
Andrew Nicols 76d24aed1e MDL-81521 mod_quiz: Fix attempt walkthrough tests 2024-11-19 09:30:51 +08:00
Andrew Nicols 3d51aed3e2 MDL-81521 core: Update all possibly data providers to be static
Note: Some data providers could not be automatically be converted to
being static. These will be handled in a separate issue.
2024-11-19 09:30:51 +08:00
Marina Glancy 7a16d88a4e MDL-83610 behat: allow to set date fields in groups 2024-11-18 10:37:43 +00:00
Huong Nguyen eaa25cf51b weekly release 4.1.14+ 2024-11-15 09:21:49 +07:00
Jun Pataleta 249bc5b8f9 Merge branch 'MDL-80926-401' of https://github.com/lameze/moodle into MOODLE_401_STABLE 2024-11-14 12:05:28 +08:00
Huong Nguyen c519d282f4 Merge branch 'MDL-80689_401' of https://github.com/timhunt/moodle into MOODLE_401_STABLE 2024-11-13 14:01:34 +07:00
Simey Lameze 660bdcc5ec MDL-83643 behat: make manual completion scenario names unique 2024-11-13 07:19:22 +08:00
Simey Lameze 3e906fea06 MDL-83551 behat: make duplicated scenario names unique 2024-11-13 07:03:02 +08:00
Huong Nguyen 6f07919b5f weekly release 4.1.14+ 2024-11-08 13:56:59 +07:00
Huong Nguyen 89e9b922aa Merge branch 'MDL-83619-401' of https://github.com/lameze/moodle into MOODLE_401_STABLE 2024-11-07 11:06:21 +07:00
Huong Nguyen 3087133bb6 Merge branch 'MDL-83611-401' of https://github.com/lameze/moodle into MOODLE_401_STABLE 2024-11-07 11:03:09 +07:00
Simey Lameze 364460d796 MDL-80926 behat: fix random and improve h5p completion test 2024-11-06 13:37:19 +08:00
Simey Lameze 7cde7d004f MDL-83611 behat: increase window size to avoid randoms 2024-11-05 13:21:41 +08:00
Simey Lameze 644b843a94 MDL-83619 behat: enable bbb module early in the test 2024-11-05 10:23:51 +08:00
Huong Nguyen ddade6e964 weekly release 4.1.14+ 2024-11-01 14:29:39 +07:00
Huong Nguyen 672602d1e7 Merge branch 'install_401_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_401_STABLE 2024-11-01 14:29:37 +07:00
Huong Nguyen 60a0d854ba Merge branch 'MDL-82911-401-fix' of https://github.com/lameze/moodle into MOODLE_401_STABLE 2024-10-31 14:15:21 +07:00
Simey Lameze 925c451f1a MDL-82911 behat: change future times example to minutes 2024-10-31 14:16:01 +08:00
Huong Nguyen dc92cc0e20 Merge branch 'MDL-82911-401' of https://github.com/andelacruz/moodle into MOODLE_401_STABLE 2024-10-31 11:04:10 +07:00
Huong Nguyen 3c8b723fdb Merge branch 'MDL-83414-401' of https://github.com/lameze/moodle into MOODLE_401_STABLE 2024-10-31 10:39:17 +07:00
Angelia Dela Cruz 24d86db351 MDL-83414 core_grades: Behat to test custom scale display 2024-10-31 10:10:19 +08:00
Tim Hunt 68b4f0ea52 MDL-80689 behat: add a transformation to get dirroot
Also, back-port #wwwroot# from MDL-78619 which was not backported at the time.
2024-10-30 14:05:01 +00:00
Angelia Dela Cruz 319efddb99 MDL-82911 mod_bigbluebuttonbn: Behat for BBB open and close date time 2024-10-29 12:48:50 +08:00
AMOS bot b0496fb383 Automatically generated installer lang files 2024-10-29 00:07:37 +00:00
Shamim Rezaie a6117d4b44 weekly release 4.1.14+ 2024-10-18 23:29:10 +11:00
Shamim Rezaie f7d43b77b1 Merge branch 'install_401_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_401_STABLE 2024-10-18 23:29:09 +11:00
Jun Pataleta cae79de01c Merge branch 'MDL-83002-401' of https://github.com/marinaglancy/moodle into MOODLE_401_STABLE 2024-10-16 20:32:41 +08:00
AMOS bot 8ce983c55b Automatically generated installer lang files 2024-10-15 00:09:20 +00:00
AMOS bot 84d15d73a5 Automatically generated installer lang files 2024-10-13 00:07:42 +00:00
Jake Dallimore c783413759 weekly release 4.1.14+ 2024-10-11 10:55:14 +08:00
Jake Dallimore e3c328c91f Merge branch 'install_401_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_401_STABLE 2024-10-11 10:55:13 +08:00
Jun Pataleta 8b772d1436 Merge branch 'MDL-82912-401' of https://github.com/andelacruz/moodle into MOODLE_401_STABLE 2024-10-10 10:35:16 +08:00
Angelia Dela Cruz a29d0ee99c MDL-82912 mod_workshop: Behat to view assessment after workshop close 2024-10-09 17:23:28 +08:00
Huong Nguyen fd5ddee7ed Merge branch 'MDL-83331_401' of https://github.com/timhunt/moodle into MOODLE_401_STABLE 2024-10-09 14:47:46 +07:00
AMOS bot ba88242f5f Automatically generated installer lang files 2024-10-09 00:09:14 +00:00
AMOS bot 0c9999bd22 Automatically generated installer lang files 2024-10-08 00:07:36 +00:00
Tim Hunt 29dc0bb3f6 MDL-83331 behat: enable navigation direct to mod/.../index.php 2024-10-07 12:06:07 +01:00
Jun Pataleta d56aa41e9e Moodle release 4.1.14 2024-10-05 14:46:30 +08:00
AMOS bot 5778558dae Automatically generated installer lang files 2024-10-05 00:07:35 +00:00
Huong Nguyen b7bf868042 weekly release 4.1.13+ 2024-10-04 20:48:25 +07:00
Huong Nguyen 06c20c4675 Merge branch 'install_401_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_401_STABLE 2024-10-04 20:48:23 +07:00
AMOS bot f30a2bb18e Automatically generated installer lang files 2024-10-04 00:07:34 +00:00
Marina Glancy 5733851176 MDL-83002 theme_boost: tell behat to wait when initialising drawers 2024-10-03 16:02:13 +01:00
Michael Hawkins 92a2dcc96a MDL-83352 message: Update usercantbemessaged string 2024-10-03 17:48:46 +07:00
Shamim Rezaie 3a694fd6bf Merge branch 'MDL-83332-401' of https://github.com/meirzamoodle/moodle into MOODLE_401_STABLE 2024-10-03 02:25:33 +10:00
Paul Holden bb6a65da42 MDL-83180 reportbuilder: correct access check for viewing schedules. 2024-10-02 16:50:08 +08:00
meirzamoodle a11ffea697 MDL-83332 environment: Reverts the slashargument removal on MDL-62640
We are encountering Behat failures on MacOS and possibly Windows.

This reverts commit 3202109780.
2024-10-02 13:32:43 +07:00
Paul Holden 90d7307872 MDL-83181 reportbuilder: ensure audience correctness before delete. 2024-09-30 15:34:03 +07:00
Paul Holden 453dfc4f94 MDL-82386 block_rss_client: user access checks for feed edit/delete. 2024-09-27 11:50:19 +00:00
Huong Nguyen 75bffe9d96 weekly release 4.1.13+ 2024-09-27 18:44:25 +07:00
Huong Nguyen 22dc6301f0 Merge branch 'install_401_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_401_STABLE 2024-09-27 18:44:23 +07:00
AMOS bot 7266fa1524 Automatically generated installer lang files 2024-09-27 00:07:35 +00:00
Jun Pataleta e0a09f31b1 Merge branch 'MDL-79288-401_blockaccessreview_colourcontrastcheck' of https://github.com/brickfield/moodle into MOODLE_401_STABLE 2024-09-26 19:45:12 +08:00
Michael Pound 72526c6f49 MDL-79288 block_accessreview: Improve heatmap colour contrast. 2024-09-26 08:14:55 +00:00
Huong Nguyen 5c0f33209e Merge branch 'MDL-62640-401' of https://github.com/meirzamoodle/moodle into MOODLE_401_STABLE 2024-09-26 11:08:03 +07:00
Sara Arjona 943ee4d484 weekly release 4.1.13+ 2024-09-24 16:52:22 +02:00
meirzamoodle acd31294f4 MDL-62640 environment: Remove the deprecated slash argument check 2024-09-23 13:08:45 +07:00
Sara Arjona b409287479 Merge branch 'MDL-81612_401' of https://github.com/timhunt/moodle into MOODLE_401_STABLE 2024-09-23 07:35:48 +02:00
Sara Arjona 13d98b9f6e weekly release 4.1.13+ 2024-09-20 16:36:32 +02:00
Sara Arjona 2b19e45d49 Merge branch 'install_401_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_401_STABLE 2024-09-20 16:36:25 +02:00
Tim Hunt 7bde04468b MDL-81612 assign: test generation of extensions
Also, some other improvements.

* In Behat you can now use either idnumber of name to identify an
  assignment you are generating things for.
* create_submission generator methods now wants the cmid in $data['cmid']
  not the confusingly named 'assignid'. The old name is accepted, but
  generates a debugging warning. (That will fail the test, but in a way
  that explains how to fix it.)
2024-09-19 16:09:12 +01:00
AMOS bot 80b23a2afd Automatically generated installer lang files 2024-09-19 00:09:22 +00:00
Huong Nguyen da8e201e17 Merge branch 'MDL-81278-401' of https://github.com/mickhawkins/moodle into MOODLE_401_STABLE 2024-09-18 16:09:39 +07:00
AMOS bot d6950db0d9 Automatically generated installer lang files 2024-09-18 00:07:33 +00:00
Sara Arjona 661d66b452 Merge branch 'MDL-83076-401-v2' of https://github.com/lameze/moodle into MOODLE_401_STABLE 2024-09-17 17:21:40 +02:00
Simey Lameze 74a5cc0965 MDL-83076 behat: workaround Firefox 130.0 failure 2024-09-17 11:08:24 +08:00
Michael Hawkins 768a82b583 MDL-81278 core: Update security.txt expiry 2024-09-16 14:51:06 +08:00
AMOS bot 04d3db34ee Automatically generated installer lang files 2024-09-12 00:07:33 +00:00
AMOS bot c871b4d5f8 Automatically generated installer lang files 2024-09-11 00:07:36 +00:00
Huong Nguyen d3749a82ab weekly release 4.1.13+ 2024-09-10 20:03:11 +07:00
Huong Nguyen d7610a257f Merge branch 'MDL-83047-401' of https://github.com/junpataleta/moodle into MOODLE_401_STABLE 2024-09-10 10:48:21 +07:00
Jun Pataleta 62b840648d MDL-83047 theme_boost: Add upgrade note for theme plugins 2024-09-10 10:34:15 +08:00
Jun Pataleta 5f93e6ab03 MDL-83047 theme_boost: Apply background colour only on select layouts
* Apply the styling of `background-color` for `.page-header-headings`
only in the maintenance and secure layouts.
2024-09-09 17:01:33 +08:00
Jun Pataleta 69beec3d2a weekly release 4.1.13+ 2024-09-07 06:45:53 +08:00
Jun Pataleta d2c9c79c0e Merge branch 'MDL-63399-401' of https://github.com/lameze/moodle into MOODLE_401_STABLE 2024-09-06 12:29:34 +08:00
Simey Lameze 1ce15ab9b1 MDL-63399 behat: update existing tests to use the better download steps
Co-authored-by: Tim Hunt <T.J.Hunt@open.ac.uk>
2024-09-06 12:19:56 +08:00
Simey Lameze a24d8a0d2a MDL-63399 behat: new steps to verify downloads
Co-authored-by: Tim Hunt <T.J.Hunt@open.ac.uk>
2024-09-06 12:18:26 +08:00
Huong Nguyen 8835ecef16 Merge branch 'MDL-82948-401' of https://github.com/junpataleta/moodle into MOODLE_401_STABLE 2024-09-06 11:01:41 +07:00
Huong Nguyen 86c79ed091 Merge branch 'MDL-82677-401' of https://github.com/junpataleta/moodle into MOODLE_401_STABLE 2024-09-06 10:51:25 +07:00
Jun Pataleta 34077a9190 MDL-82948 theme_boost: Make <blockquote>'s border a bit darker 2024-08-29 16:04:52 +08:00
Jun Pataleta 7ad936dcbf MDL-82677 theme: Set a background colour for page heading
* Set a background colour for the .page-header-headings class.
* Assign the .page-header-headings class to the maintenance mode
template's page header div.
2024-08-02 17:25:12 +08:00
502 changed files with 3688 additions and 2176 deletions
+195
View File
@@ -4703,4 +4703,199 @@
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
<MOODLE version="5.0" requires="4.2.3">
<UNICODE level="required">
<FEEDBACK>
<ON_ERROR message="unicoderequired" />
</FEEDBACK>
</UNICODE>
<DATABASE level="required">
<VENDOR name="mariadb" version="10.11.0" />
<VENDOR name="mysql" version="8.4" />
<VENDOR name="postgres" version="14" />
<VENDOR name="mssql" version="14.0" />
<VENDOR name="oracle" version="19" />
</DATABASE>
<PHP version="8.2.0" level="required">
</PHP>
<PCREUNICODE level="optional">
<FEEDBACK>
<ON_CHECK message="pcreunicodewarning" />
</FEEDBACK>
</PCREUNICODE>
<PHP_EXTENSIONS>
<PHP_EXTENSION name="iconv" level="required">
<FEEDBACK>
<ON_ERROR message="iconvrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="mbstring" level="required">
<FEEDBACK>
<ON_ERROR message="mbstringrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="curl" level="required">
<FEEDBACK>
<ON_ERROR message="curlrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="openssl" level="required">
<FEEDBACK>
<ON_ERROR message="opensslrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="tokenizer" level="optional">
<FEEDBACK>
<ON_CHECK message="tokenizerrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="soap" level="optional">
<FEEDBACK>
<ON_CHECK message="soaprecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="ctype" level="required">
<FEEDBACK>
<ON_ERROR message="ctyperequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="zip" level="required">
<FEEDBACK>
<ON_ERROR message="ziprequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="zlib" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="gd" level="required">
<FEEDBACK>
<ON_ERROR message="gdrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="simplexml" level="required">
<FEEDBACK>
<ON_ERROR message="simplexmlrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="spl" level="required">
<FEEDBACK>
<ON_ERROR message="splrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="pcre" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="dom" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="xml" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="xmlreader" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="intl" level="required">
<FEEDBACK>
<ON_ERROR message="intlrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="json" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="hash" level="required"/>
<PHP_EXTENSION name="fileinfo" level="required"/>
<PHP_EXTENSION name="sodium" level="required"/>
<PHP_EXTENSION name="exif" level="optional"/>
</PHP_EXTENSIONS>
<PHP_SETTINGS>
<PHP_SETTING name="memory_limit" value="96M" level="required">
<FEEDBACK>
<ON_ERROR message="settingmemorylimit" />
</FEEDBACK>
</PHP_SETTING>
<PHP_SETTING name="file_uploads" value="1" level="optional">
<FEEDBACK>
<ON_CHECK message="settingfileuploads" />
</FEEDBACK>
</PHP_SETTING>
<PHP_SETTING name="opcache.enable" value="1" level="optional">
<FEEDBACK>
<ON_CHECK message="opcacherecommended" />
</FEEDBACK>
</PHP_SETTING>
</PHP_SETTINGS>
<CUSTOM_CHECKS>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_storage_engine" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddbstorageengine" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="question/engine/upgrade/upgradelib.php" function="quiz_attempts_upgraded" level="required">
<FEEDBACK>
<ON_ERROR message="quizattemptsupgradedmessage" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_slasharguments" level="optional">
<FEEDBACK>
<ON_CHECK message="slashargumentswarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_tables_row_format" level="optional">
<FEEDBACK>
<ON_CHECK message="unsupporteddbtablerowformat" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_unoconv_version" level="optional">
<FEEDBACK>
<ON_CHECK message="unoconvwarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_libcurl_version" level="optional">
<FEEDBACK>
<ON_CHECK message="libcurlwarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_format" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddbfileformat" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_per_table" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddbfilepertable" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_large_prefix" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddblargeprefix" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_is_https" level="optional">
<FEEDBACK>
<ON_CHECK message="ishttpswarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_incomplete_unicode_support" level="optional">
<FEEDBACK>
<ON_CHECK message="incompleteunicodesupport" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_sixtyfour_bits" level="required">
<FEEDBACK>
<ON_ERROR message="sixtyfourbitsrequired" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_max_input_vars" level="optional">
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_admin_dir_usage" level="optional">
<FEEDBACK>
<ON_CHECK message="iscustomadminwarnings" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_xmlrpc_usage" level="optional">
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mod_assignment" level="required">
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_db_prefix_length" level="required">
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_oracle_usage" level="optional">
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_async_backup" level="recommended">
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
</COMPATIBILITY_MATRIX>
+1 -1
View File
@@ -180,7 +180,7 @@ class generator_test extends \advanced_testcase {
*
* @return array
*/
public function create_preset_provider(): array {
public static function create_preset_provider(): array {
return [
'Default values' => [
],
+4 -4
View File
@@ -84,7 +84,7 @@ class helper_test extends \advanced_testcase {
*
* @return array
*/
public function create_preset_provider(): array {
public static function create_preset_provider(): array {
return [
'Default values' => [
],
@@ -177,7 +177,7 @@ class helper_test extends \advanced_testcase {
*
* @return array
*/
public function add_item_provider(): array {
public static function add_item_provider(): array {
return [
'Setting without plugin' => [
'name' => 'settingname',
@@ -239,7 +239,7 @@ class helper_test extends \advanced_testcase {
*
* @return array
*/
public function add_plugin_provider(): array {
public static function add_plugin_provider(): array {
return [
'Plugin: enabled (using int)' => [
'type' => 'plugintype',
@@ -321,7 +321,7 @@ class helper_test extends \advanced_testcase {
*
* @return array
*/
public function change_default_preset_provider(): array {
public static function change_default_preset_provider(): array {
return [
'Starter preset' => [
'preset' => 'starter',
@@ -72,7 +72,7 @@ class adminpresets_admin_setting_bloglevel_test extends \advanced_testcase {
*
* @return array
*/
public function save_value_provider(): array {
public static function save_value_provider(): array {
return [
'Save the bloglevel and set blog_menu block visibility to true' => [
'setttingvalue' => BLOG_USER_LEVEL,
@@ -66,7 +66,7 @@ class adminpresets_admin_setting_sitesettext_test extends \advanced_testcase {
*
* @return array
*/
public function save_value_provider(): array {
public static function save_value_provider(): array {
return [
'Fullname: different value' => [
'settingname' => 'fullname',
@@ -77,7 +77,7 @@ class adminpresets_setting_test extends \advanced_testcase {
*
* @return array
*/
public function save_value_provider(): array {
public static function save_value_provider(): array {
return [
'Core setting with the same value is not saved' => [
'category' => 'optionalsubsystems',
@@ -167,7 +167,7 @@ class adminpresets_setting_test extends \advanced_testcase {
*
* @return array
*/
public function save_attributes_values_provider(): array {
public static function save_attributes_values_provider(): array {
return [
'Plugin setting with the same value is not saved' => [
'category' => 'modsettinglesson',
+2 -2
View File
@@ -358,7 +358,7 @@ class manager_test extends \advanced_testcase {
*
* @return array
*/
public function export_preset_provider(): array {
public static function export_preset_provider(): array {
return [
'Export settings and plugins, excluding sensible' => [
'includesensible' => false,
@@ -521,7 +521,7 @@ class manager_test extends \advanced_testcase {
*
* @return array
*/
public function import_preset_provider(): array {
public static function import_preset_provider(): array {
return [
'Import settings from an empty file' => [
'filecontents' => '',
@@ -103,7 +103,7 @@ class task_logs_test extends core_reportbuilder_testcase {
*
* @return array[]
*/
public function datasource_filters_provider(): array {
public static function datasource_filters_provider(): array {
return [
'Filter name' => ['task_log:name', [
'task_log:name_values' => [send_schedules::class],
@@ -5,16 +5,18 @@ Feature: I can download a preset
| name |
| Custom preset |
@javascript
Scenario: Custom preset settings can be downloaded
Given I log in as "admin"
And I navigate to "Site admin presets" in site administration
When I open the action menu in "Custom preset" "table_row"
Then following "Download" "link" in the "Custom preset" "table_row" should download between "0" and "5000" bytes
Then following "Download" in the "Custom preset" "table_row" should download a file that:
| Has mimetype | text/xml |
| Contains text in xml element | Custom preset |
@javascript
Scenario: Core preset settings can be downloaded
Given I log in as "admin"
And I navigate to "Site admin presets" in site administration
When I open the action menu in "Starter" "table_row"
Then following "Download" "link" in the "Starter" "table_row" should download between "0" and "5000" bytes
Then following "Download" in the "Starter" "table_row" should download a file that:
| Has mimetype | text/xml |
| Contains text in xml element | Starter |
@@ -70,7 +70,7 @@ class base_test extends \advanced_testcase {
*
* @return array
*/
public function log_provider(): array {
public static function log_provider(): array {
return [
// Action = base.
'action=base and mode = show' => [
@@ -156,7 +156,7 @@ class export_test extends \advanced_testcase {
*
* @return array
*/
public function export_execute_provider(): array {
public static function export_execute_provider(): array {
return [
'Export settings and plugins, excluding sensible' => [
'includesensible' => false,
@@ -190,7 +190,7 @@ class import_test extends \advanced_testcase {
*
* @return array
*/
public function import_execute_provider(): array {
public static function import_execute_provider(): array {
$fixturesfolder = __DIR__ . '/../../../../../presets/tests/fixtures/';
return [
@@ -53,7 +53,7 @@ class behat_form_text_test extends \basic_testcase {
*
* @return array of value and expectation pairs to be tested.
*/
public function provider_test_set_get_value() {
public static function provider_test_set_get_value(): array {
return [
'null' => [null, null],
'int' => [3, 3],
@@ -68,7 +68,7 @@ class behat_form_text_test extends \basic_testcase {
*
* @param mixed $value value to be set.
* @param mixed $expectation value to be checked.
* @dataProvider provider_test_set_get_value()
* @dataProvider provider_test_set_get_value
*/
public function test_set_get_value($value, $expectation) {
$session = $this->createMock(Session::class);
@@ -85,7 +85,7 @@ class behat_form_text_test extends \basic_testcase {
*
* @return array of decsep, value, match and result pairs to be tested.
*/
public function provider_test_matches() {
public static function provider_test_matches(): array {
return [
'lazy true' => ['.', 'hello', 'hello', true],
'lazy false' => ['.', 'hello', 'bye', false],
@@ -113,7 +113,7 @@ class behat_form_text_test extends \basic_testcase {
* @param mixed $value value to be set.
* @param mixed $match value to be matched.
* @param bool $result expected return status of the function.
* @dataProvider provider_test_matches()
* @dataProvider provider_test_matches
*/
public function test_matches($decsep, $value, $match, $result) {
global $CFG;
+5 -5
View File
@@ -30,7 +30,7 @@ use tool_brickfield\local\tool\tool;
class tool_test extends \advanced_testcase {
/** @var string base 64 image */
protected $base64img = <<<EOF
protected static string $base64img = <<<EOF
<img src="data:image/gif;base64,R0lGODlhPQBEAPeoAJosM//AwO/AwHVYZ/z595kzAP/s7P+goOXMv8+fhw/v739/f+8PD98fH/
8mJl+fn/9ZWb8/PzWlwv///6wWGbImAPgTEMImIN9gUFCEm/gDALULDN8PAD6atYdCTX9gUNKlj8wZAKUsAOzZz+UMAOsJAP/Z2ccMDA8PD/95eX5N
WvsJCOVNQPtfX/8zM8+QePLl38MGBr8JCP+zs9myn/8GBqwpAP/GxgwJCPny78lzYLgjAJ8vAP9fX/+MjMUcAN8zM/9wcM8ZGcATEL+QePdZWf/29u
@@ -118,11 +118,11 @@ EOF;
* Base64 image provider.
* @return array
*/
public function base64_img_provider(): array {
public static function base64_img_provider(): array {
$img = '<img src="myimage.jpg" />';
return [
'Image tag alone (base64)' => [
$this->base64img,
self::$base64img,
true,
],
'Image tag alone (link)' => [
@@ -130,7 +130,7 @@ EOF;
false,
],
'Image tag in string (base64)' => [
"This is my image {$this->base64img}.",
"This is my image " . self::$base64img,
true,
],
'Image tag in string (link)' => [
@@ -162,7 +162,7 @@ EOF;
}
public function test_truncate_base64() {
$truncated = tool::truncate_base64($this->base64img);
$truncated = tool::truncate_base64(self::$base64img);
$this->assertStringContainsString('<img src="data:image/gif;base64..."', $truncated);
}
}
@@ -60,7 +60,7 @@ class langstring_test extends advanced_testcase {
*
* @return array
*/
public function fix_syntax_data() : array {
public static function fix_syntax_data(): array {
return [
// Syntax sanity v1 strings.
[
@@ -79,7 +79,7 @@ class phpparser_test extends advanced_testcase {
*
* @return array
*/
public function parse_provider() : array {
public static function parse_provider(): array {
return [
'Invalid PHP code' => [
'No PHP code', [], false
+8 -8
View File
@@ -545,7 +545,7 @@ class api_test extends \advanced_testcase {
*
* @return array
*/
public function data_request_creation_provider() {
public static function data_request_creation_provider(): array {
return [
'Export request by user, automatic approval off' => [
false, api::DATAREQUEST_TYPE_EXPORT, 'automaticdataexportapproval', false, 0,
@@ -705,7 +705,7 @@ class api_test extends \advanced_testcase {
*
* @return array
*/
public function get_data_requests_provider() {
public static function get_data_requests_provider(): array {
$completeonly = [api::DATAREQUEST_STATUS_COMPLETE, api::DATAREQUEST_STATUS_DOWNLOAD_READY, api::DATAREQUEST_STATUS_DELETED];
$completeandcancelled = array_merge($completeonly, [api::DATAREQUEST_STATUS_CANCELLED]);
@@ -842,7 +842,7 @@ class api_test extends \advanced_testcase {
/**
* Data provider for test_has_ongoing_request.
*/
public function status_provider() {
public static function status_provider(): array {
return [
[api::DATAREQUEST_STATUS_AWAITING_APPROVAL, true],
[api::DATAREQUEST_STATUS_APPROVED, true],
@@ -932,7 +932,7 @@ class api_test extends \advanced_testcase {
*
* @return array
*/
public function notify_dpo_provider() {
public static function notify_dpo_provider(): array {
return [
[false, api::DATAREQUEST_TYPE_EXPORT, 'requesttypeexport', 'Export my user data'],
[false, api::DATAREQUEST_TYPE_DELETE, 'requesttypedelete', 'Delete my user data'],
@@ -1284,7 +1284,7 @@ class api_test extends \advanced_testcase {
/**
* Data provider for invalid contextlevel fetchers.
*/
public function invalid_effective_contextlevel_provider() {
public static function invalid_effective_contextlevel_provider(): array {
return [
[CONTEXT_COURSECAT],
[CONTEXT_COURSE],
@@ -1844,7 +1844,7 @@ class api_test extends \advanced_testcase {
/**
* Data provider for \tool_dataprivacy_api_testcase::test_set_context_defaults
*/
public function set_context_defaults_provider() {
public static function set_context_defaults_provider(): array {
$contextlevels = [
[CONTEXT_COURSECAT],
[CONTEXT_COURSE],
@@ -2319,7 +2319,7 @@ class api_test extends \advanced_testcase {
*
* @return array
*/
public function queue_data_request_task_provider() {
public static function queue_data_request_task_provider(): array {
return [
'With user ID provided' => [true],
'Without user ID provided' => [false],
@@ -2356,7 +2356,7 @@ class api_test extends \advanced_testcase {
/**
* Data provider for test_is_automatic_request_approval_on().
*/
public function automatic_request_approval_setting_provider() {
public static function automatic_request_approval_setting_provider(): array {
return [
'Data export, not set' => [
'automaticdataexportapproval', api::DATAREQUEST_TYPE_EXPORT, null, false
@@ -55,7 +55,8 @@ Feature: Data export from the privacy API
And I reload the page
And I should see "Download ready" in the "Victim User 1" "table_row"
And I open the action menu in "Victim User 1" "table_row"
And following "Download" should download between "1" and "150000" bytes
And following "Download" should download a file that:
| Contains file in zip | index.html |
And the following config values are set as admin:
| privacyrequestexpiry | 1 | tool_dataprivacy |
And I wait "1" seconds
@@ -90,7 +91,8 @@ Feature: Data export from the privacy API
And I reload the page
And I should see "Download ready" in the "Export all of my personal data" "table_row"
And I open the action menu in "Victim User 1" "table_row"
And following "Download" should download between "1" and "155000" bytes
And following "Download" should download a file that:
| Contains file in zip | index.html |
And the following config values are set as admin:
| privacyrequestexpiry | 1 | tool_dataprivacy |
@@ -128,7 +130,8 @@ Feature: Data export from the privacy API
And I reload the page
And I should see "Download ready" in the "Victim User 1" "table_row"
And I open the action menu in "Victim User 1" "table_row"
And following "Download" should download between "1" and "150000" bytes
And following "Download" should download a file that:
| Contains file in zip | index.html |
And the following config values are set as admin:
| privacyrequestexpiry | 1 | tool_dataprivacy |
@@ -35,7 +35,7 @@ class data_request_test extends data_privacy_testcase {
*
* @return array
*/
public function status_state_provider() : array {
public static function status_state_provider(): array {
return [
[
'state' => api::DATAREQUEST_STATUS_PENDING,
@@ -138,9 +138,9 @@ class data_request_test extends data_privacy_testcase {
*
* @return array
*/
public function non_resettable_provider() : array {
public static function non_resettable_provider(): array {
$states = [];
foreach ($this->status_state_provider() as $thisstatus) {
foreach (self::status_state_provider() as $thisstatus) {
if (!$thisstatus['resettable']) {
$states[] = $thisstatus;
}
@@ -1918,7 +1918,7 @@ class expired_contexts_test extends \advanced_testcase {
*
* @return array
*/
public function can_process_deletion_provider() : array {
public static function can_process_deletion_provider(): array {
return [
'Pending' => [
expired_context::STATUS_EXPIRED,
@@ -1956,7 +1956,7 @@ class expired_contexts_test extends \advanced_testcase {
*
* @return array
*/
public function is_complete_provider() : array {
public static function is_complete_provider(): array {
return [
'Pending' => [
expired_context::STATUS_EXPIRED,
@@ -1991,7 +1991,7 @@ class expired_contexts_test extends \advanced_testcase {
*
* @return array
*/
public function is_fully_expired_provider() : array {
public static function is_fully_expired_provider(): array {
return [
'Fully expired' => [
[
+2 -2
View File
@@ -578,7 +578,7 @@ class external_test extends externallib_advanced_testcase {
/**
* Data provider for \tool_dataprivacy_external_testcase::test_XX_options().
*/
public function get_options_provider() {
public static function get_options_provider(): array {
return [
[false, false],
[false, true],
@@ -703,7 +703,7 @@ class external_test extends externallib_advanced_testcase {
/**
* Data provider for \tool_dataprivacy_external_testcase::get_activity_options().
*/
public function get_activity_options_provider() {
public static function get_activity_options_provider(): array {
return [
[false, false, true],
[false, true, true],
@@ -58,7 +58,7 @@ class filtered_userlist_test extends \advanced_testcase {
*
* @return array
*/
public function apply_expired_contexts_filters_provider() : array {
public static function apply_expired_contexts_filters_provider(): array {
return [
// Entire list should be preserved.
'No overrides' => [
@@ -38,20 +38,20 @@ class httpsreplace_test extends \advanced_testcase {
/**
* Data provider for test_upgrade_http_links
*/
public function upgrade_http_links_provider() {
public static function upgrade_http_links_provider(): array {
global $CFG;
// Get the http url, since the default test wwwroot is https.
$wwwroothttp = preg_replace('/^https:/', 'http:', $CFG->wwwroot);
return [
"Test image from another site should be replaced" => [
"content" => '<img src="' . $this->getExternalTestFileUrl('/test.jpg', false) . '">',
"content" => '<img src="' . self::getExternalTestFileUrl('/test.jpg', false) . '">',
"outputregex" => '/UPDATE/',
"expectedcontent" => '<img src="' . $this->get_converted_http_link('/test.jpg') . '">',
"expectedcontent" => '<img src="' . self::get_converted_http_link('/test.jpg') . '">',
],
"Test object from another site should be replaced" => [
"content" => '<object data="' . $this->getExternalTestFileUrl('/test.swf', false) . '">',
"content" => '<object data="' . self::getExternalTestFileUrl('/test.swf', false) . '">',
"outputregex" => '/UPDATE/',
"expectedcontent" => '<object data="' . $this->get_converted_http_link('/test.swf') . '">',
"expectedcontent" => '<object data="' . self::get_converted_http_link('/test.swf') . '">',
],
"Test image from a site with international name should be replaced" => [
"content" => '<img src="http://中国互联网络信息中心.中国/logosy/201706/W01.png">',
@@ -79,9 +79,9 @@ class httpsreplace_test extends \advanced_testcase {
"expectedcontent" => '<img src="https://anothersite.com?param=http://asdf.com">',
],
"Search for params should be case insensitive" => [
"content" => '<object DATA="' . $this->getExternalTestFileUrl('/test.swf', false) . '">',
"content" => '<object DATA="' . self::getExternalTestFileUrl('/test.swf', false) . '">',
"outputregex" => '/UPDATE/',
"expectedcontent" => '<object DATA="' . $this->get_converted_http_link('/test.swf') . '">',
"expectedcontent" => '<object DATA="' . self::get_converted_http_link('/test.swf') . '">',
],
"URL should be case insensitive" => [
"content" => '<object data="HTTP://some.site/path?query">',
@@ -89,30 +89,30 @@ class httpsreplace_test extends \advanced_testcase {
"expectedcontent" => '<object data="https://some.site/path?query">',
],
"More params should not interfere" => [
"content" => '<img alt="A picture" src="' . $this->getExternalTestFileUrl('/test.png', false) .
"content" => '<img alt="A picture" src="' . self::getExternalTestFileUrl('/test.png', false) .
'" width="1”><p style="font-size: \'20px\'"></p>',
"outputregex" => '/UPDATE/',
"expectedcontent" => '<img alt="A picture" src="' . $this->get_converted_http_link('/test.png') .
"expectedcontent" => '<img alt="A picture" src="' . self::get_converted_http_link('/test.png') .
'" width="1”><p style="font-size: \'20px\'"></p>',
],
"Broken URL should not be changed" => [
"content" => '<img src="broken.' . $this->getExternalTestFileUrl('/test.png', false) . '">',
"content" => '<img src="broken.' . self::getExternalTestFileUrl('/test.png', false) . '">',
"outputregex" => '/^$/',
"expectedcontent" => '<img src="broken.' . $this->getExternalTestFileUrl('/test.png', false) . '">',
"expectedcontent" => '<img src="broken.' . self::getExternalTestFileUrl('/test.png', false) . '">',
],
"Link URL should not be changed" => [
"content" => '<a href="' . $this->getExternalTestFileUrl('/test.png', false) . '">' .
$this->getExternalTestFileUrl('/test.png', false) . '</a>',
"content" => '<a href="' . self::getExternalTestFileUrl('/test.png', false) . '">' .
self::getExternalTestFileUrl('/test.png', false) . '</a>',
"outputregex" => '/^$/',
"expectedcontent" => '<a href="' . $this->getExternalTestFileUrl('/test.png', false) . '">' .
$this->getExternalTestFileUrl('/test.png', false) . '</a>',
"expectedcontent" => '<a href="' . self::getExternalTestFileUrl('/test.png', false) . '">' .
self::getExternalTestFileUrl('/test.png', false) . '</a>',
],
"Test image from another site should be replaced but link should not" => [
"content" => '<a href="' . $this->getExternalTestFileUrl('/test.png', false) . '"><img src="' .
$this->getExternalTestFileUrl('/test.jpg', false) . '"></a>',
"content" => '<a href="' . self::getExternalTestFileUrl('/test.png', false) . '"><img src="' .
self::getExternalTestFileUrl('/test.jpg', false) . '"></a>',
"outputregex" => '/UPDATE/',
"expectedcontent" => '<a href="' . $this->getExternalTestFileUrl('/test.png', false) . '"><img src="' .
$this->get_converted_http_link('/test.jpg') . '"></a>',
"expectedcontent" => '<a href="' . self::getExternalTestFileUrl('/test.png', false) . '"><img src="' .
self::get_converted_http_link('/test.jpg') . '"></a>',
],
];
}
@@ -127,8 +127,8 @@ class httpsreplace_test extends \advanced_testcase {
* @param string $path Path to be rewritten
* @return string
*/
protected function get_converted_http_link($path) {
return preg_replace('/^http:/', 'https:', $this->getExternalTestFileUrl($path, false));
protected static function get_converted_http_link($path) {
return preg_replace('/^http:/', 'https:', self::getExternalTestFileUrl($path, false));
}
/**
@@ -160,15 +160,15 @@ class httpsreplace_test extends \advanced_testcase {
/**
* Data provider for test_http_link_stats
*/
public function http_link_stats_provider() {
public static function http_link_stats_provider(): array {
global $CFG;
// Get the http url, since the default test wwwroot is https.
$wwwrootdomain = 'www.example.com';
$wwwroothttp = preg_replace('/^https:/', 'http:', $CFG->wwwroot);
$testdomain = $this->get_converted_http_link('');
$testdomain = self::get_converted_http_link('');
return [
"Test image from an available site so shouldn't be reported" => [
"content" => '<img src="' . $this->getExternalTestFileUrl('/test.jpg', false) . '">',
"content" => '<img src="' . self::getExternalTestFileUrl('/test.jpg', false) . '">',
"domain" => $testdomain,
"expectedcount" => 0,
],
@@ -48,7 +48,7 @@ class controller_test extends \advanced_testcase {
*
* @return array
*/
public function uninstall_lang_invalid_provider(): array {
public static function uninstall_lang_invalid_provider(): array {
return [
'Empty string' => [''],
'Meaningless empty string' => [' '],
@@ -389,7 +389,7 @@ class store_test extends \advanced_testcase {
*
* @return array Array of parameters
*/
public function decode_other_provider(): array {
public static function decode_other_provider(): array {
return [
[['info' => 'd2819896', 'logurl' => 'discuss.php?d=2819896']],
[null],
+2
View File
@@ -873,6 +873,8 @@ class external extends external_api {
$context = context_system::instance();
self::validate_context($context);
require_capability('moodle/competency:templatemanage', $context);
$output = $PAGE->get_renderer('tool_lp');
list($filtercapsql, $filtercapparams) = api::filter_users_with_capability_on_user_context_sql($cap,
+1 -1
View File
@@ -128,7 +128,7 @@ $functions = array(
'classpath' => '',
'description' => 'Search for users.',
'type' => 'read',
'capabilities' => '',
'capabilities' => 'moodle/competency:templatemanage',
'ajax' => true,
),
// This function was originally in this plugin but has been moved to core.
+10 -7
View File
@@ -149,17 +149,14 @@ class externallib_test extends externallib_advanced_testcase {
'email' => 'bobbyyy@dyyylan.com', 'phone1' => '123456', 'phone2' => '78910', 'department' => 'Marketing',
'institution' => 'HQ'));
// First we search with no capability assigned.
// Assign capability required to perform the search.
$this->setUser($ux);
$result = external::search_users('yyylan', 'moodle/competency:planmanage');
$result = \external_api::clean_returnvalue(external::search_users_returns(), $result);
$this->assertCount(0, $result['users']);
$this->assertEquals(0, $result['count']);
$systemcontext = \context_system::instance();
$customrole = $this->assignUserCapability('moodle/competency:templatemanage', $systemcontext->id);
// Now we assign a different capability.
$usercontext = \context_user::instance($u1->id);
$systemcontext = \context_system::instance();
$customrole = $this->assignUserCapability('moodle/competency:planview', $usercontext->id);
$this->assignUserCapability('moodle/competency:templatemanage', $usercontext->id, $customrole);
$result = external::search_users('yyylan', 'moodle/competency:planmanage');
$result = \external_api::clean_returnvalue(external::search_users_returns(), $result);
@@ -195,6 +192,8 @@ class externallib_test extends externallib_advanced_testcase {
$ux3 = $dg->create_user();
role_assign($this->creatorrole, $ux3->id, $usercontext->id);
$this->setUser($ux3);
$systemcontext = \context_system::instance();
$customrole = $this->assignUserCapability('moodle/competency:templatemanage', $systemcontext->id, $customrole);
$result = external::search_users('yyylan', 'moodle/competency:planmanage');
$result = \external_api::clean_returnvalue(external::search_users_returns(), $result);
$this->assertCount(1, $result['users']);
@@ -270,6 +269,7 @@ class externallib_test extends externallib_advanced_testcase {
// Now do the test.
$this->setUser($master);
$dummyrole = $this->assignUserCapability('moodle/competency:templatemanage', $syscontext->id);
$result = external::search_users('MOODLER', 'moodle/site:config');
$this->assertCount(2, $result['users']);
$this->assertEquals(2, $result['count']);
@@ -277,6 +277,7 @@ class externallib_test extends externallib_advanced_testcase {
$this->assertArrayHasKey($slave3->id, $result['users']);
$this->setUser($manager);
$this->assignUserCapability('moodle/competency:templatemanage', $syscontext->id, $dummyrole);
$result = external::search_users('MOODLER', 'moodle/site:config');
$this->assertCount(1, $result['users']);
$this->assertEquals(1, $result['count']);
@@ -385,6 +386,8 @@ class externallib_test extends externallib_advanced_testcase {
// Switch to a user that cannot view identity fields.
$this->setUser($ux);
$systemcontext = \context_system::instance();
$this->assignUserCapability('moodle/competency:templatemanage', $systemcontext->id, $dummyrole);
$CFG->showuseridentity = 'idnumber,email,phone1,phone2,department,institution';
// Only names are included.
+1 -1
View File
@@ -25,6 +25,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2022112800; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2022112801; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2022111800; // Requires this Moodle version.
$plugin->component = 'tool_lp'; // Full name of the plugin (used for diagnostics).
+1 -1
View File
@@ -52,7 +52,7 @@ class lib_test extends \advanced_testcase {
*
* @return array
*/
public function get_endpoints_provider() {
public static function get_endpoints_provider(): array {
global $CFG;
return [
[
@@ -59,7 +59,7 @@ class import_handler_info_test extends \advanced_testcase {
*
* @return array the data for creation of the info object.
*/
public function handler_info_data_provider() {
public static function handler_info_data_provider(): array {
return [
'All data present' => ['label', 'Add a label to the course', false],
'Empty module name' => ['', 'Add a file resource to the course', true],
@@ -53,10 +53,10 @@ class remote_resource_test extends \advanced_testcase {
*
* @return array
*/
public function remote_resource_data_provider() {
public static function remote_resource_data_provider(): array {
return [
'With filename and extension' => [
$this->getExternalTestFileUrl('/test.html'),
self::getExternalTestFileUrl('/test.html'),
(object) [
'name' => 'Test html file',
'description' => 'Full description of the html file'
@@ -77,9 +77,9 @@ class remote_resource_test extends \advanced_testcase {
/**
* Test confirming the network based operations of a remote_resource.
*/
public function test_network_features() {
$url = $this->getExternalTestFileUrl('/test.html');
$nonexistenturl = $this->getExternalTestFileUrl('/test.htmlzz');
public function test_network_features(): void {
$url = self::getExternalTestFileUrl('/test.html');
$nonexistenturl = self::getExternalTestFileUrl('/test.htmlzz');
$remoteres = new remote_resource(
new \curl(),
@@ -55,7 +55,7 @@ class url_test extends \advanced_testcase {
*
* @return array
*/
public function url_provider() {
public static function url_provider(): array {
return [
'No path' => [
'url' => 'https://example.moodle.net',
@@ -175,7 +175,7 @@ class category_bin_test extends \advanced_testcase {
* Used to verify that recycle bin is immune to various settings. Provides plugin, name, value for
* direct usage with set_config()
*/
public function recycle_bin_settings_provider() {
public static function recycle_bin_settings_provider(): array {
return [
'backup/backup_auto_storage moodle' => [[
(object)['plugin' => 'backup', 'name' => 'backup_auto_storage', 'value' => 0],
@@ -172,7 +172,7 @@ class course_bin_test extends \advanced_testcase {
* Used to verify that recycle bin is immune to various settings. Provides plugin, name, value for
* direct usage with set_config()
*/
public function recycle_bin_settings_provider() {
public static function recycle_bin_settings_provider(): array {
return [
'backup/backup_auto_storage moodle' => [[
(object)['plugin' => 'backup', 'name' => 'backup_auto_storage', 'value' => 0],
@@ -1182,7 +1182,7 @@ class course_test extends \advanced_testcase {
*
* @return array
*/
public function enrolment_uploaddata_error_provider(): array {
public static function enrolment_uploaddata_error_provider(): array {
return [
['errorcannotcreateorupdateenrolment', [
'shortname' => 'C1',
@@ -30,7 +30,7 @@ class field_value_validators_test extends \advanced_testcase {
/**
* Data provider for \field_value_validators_testcase::test_validate_theme().
*/
public function themes_provider() {
public static function themes_provider(): array {
return [
'User themes disabled' => [
false, 'boost', 'warning', get_string('userthemesnotallowed', 'tool_uploaduser')
@@ -36,7 +36,7 @@ class accessdate_filter_test extends \advanced_testcase {
*
* @return array
*/
public function filter_matches_provider() {
public static function filter_matches_provider(): array {
return [
'No config set; Matches' => [
[],
+1 -1
View File
@@ -126,7 +126,7 @@ class cache_test extends \advanced_testcase {
*
* @return array
*/
public function get_matching_tourdata_provider() {
public static function get_matching_tourdata_provider(): array {
$tourconfigs = [
(object) [
'name' => 'my_exact_1',
+1 -1
View File
@@ -42,7 +42,7 @@ class helper_test extends advanced_testcase {
*
* @return array
*/
public function get_string_from_input_provider(): array {
public static function get_string_from_input_provider(): array {
return [
'Text' => [
'example',
+3 -3
View File
@@ -74,7 +74,7 @@ class manager_test extends \advanced_testcase {
*
* @return array
*/
public function sesskey_required_provider() {
public static function sesskey_required_provider(): array {
$tourid = rand(1, 100);
$stepid = rand(1, 100);
@@ -121,7 +121,7 @@ class manager_test extends \advanced_testcase {
*
* @return array
*/
public function move_tour_provider() {
public static function move_tour_provider(): array {
$alltours = [
['name' => 'Tour 1'],
['name' => 'Tour 2'],
@@ -198,7 +198,7 @@ class manager_test extends \advanced_testcase {
*
* @return array
*/
public function get_matching_tours_provider() {
public static function get_matching_tours_provider(): array {
global $CFG;
$alltours = [
+5 -5
View File
@@ -73,7 +73,7 @@ class step_test extends \advanced_testcase {
*
* @return array
*/
public function dirty_value_provider() {
public static function dirty_value_provider(): array {
return [
'tourid' => [
'tourid',
@@ -160,7 +160,7 @@ class step_test extends \advanced_testcase {
*
* @return array
*/
public function step_sortorder_provider() {
public static function step_sortorder_provider(): array {
return [
[0, 5, true, false],
[1, 5, false, false],
@@ -254,7 +254,7 @@ class step_test extends \advanced_testcase {
*
* @return array
*/
public function get_config_provider() {
public static function get_config_provider(): array {
$allvalues = (object) [
'some' => 'value',
'another' => 42,
@@ -410,7 +410,7 @@ class step_test extends \advanced_testcase {
/**
* Data provider for set_config.
*/
public function set_config_provider() {
public static function set_config_provider(): array {
$allvalues = (object) [
'some' => 'value',
'another' => 42,
@@ -764,7 +764,7 @@ class step_test extends \advanced_testcase {
*
* @return array
*/
public function getter_provider() {
public static function getter_provider(): array {
return [
'id' => [
'id',
@@ -30,7 +30,7 @@ class theme_filter_test extends \advanced_testcase {
*
* @return array
*/
public function filter_matches_provider() {
public static function filter_matches_provider(): array {
return [
'No config set; Matches' => [
null,
+9 -9
View File
@@ -73,7 +73,7 @@ class tour_test extends \advanced_testcase {
*
* @return array
*/
public function dirty_value_provider() {
public static function dirty_value_provider(): array {
return [
'name' => [
'name',
@@ -126,7 +126,7 @@ class tour_test extends \advanced_testcase {
*
* @return array
*/
public function getter_provider() {
public static function getter_provider(): array {
return [
'id' => [
'id',
@@ -430,7 +430,7 @@ class tour_test extends \advanced_testcase {
*
* @return array
*/
public function get_config_provider() {
public static function get_config_provider(): array {
$allvalues = (object) [
'some' => 'value',
'another' => 42,
@@ -624,7 +624,7 @@ class tour_test extends \advanced_testcase {
*
* @return array
*/
public function should_show_for_user_provider() {
public static function should_show_for_user_provider(): array {
$time = time();
return [
'Not seen by user at all' => [
@@ -715,7 +715,7 @@ class tour_test extends \advanced_testcase {
*
* @return array
*/
public function get_tour_key_provider() {
public static function get_tour_key_provider(): array {
$id = rand(1, 100);
$time = time();
@@ -723,7 +723,7 @@ class tour_test extends \advanced_testcase {
'No initial values' => [
$id,
[null, $time],
$this->greaterThanOrEqual($time),
self::greaterThanOrEqual($time),
true,
null,
sprintf('tool_usertours_\d_%d_%s', $id, $time),
@@ -879,7 +879,7 @@ class tour_test extends \advanced_testcase {
*
* @return array
*/
public function sortorder_first_last_provider() {
public static function sortorder_first_last_provider(): array {
$topcount = rand(10, 100);
return [
'Only tour => first + last' => [
@@ -987,7 +987,7 @@ class tour_test extends \advanced_testcase {
*
* @return array
*/
public function get_filter_values_provider() {
public static function get_filter_values_provider(): array {
$cheese = ['cheddar', 'boursin', 'mozzarella'];
$horses = ['coolie', 'dakota', 'leo', 'twiggy'];
return [
@@ -1046,7 +1046,7 @@ class tour_test extends \advanced_testcase {
*
* @return array
*/
public function set_filter_values_provider() {
public static function set_filter_values_provider(): array {
$cheese = ['cheddar', 'boursin', 'mozzarella'];
$horses = ['coolie', 'dakota', 'leo', 'twiggy'];
+2 -1
View File
@@ -146,7 +146,8 @@ Feature: Manage analytics models
When I open the action menu in "Students at risk of not meeting the course completion conditions" "table_row"
And I choose "Export" in the open action menu
And I click on "Actions" "link" in the "Students at risk of not meeting the course completion conditions" "table_row"
And following "Export" should download between "100" and "500" bytes
And following "Export" should download a file that:
| Contains file in zip | model-config.json |
Scenario: Check invalid site elements
When I open the action menu in "Students at risk of not meeting the course completion conditions" "table_row"
+2 -3
View File
@@ -23,8 +23,7 @@ namespace core_analytics;
* @copyright 2017 David Monllaó {@link http://www.davidmonllao.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class calculation_info_test extends \advanced_testcase {
final class calculation_info_test extends \advanced_testcase {
/**
* test_calculation_info description
*
@@ -88,7 +87,7 @@ class calculation_info_test extends \advanced_testcase {
*
* @return mixed[]
*/
public function provider_test_calculation_info_add_pull() {
public static function provider_test_calculation_info_add_pull(): array {
return [
'mixed-types' => ['asd', true, [123, 123, 123], (object)['asd' => 'fgfg']],
];
+3 -4
View File
@@ -29,8 +29,7 @@ require_once(__DIR__ . '/fixtures/test_indicator_min.php');
* @copyright 2017 David Monllaó {@link http://www.davidmonllao.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class indicator_test extends \advanced_testcase {
final class indicator_test extends \advanced_testcase {
/**
* test_validate_calculated_value
*
@@ -50,7 +49,7 @@ class indicator_test extends \advanced_testcase {
*
* @return array
*/
public function validate_calculated_value() {
public static function validate_calculated_value(): array {
return [
'max' => ['test_indicator_max', [1]],
'min' => ['test_indicator_min', [-1]],
@@ -83,7 +82,7 @@ class indicator_test extends \advanced_testcase {
*
* @return array
*/
public function validate_calculated_value_exceptions() {
public static function validate_calculated_value_exceptions(): array {
return [
'max' => ['test_indicator_max', 2],
'min' => ['test_indicator_min', -2],
+55 -46
View File
@@ -31,8 +31,7 @@ require_once(__DIR__ . '/fixtures/test_target_course_level_shortname.php');
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @covers \core_analytics\manager
*/
class manager_test extends \advanced_testcase {
final class manager_test extends \advanced_testcase {
/**
* test_deleted_context
*/
@@ -44,7 +43,7 @@ class manager_test extends \advanced_testcase {
set_config('enabled_stores', 'logstore_standard', 'tool_log');
$target = \core_analytics\manager::get_target('test_target_course_level_shortname');
$indicators = array('test_indicator_max', 'test_indicator_min', 'test_indicator_fullname');
$indicators = ['test_indicator_max', 'test_indicator_min', 'test_indicator_fullname'];
foreach ($indicators as $key => $indicator) {
$indicators[$key] = \core_analytics\manager::get_indicator($indicator);
}
@@ -52,10 +51,10 @@ class manager_test extends \advanced_testcase {
$model = \core_analytics\model::create($target, $indicators);
$modelobj = $model->get_model_obj();
$coursepredict1 = $this->getDataGenerator()->create_course(array('visible' => 0));
$coursepredict2 = $this->getDataGenerator()->create_course(array('visible' => 0));
$coursetrain1 = $this->getDataGenerator()->create_course(array('visible' => 1));
$coursetrain2 = $this->getDataGenerator()->create_course(array('visible' => 1));
$coursepredict1 = $this->getDataGenerator()->create_course(['visible' => 0]);
$coursepredict2 = $this->getDataGenerator()->create_course(['visible' => 0]);
$coursetrain1 = $this->getDataGenerator()->create_course(['visible' => 1]);
$coursetrain2 = $this->getDataGenerator()->create_course(['visible' => 1]);
$model->enable('\core\analytics\time_splitting\no_splitting');
@@ -65,25 +64,33 @@ class manager_test extends \advanced_testcase {
// Generate a prediction action to confirm that it is deleted when there is an important update.
$predictions = $DB->get_records('analytics_predictions');
$prediction = reset($predictions);
$prediction = new \core_analytics\prediction($prediction, array('whatever' => 'not used'));
$prediction = new \core_analytics\prediction($prediction, ['whatever' => 'not used']);
$prediction->action_executed(\core_analytics\prediction::ACTION_USEFUL, $model->get_target());
$predictioncontextid = $prediction->get_prediction_data()->contextid;
$npredictions = $DB->count_records('analytics_predictions', array('contextid' => $predictioncontextid));
$npredictionactions = $DB->count_records('analytics_prediction_actions',
array('predictionid' => $prediction->get_prediction_data()->id));
$nindicatorcalc = $DB->count_records('analytics_indicator_calc', array('contextid' => $predictioncontextid));
$npredictions = $DB->count_records('analytics_predictions', ['contextid' => $predictioncontextid]);
$npredictionactions = $DB->count_records(
'analytics_prediction_actions',
['predictionid' => $prediction->get_prediction_data()->id]
);
$nindicatorcalc = $DB->count_records('analytics_indicator_calc', ['contextid' => $predictioncontextid]);
\core_analytics\manager::cleanup();
// Nothing is incorrectly deleted.
$this->assertEquals($npredictions, $DB->count_records('analytics_predictions',
array('contextid' => $predictioncontextid)));
$this->assertEquals($npredictionactions, $DB->count_records('analytics_prediction_actions',
array('predictionid' => $prediction->get_prediction_data()->id)));
$this->assertEquals($nindicatorcalc, $DB->count_records('analytics_indicator_calc',
array('contextid' => $predictioncontextid)));
$this->assertEquals($npredictions, $DB->count_records(
'analytics_predictions',
['contextid' => $predictioncontextid]
));
$this->assertEquals($npredictionactions, $DB->count_records(
'analytics_prediction_actions',
['predictionid' => $prediction->get_prediction_data()->id]
));
$this->assertEquals($nindicatorcalc, $DB->count_records(
'analytics_indicator_calc',
['contextid' => $predictioncontextid]
));
// Now we delete a context, the course predictions and prediction actions should be deleted.
$deletedcontext = \context::instance_by_id($predictioncontextid);
@@ -91,10 +98,12 @@ class manager_test extends \advanced_testcase {
\core_analytics\manager::cleanup();
$this->assertEmpty($DB->count_records('analytics_predictions', array('contextid' => $predictioncontextid)));
$this->assertEmpty($DB->count_records('analytics_prediction_actions',
array('predictionid' => $prediction->get_prediction_data()->id)));
$this->assertEmpty($DB->count_records('analytics_indicator_calc', array('contextid' => $predictioncontextid)));
$this->assertEmpty($DB->count_records('analytics_predictions', ['contextid' => $predictioncontextid]));
$this->assertEmpty($DB->count_records(
'analytics_prediction_actions',
['predictionid' => $prediction->get_prediction_data()->id]
));
$this->assertEmpty($DB->count_records('analytics_indicator_calc', ['contextid' => $predictioncontextid]));
set_config('enabled_stores', '', 'tool_log');
get_log_manager(true);
@@ -111,7 +120,7 @@ class manager_test extends \advanced_testcase {
set_config('enabled_stores', 'logstore_standard', 'tool_log');
$target = \core_analytics\manager::get_target('test_target_course_level_shortname');
$indicators = array('test_indicator_max', 'test_indicator_min', 'test_indicator_fullname');
$indicators = ['test_indicator_max', 'test_indicator_min', 'test_indicator_fullname'];
foreach ($indicators as $key => $indicator) {
$indicators[$key] = \core_analytics\manager::get_indicator($indicator);
}
@@ -119,10 +128,10 @@ class manager_test extends \advanced_testcase {
$model = \core_analytics\model::create($target, $indicators);
$modelobj = $model->get_model_obj();
$coursepredict1 = $this->getDataGenerator()->create_course(array('visible' => 0));
$coursepredict2 = $this->getDataGenerator()->create_course(array('visible' => 0));
$coursetrain1 = $this->getDataGenerator()->create_course(array('visible' => 1));
$coursetrain2 = $this->getDataGenerator()->create_course(array('visible' => 1));
$coursepredict1 = $this->getDataGenerator()->create_course(['visible' => 0]);
$coursepredict2 = $this->getDataGenerator()->create_course(['visible' => 0]);
$coursetrain1 = $this->getDataGenerator()->create_course(['visible' => 1]);
$coursetrain2 = $this->getDataGenerator()->create_course(['visible' => 1]);
$model->enable('\core\analytics\time_splitting\no_splitting');
@@ -139,9 +148,9 @@ class manager_test extends \advanced_testcase {
\core_analytics\manager::cleanup();
$this->assertEmpty($DB->count_records('analytics_predict_samples', array('analysableid' => $coursepredict1->id)));
$this->assertEmpty($DB->count_records('analytics_train_samples', array('analysableid' => $coursepredict1->id)));
$this->assertEmpty($DB->count_records('analytics_used_analysables', array('analysableid' => $coursepredict1->id)));
$this->assertEmpty($DB->count_records('analytics_predict_samples', ['analysableid' => $coursepredict1->id]));
$this->assertEmpty($DB->count_records('analytics_train_samples', ['analysableid' => $coursepredict1->id]));
$this->assertEmpty($DB->count_records('analytics_used_analysables', ['analysableid' => $coursepredict1->id]));
set_config('enabled_stores', '', 'tool_log');
get_log_manager(true);
@@ -190,7 +199,7 @@ class manager_test extends \advanced_testcase {
$this->resetAfterTest();
// This is expected to run without an exception.
$models = $this->load_models_from_fixture_file('no_teaching');
$models = self::load_models_from_fixture_file('no_teaching');
\core_analytics\manager::validate_models_declaration($models);
}
@@ -214,34 +223,34 @@ class manager_test extends \advanced_testcase {
*
* @return array of (string)testcase => [(array)models, (string)expected exception message]
*/
public function validate_models_declaration_exceptions_provider() {
public static function validate_models_declaration_exceptions_provider(): array {
return [
'missing_target' => [
$this->load_models_from_fixture_file('missing_target'),
self::load_models_from_fixture_file('missing_target'),
'Missing target declaration',
],
'invalid_target' => [
$this->load_models_from_fixture_file('invalid_target'),
self::load_models_from_fixture_file('invalid_target'),
'Invalid target classname',
],
'missing_indicators' => [
$this->load_models_from_fixture_file('missing_indicators'),
self::load_models_from_fixture_file('missing_indicators'),
'Missing indicators declaration',
],
'invalid_indicators' => [
$this->load_models_from_fixture_file('invalid_indicators'),
self::load_models_from_fixture_file('invalid_indicators'),
'Invalid indicator classname',
],
'invalid_time_splitting' => [
$this->load_models_from_fixture_file('invalid_time_splitting'),
self::load_models_from_fixture_file('invalid_time_splitting'),
'Invalid time splitting classname',
],
'invalid_time_splitting_fq' => [
$this->load_models_from_fixture_file('invalid_time_splitting_fq'),
self::load_models_from_fixture_file('invalid_time_splitting_fq'),
'Expecting fully qualified time splitting classname',
],
'invalid_enabled' => [
$this->load_models_from_fixture_file('invalid_enabled'),
self::load_models_from_fixture_file('invalid_enabled'),
'Cannot enable a model without time splitting method specified',
],
];
@@ -253,12 +262,12 @@ class manager_test extends \advanced_testcase {
* @param string $filename
* @return array
*/
protected function load_models_from_fixture_file(string $filename) {
protected static function load_models_from_fixture_file(string $filename) {
global $CFG;
$models = null;
require($CFG->dirroot.'/analytics/tests/fixtures/db_analytics_php/'.$filename.'.php');
require("{$CFG->dirroot}/analytics/tests/fixtures/db_analytics_php/{$filename}.php");
return $models;
}
@@ -430,9 +439,9 @@ class manager_test extends \advanced_testcase {
*/
public function test_model_declaration_identifier() {
$noteaching1 = $this->load_models_from_fixture_file('no_teaching');
$noteaching2 = $this->load_models_from_fixture_file('no_teaching');
$noteaching3 = $this->load_models_from_fixture_file('no_teaching');
$noteaching1 = self::load_models_from_fixture_file('no_teaching');
$noteaching2 = self::load_models_from_fixture_file('no_teaching');
$noteaching3 = self::load_models_from_fixture_file('no_teaching');
// Same model declaration should always lead to same identifier.
$this->assertEquals(
@@ -474,9 +483,9 @@ class manager_test extends \advanced_testcase {
public function test_get_declared_target_and_indicators_instances() {
$this->resetAfterTest();
$definition = $this->load_models_from_fixture_file('no_teaching');
$definition = self::load_models_from_fixture_file('no_teaching');
list($target, $indicators) = \core_analytics\manager::get_declared_target_and_indicators_instances($definition[0]);
[$target, $indicators] = \core_analytics\manager::get_declared_target_and_indicators_instances($definition[0]);
$this->assertTrue($target instanceof \core_analytics\local\target\base);
$this->assertNotEmpty($indicators);
+1 -1
View File
@@ -111,7 +111,7 @@ class prediction_actions_test extends \advanced_testcase {
*
* @return array
*/
public function execute_actions_provider(): array {
public static function execute_actions_provider(): array {
return [
'Empty actions with no filter' => [
[],
+11 -13
View File
@@ -341,14 +341,14 @@ class prediction_test extends \advanced_testcase {
*
* @return array
*/
public function provider_ml_training_and_prediction() {
public static function provider_ml_training_and_prediction(): array {
$cases = array(
'no_splitting' => array('\core\analytics\time_splitting\no_splitting', 0, 1),
'quarters' => array('\core\analytics\time_splitting\quarters', 3, 4)
);
// We need to test all system prediction processors.
return $this->add_prediction_processors($cases);
return static::add_prediction_processors($cases);
}
/**
@@ -417,13 +417,13 @@ class prediction_test extends \advanced_testcase {
*
* @return array
*/
public function provider_ml_processors() {
public static function provider_ml_processors(): array {
$cases = [
'case' => [],
];
// We need to test all system prediction processors.
return $this->add_prediction_processors($cases);
return static::add_prediction_processors($cases);
}
/**
* Test the system classifiers returns.
@@ -507,7 +507,7 @@ class prediction_test extends \advanced_testcase {
*
* @return array
*/
public function provider_ml_classifiers_return() {
public static function provider_ml_classifiers_return(): array {
// Using verbose options as the first argument for readability.
$cases = array(
'1-samples' => array('maybe', 1, [0]),
@@ -517,7 +517,7 @@ class prediction_test extends \advanced_testcase {
);
// We need to test all system prediction processors.
return $this->add_prediction_processors($cases);
return static::add_prediction_processors($cases);
}
/**
@@ -581,13 +581,13 @@ class prediction_test extends \advanced_testcase {
*
* @return array
*/
public function provider_test_multi_classifier() {
public static function provider_test_multi_classifier(): array {
$cases = array(
'notimesplitting' => array('\core\analytics\time_splitting\no_splitting'),
);
// Add all system prediction processors.
return $this->add_prediction_processors($cases);
return static::add_prediction_processors($cases);
}
/**
@@ -777,8 +777,7 @@ class prediction_test extends \advanced_testcase {
*
* @return array
*/
public function provider_ml_test_evaluation_configuration() {
public static function provider_ml_test_evaluation_configuration(): array {
$cases = array(
'bad' => array(
'modelquality' => 'random',
@@ -797,7 +796,7 @@ class prediction_test extends \advanced_testcase {
)
)
);
return $this->add_prediction_processors($cases);
return static::add_prediction_processors($cases);
}
/**
@@ -955,8 +954,7 @@ class prediction_test extends \advanced_testcase {
* @param array $cases
* @return array
*/
protected function add_prediction_processors($cases) {
protected static function add_prediction_processors($cases): array {
$return = array();
if (defined('TEST_MLBACKEND_PYTHON_HOST') && defined('TEST_MLBACKEND_PYTHON_PORT')
+1 -1
View File
@@ -45,7 +45,7 @@ class plugin_test extends \advanced_testcase {
*
* @return array[]
*/
public function auth_ldap_provider() {
public static function auth_ldap_provider(): array {
$pagesizes = [1, 3, 5, 1000];
$subcontexts = [0, 1];
$combinations = [];
+61 -58
View File
@@ -27,7 +27,7 @@ namespace auth_lti;
class auth_test extends \advanced_testcase {
/** @var string issuer URL used for test cases. */
protected $issuer = 'https://lms.example.org';
protected static string $issuer = 'https://lms.example.org';
/** @var int const representing cases where no PII is present. */
protected const PII_NONE = 0;
@@ -70,10 +70,13 @@ class auth_test extends \advanced_testcase {
* @param bool $includepicture whether to include a profile picture or not (slows tests, so defaults to false).
* @return array the users list.
*/
protected function get_mock_users_with_ids(array $ids,
string $role = 'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor', bool $includenames = true,
bool $includeemail = true, bool $includepicture = false): array {
protected static function get_mock_users_with_ids(
array $ids,
string $role = 'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor',
bool $includenames = true,
bool $includeemail = true,
bool $includepicture = false
): array {
$users = [];
foreach ($ids as $id) {
$user = [
@@ -91,7 +94,7 @@ class auth_test extends \advanced_testcase {
unset($user['email']);
}
if ($includepicture) {
$user['picture'] = $this->getExternalTestFileUrl('/test.jpg');
$user['picture'] = self::getExternalTestFileUrl('/test.jpg');
}
$users[] = $user;
}
@@ -137,7 +140,7 @@ class auth_test extends \advanced_testcase {
*/
protected function get_mock_launchdata_for_user(array $mockuser, array $mockmigration = []): array {
$data = [
'iss' => $this->issuer, // Must match registration in create_test_environment.
'iss' => self::$issuer, // Must match registration in create_test_environment.
'aud' => '123', // Must match registration in create_test_environment.
'sub' => $mockuser['user_id'], // User id on the platform site.
'exp' => time() + 60,
@@ -318,12 +321,12 @@ class auth_test extends \advanced_testcase {
*
* @return array the test case data.
*/
public function launch_data_provider(): array {
public static function launch_data_provider(): array {
return [
'New (unlinked) platform learner including PII, no legacy user, no migration claim' => [
'legacy_data' => null,
'launch_data' => [
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
@@ -336,7 +339,7 @@ class auth_test extends \advanced_testcase {
'New (unlinked) platform learner excluding names, no legacy user, no migration claim' => [
'legacy_data' => null,
'launch_data' => [
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner',
false
@@ -350,7 +353,7 @@ class auth_test extends \advanced_testcase {
'New (unlinked) platform learner excluding emails, no legacy user, no migration claim' => [
'legacy_data' => null,
'launch_data' => [
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner',
true,
@@ -365,7 +368,7 @@ class auth_test extends \advanced_testcase {
'New (unlinked) platform learner excluding all PII, no legacy user, no migration claim' => [
'legacy_data' => null,
'launch_data' => [
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner',
false,
@@ -389,7 +392,7 @@ class auth_test extends \advanced_testcase {
]
],
'launch_data' => [
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
@@ -419,7 +422,7 @@ class auth_test extends \advanced_testcase {
]
],
'launch_data' => [
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
@@ -442,7 +445,7 @@ class auth_test extends \advanced_testcase {
]
],
'launch_data' => [
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
@@ -472,7 +475,7 @@ class auth_test extends \advanced_testcase {
]
],
'launch_data' => [
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
@@ -502,7 +505,7 @@ class auth_test extends \advanced_testcase {
]
],
'launch_data' => [
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
@@ -532,7 +535,7 @@ class auth_test extends \advanced_testcase {
]
],
'launch_data' => [
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
@@ -562,7 +565,7 @@ class auth_test extends \advanced_testcase {
]
],
'launch_data' => [
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
@@ -591,7 +594,7 @@ class auth_test extends \advanced_testcase {
]
],
'launch_data' => [
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
@@ -621,7 +624,7 @@ class auth_test extends \advanced_testcase {
]
],
'launch_data' => [
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner',
false,
@@ -644,7 +647,7 @@ class auth_test extends \advanced_testcase {
'New (unlinked) platform instructor including PII, no legacy user, no migration claim' => [
'legacy_data' => null,
'launch_data' => [
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor'
)[0],
@@ -657,7 +660,7 @@ class auth_test extends \advanced_testcase {
'New (unlinked) platform instructor excluding PII, no legacy user, no migration claim' => [
'legacy_data' => null,
'launch_data' => [
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor',
false,
@@ -681,7 +684,7 @@ class auth_test extends \advanced_testcase {
]
],
'launch_data' => [
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor'
)[0],
@@ -703,7 +706,7 @@ class auth_test extends \advanced_testcase {
'legacy_data' => null,
'launch_data' => [
'has_authenticated_before' => true,
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
@@ -717,7 +720,7 @@ class auth_test extends \advanced_testcase {
'legacy_data' => null,
'launch_data' => [
'has_authenticated_before' => true,
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner',
false,
@@ -733,7 +736,7 @@ class auth_test extends \advanced_testcase {
'legacy_data' => null,
'launch_data' => [
'has_authenticated_before' => true,
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor'
)[0],
@@ -747,7 +750,7 @@ class auth_test extends \advanced_testcase {
'legacy_data' => null,
'launch_data' => [
'has_authenticated_before' => true,
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor',
false,
@@ -763,7 +766,7 @@ class auth_test extends \advanced_testcase {
'legacy_data' => null,
'launch_data' => [
'has_authenticated_before' => false,
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor',
false,
@@ -886,17 +889,17 @@ class auth_test extends \advanced_testcase {
*
* @return array the test case data.
*/
public function membership_data_provider(): array {
public static function membership_data_provider(): array {
return [
'New (unlinked) platform learner including PII, no legacy data, no consumer key bound, no legacy id' => [
'legacy_data' => null,
'membership_data' => [
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
],
'iss' => $this->issuer,
'iss' => self::$issuer,
'legacy_consumer_key' => null,
'expected' => [
'PII' => self::PII_ALL,
@@ -906,14 +909,14 @@ class auth_test extends \advanced_testcase {
'New (unlinked) platform learner excluding PII, no legacy data, no consumer key bound, no legacy id' => [
'legacy_data' => null,
'membership_data' => [
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner',
false,
false
)[0],
],
'iss' => $this->issuer,
'iss' => self::$issuer,
'legacy_consumer_key' => null,
'expected' => [
'PII' => self::PII_NONE,
@@ -923,13 +926,13 @@ class auth_test extends \advanced_testcase {
'New (unlinked) platform learner excluding names, no legacy data, no consumer key bound, no legacy id' => [
'legacy_data' => null,
'membership_data' => [
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner',
false,
)[0],
],
'iss' => $this->issuer,
'iss' => self::$issuer,
'legacy_consumer_key' => null,
'expected' => [
'PII' => self::PII_EMAILS_ONLY,
@@ -939,14 +942,14 @@ class auth_test extends \advanced_testcase {
'New (unlinked) platform learner excluding email, no legacy data, no consumer key bound, no legacy id' => [
'legacy_data' => null,
'membership_data' => [
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner',
true,
false
)[0],
],
'iss' => $this->issuer,
'iss' => self::$issuer,
'legacy_consumer_key' => null,
'expected' => [
'PII' => self::PII_NAMES_ONLY,
@@ -961,13 +964,13 @@ class auth_test extends \advanced_testcase {
'consumer_key' => 'CONSUMER_1',
],
'membership_data' => [
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
'legacy_user_id' => '123-abc'
],
'iss' => $this->issuer,
'iss' => self::$issuer,
'legacy_consumer_key' => 'CONSUMER_1',
'expected' => [
'PII' => self::PII_ALL,
@@ -982,12 +985,12 @@ class auth_test extends \advanced_testcase {
'consumer_key' => 'CONSUMER_1',
],
'membership_data' => [
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
],
'iss' => $this->issuer,
'iss' => self::$issuer,
'legacy_consumer_key' => 'CONSUMER_1',
'expected' => [
'PII' => self::PII_ALL,
@@ -1002,12 +1005,12 @@ class auth_test extends \advanced_testcase {
'consumer_key' => 'CONSUMER_1',
],
'membership_data' => [
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['123-abc'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
],
'iss' => $this->issuer,
'iss' => self::$issuer,
'legacy_consumer_key' => 'CONSUMER_1',
'expected' => [
'PII' => self::PII_ALL,
@@ -1022,12 +1025,12 @@ class auth_test extends \advanced_testcase {
'consumer_key' => 'CONSUMER_1',
],
'membership_data' => [
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['123-abc'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
],
'iss' => $this->issuer,
'iss' => self::$issuer,
'legacy_consumer_key' => 'CONSUMER_ABCDEF',
'expected' => [
'PII' => self::PII_ALL,
@@ -1042,13 +1045,13 @@ class auth_test extends \advanced_testcase {
'consumer_key' => 'CONSUMER_1',
],
'membership_data' => [
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
'legacy_user_id' => '123-abc'
],
'iss' => $this->issuer,
'iss' => self::$issuer,
'legacy_consumer_key' => null,
'expected' => [
'PII' => self::PII_ALL,
@@ -1058,13 +1061,13 @@ class auth_test extends \advanced_testcase {
'New (unlinked) platform learner including PII, no legacy data, consumer key bound, legacy user id sent' => [
'legacy_data' => null,
'membership_data' => [
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
'legacy_user_id' => '123-abc'
],
'iss' => $this->issuer,
'iss' => self::$issuer,
'legacy_consumer_key' => 'CONSUMER_1',
'expected' => [
'PII' => self::PII_ALL,
@@ -1074,12 +1077,12 @@ class auth_test extends \advanced_testcase {
'New (unlinked) platform instructor including PII, no legacy data, no consumer key bound, no legacy id' => [
'legacy_data' => null,
'membership_data' => [
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor'
)[0],
],
'iss' => $this->issuer,
'iss' => self::$issuer,
'legacy_consumer_key' => null,
'expected' => [
'PII' => self::PII_ALL,
@@ -1089,14 +1092,14 @@ class auth_test extends \advanced_testcase {
'New (unlinked) platform instructor excluding PII, no legacy data, no consumer key bound, no legacy id' => [
'legacy_data' => null,
'membership_data' => [
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor',
false,
false
)[0],
],
'iss' => $this->issuer,
'iss' => self::$issuer,
'legacy_consumer_key' => null,
'expected' => [
'PII' => self::PII_NONE,
@@ -1107,12 +1110,12 @@ class auth_test extends \advanced_testcase {
'legacy_data' => null,
'launch_data' => [
'has_authenticated_before' => true,
'user' => $this->get_mock_users_with_ids(
'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
],
'iss' => $this->issuer,
'iss' => self::$issuer,
'legacy_consumer_key' => null,
'expected' => [
'PII' => self::PII_ALL,
@@ -1132,7 +1135,7 @@ class auth_test extends \advanced_testcase {
global $DB;
$auth = get_auth_plugin('lti');
$user = $this->getDataGenerator()->create_user();
$mockiss = $this->issuer;
$mockiss = self::$issuer;
$mocksub = '1';
// Create a binding and verify it exists.
@@ -1144,7 +1147,7 @@ class auth_test extends \advanced_testcase {
$numusersbefore = $DB->count_records('user');
$matcheduser = $auth->find_or_create_user_from_launch(
$this->get_mock_launchdata_for_user(
$this->get_mock_users_with_ids([$mocksub])[0]
self::get_mock_users_with_ids([$mocksub])[0]
)
);
$numusersafter = $DB->count_records('user');
@@ -469,7 +469,7 @@ class condition_test extends \advanced_testcase {
$this->assertMatchesRegularExpression($description, $information);
}
public function previous_activity_data(): array {
public static function previous_activity_data(): array {
// Assign grade, condition, activity to complete, activity to test, result, resultnot, description.
return [
'Missing previous activity complete' => [
@@ -634,7 +634,7 @@ class condition_test extends \advanced_testcase {
}
public function section_previous_activity_data(): array {
public static function section_previous_activity_data(): array {
return [
// Condition, Activity completion, section to test, result, resultnot, description.
'Completion complete Section with no previous activity' => [
@@ -49,7 +49,7 @@ class backup_xml_transformer_test extends \advanced_testcase {
*
* @return array
*/
public function filephp_links_replace_data_provider() {
public static function filephp_links_replace_data_provider(): array {
return array(
array('http://test.test/', 'http://test.test/'),
array('http://test.test/file.php/1', 'http://test.test/file.php/1'),
@@ -37,12 +37,13 @@ class restore_gradebook_structure_step_test extends \advanced_testcase {
*
* @return array
*/
public function rewrite_step_backup_file_for_legacy_freeze_provider() {
public static function rewrite_step_backup_file_for_legacy_freeze_provider(): array {
$fixturesdir = realpath(__DIR__ . '/fixtures/rewrite_step_backup_file_for_legacy_freeze/');
$tests = [];
$iterator = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator($fixturesdir),
\RecursiveIteratorIterator::LEAVES_ONLY);
new \RecursiveDirectoryIterator($fixturesdir),
\RecursiveIteratorIterator::LEAVES_ONLY,
);
foreach ($iterator as $sourcefile) {
$pattern = '/\.test$/';
@@ -124,8 +124,7 @@ class restore_dbops_test extends \advanced_testcase {
/**
* Data provider for {@link test_precheck_user()}
*/
public function precheck_user_provider() {
public static function precheck_user_provider(): array {
$emailmultiplier = [
'shortmail' => 'normalusername@example.com',
'longmail' => str_repeat('a', 100) // It's not validated, hence any string is ok.
@@ -135,7 +134,7 @@ class restore_dbops_test extends \advanced_testcase {
foreach ($emailmultiplier as $emailk => $email) {
// Get the related cases.
$cases = $this->precheck_user_cases($email);
$cases = self::precheck_user_cases($email);
// Rename them (keys).
foreach ($cases as $key => $case) {
$providercases[$key . ' - ' . $emailk] = $case;
@@ -150,7 +149,7 @@ class restore_dbops_test extends \advanced_testcase {
*
* @param string $email
*/
private function precheck_user_cases($email) {
private static function precheck_user_cases($email) {
global $CFG;
$baseuserarr = [
@@ -53,7 +53,7 @@ class restore_structure_parser_processor_test extends advanced_testcase {
*
* @return array
*/
public function process_cdata_data_provider() {
public static function process_cdata_data_provider(): array {
return array(
array(null, null, true),
array("$@NULL@$", null, true),
+8 -8
View File
@@ -470,7 +470,7 @@ class badgeslib_test extends advanced_testcase {
}
public function data_for_message_from_template() {
public static function data_for_message_from_template(): array {
return array(
array(
'This is a message with no variables',
@@ -1173,7 +1173,7 @@ class badgeslib_test extends advanced_testcase {
*
* @return array
*/
public function save_backpack_credentials_provider(): array {
public static function save_backpack_credentials_provider(): array {
return [
'Empty fields' => [
false,
@@ -1241,7 +1241,7 @@ class badgeslib_test extends advanced_testcase {
*
* @return array
*/
public function badges_save_external_backpack_provider() {
public static function badges_save_external_backpack_provider(): array {
$data = [
'apiversion' => 2,
'backpackapiurl' => 'https://api.ca.badgr.io/v2',
@@ -1358,7 +1358,7 @@ class badgeslib_test extends advanced_testcase {
/**
* Provider for test_badges_(create/update)_site_backpack
*/
public function badges_create_site_backpack_provider() {
public static function badges_create_site_backpack_provider(): array {
return [
"Test as admin user - creation test" => [true, true],
"Test as admin user - update test" => [true, false],
@@ -1529,7 +1529,7 @@ class badgeslib_test extends advanced_testcase {
*
* @return array
*/
public function badges_get_site_primary_backpack_provider() {
public static function badges_get_site_primary_backpack_provider(): array {
return [
"Test with auth details" => [true],
"Test without auth details" => [false],
@@ -1584,7 +1584,7 @@ class badgeslib_test extends advanced_testcase {
*
* @return array
*/
public function badges_change_sortorder_backpacks_provider(): array {
public static function badges_change_sortorder_backpacks_provider(): array {
return [
"Test up" => [
'backpacktomove' => 1,
@@ -1638,7 +1638,7 @@ class badgeslib_test extends advanced_testcase {
* Data provider for test_badges_generate_badgr_open_url
* @return array
*/
public function badgr_open_url_generator() {
public static function badgr_open_url_generator(): array {
return [
'Badgr Assertion URL test' => [
OPEN_BADGES_V2_TYPE_ASSERTION, "https://api.ca.badgr.io/public/assertions/123455"
@@ -1685,7 +1685,7 @@ class badgeslib_test extends advanced_testcase {
*
* @return array
*/
public function badges_external_get_mapping_provider() {
public static function badges_external_get_mapping_provider(): array {
return [
"Get the site backpack value" => [
1234, 4321, 'id', 'sitebackpackid'
@@ -36,7 +36,7 @@ class manage_badge_action_bar_test extends \advanced_testcase {
*
* @return array
*/
public function generate_badge_navigation_provider(): array {
public static function generate_badge_navigation_provider(): array {
return [
"Test tertiary nav as an editing teacher" => [
"editingteacher", [
+7 -7
View File
@@ -1,22 +1,22 @@
.block_accessreview_success,
.block_accessreview.block_accessreview_success.hasinfo {
color: #1e451e;
background: #d7e6d7;
border-color: #c8ddc8;
background: #eff5ef;
box-shadow: 0 0 2px 2px #619a61;
}
.block_accessreview_danger,
.block_accessreview.block_accessreview_danger.hasinfo {
color: #6e211e;
background: #f6d9d8;
border-color: #f3c9c8;
background: #fdf7f7;
box-shadow: 0 0 2px 2px #da6960;
}
.block_accessreview_warning,
.block_accessreview.block_accessreview_warning.hasinfo {
color: #7d5a29;
background: #fcefdc;
border-color: #fbe8cd;
color: #694b21;
background: #fdf2e3;
box-shadow: 0 0 2px 2px #c97a0e;
}
.block_accessreview_table {
@@ -71,7 +71,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
*
* @return array Array of valid user preferences.
*/
public function user_preference_provider() {
public static function user_preference_provider(): array {
return array(
array('block_myoverview_user_sort_preference', 'lastaccessed', ''),
array('block_myoverview_user_sort_preference', 'title', ''),
+12 -1
View File
@@ -180,7 +180,18 @@ $PAGE->set_pagelayout('admin');
if ($rssid) {
$isadding = false;
$rssrecord = $DB->get_record('block_rss_client', array('id' => $rssid), '*', MUST_EXIST);
if ($managesharedfeeds) {
$select = 'id = :id AND (userid = :userid OR shared = 1)';
} else {
$select = 'id = :id AND userid = :userid';
}
$rssrecord = $DB->get_record_select('block_rss_client', $select, [
'id' => $rssid,
'userid' => $USER->id,
], '*', MUST_EXIST);
} else {
$isadding = true;
$rssrecord = new stdClass;
+14 -7
View File
@@ -61,20 +61,27 @@ if ($returnurl) {
$baseurl = new moodle_url('/blocks/rss_client/managefeeds.php', $urlparams);
$PAGE->set_url($baseurl);
if ($managesharedfeeds) {
$select = '(userid = :userid OR shared = 1)';
} else {
$select = 'userid = :userid';
}
// Process any actions
if ($deleterssid && confirm_sesskey()) {
$DB->delete_records('block_rss_client', array('id'=>$deleterssid));
$deleterssid = $DB->get_field_select('block_rss_client', 'id', "id = :id AND {$select}", [
'id' => $deleterssid,
'userid' => $USER->id
], MUST_EXIST);
$DB->delete_records('block_rss_client', ['id' => $deleterssid]);
redirect($PAGE->url, get_string('feeddeleted', 'block_rss_client'));
}
// Display the list of feeds.
if ($managesharedfeeds) {
$select = '(userid = ' . $USER->id . ' OR shared = 1)';
} else {
$select = 'userid = ' . $USER->id;
}
$feeds = $DB->get_records_select('block_rss_client', $select, null, $DB->sql_order_by_text('title'));
$feeds = $DB->get_records_select('block_rss_client', $select, ['userid' => $USER->id], $DB->sql_order_by_text('title'));
$strmanage = get_string('managefeeds', 'block_rss_client');
+1 -1
View File
@@ -67,7 +67,7 @@ class cron_test extends \advanced_testcase {
*
* @return array
*/
public function skip_time_increase_provider() : array {
public static function skip_time_increase_provider(): array {
return [
'Never failed' => [
'skiptime' => 0,
@@ -76,7 +76,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
*
* @return array Array of valid user preferences.
*/
public function user_preference_provider() {
public static function user_preference_provider(): array {
return array(
array('block_timeline_user_sort_preference', 'sortbydates', ''),
array('block_timeline_user_sort_preference', 'sortbycourses', ''),
@@ -140,7 +140,7 @@ class blogs_test extends core_reportbuilder_testcase {
*
* @return array[]
*/
public function datasource_filters_provider(): array {
public static function datasource_filters_provider(): array {
return [
'Filter title' => ['subject', 'Cool', 'blog:title', [
'blog:title_operator' => text::CONTAINS,
+3 -3
View File
@@ -105,7 +105,7 @@ class compressor_test extends \advanced_testcase {
*
* @return array
*/
public function provider_for_test_it_works_with_different_types() {
public static function provider_for_test_it_works_with_different_types(): array {
$object = new \stdClass();
$object->field = 'value';
@@ -147,7 +147,7 @@ class compressor_test extends \advanced_testcase {
public function test_it_works_with_different_types_for_many() {
$store = $this->create_store(cachestore_redis::COMPRESSOR_PHP_GZIP, \Redis::SERIALIZER_PHP);
$provider = $this->provider_for_test_it_works_with_different_types();
$provider = self::provider_for_test_it_works_with_different_types();
$keys = [];
$values = [];
$expected = [];
@@ -166,7 +166,7 @@ class compressor_test extends \advanced_testcase {
*
* @return array
*/
public function provider_for_tests_setget() {
public static function provider_for_tests_setget(): array {
if (!cachestore_redis::are_requirements_met()) {
// Even though we skip all tests in this case, this provider can still show warnings about non-existing class.
return [];
+2 -2
View File
@@ -45,7 +45,7 @@ class action_event_test extends \advanced_testcase {
/**
* Test event class getters.
*
* @dataProvider getters_testcases()
* @dataProvider getters_testcases
* @param array $constructorparams Associative array of constructor parameters.
*/
public function test_getters($constructorparams) {
@@ -64,7 +64,7 @@ class action_event_test extends \advanced_testcase {
/**
* Test cases for getters test.
*/
public function getters_testcases() {
public static function getters_testcases(): array {
return [
'Dataset 1' => [
'constructorparams' => [
+2 -2
View File
@@ -29,7 +29,7 @@ class action_test extends \advanced_testcase {
/**
* Test action class getters.
*
* @dataProvider getters_testcases()
* @dataProvider getters_testcases
* @param array $constructorparams Associative array of constructor parameters.
*/
public function test_getters($constructorparams) {
@@ -52,7 +52,7 @@ class action_test extends \advanced_testcase {
/**
* Test cases for getters test.
*/
public function getters_testcases() {
public static function getters_testcases(): array {
return [
'Dataset 1' => [
'constructorparams' => [
@@ -34,7 +34,7 @@ class calendar_event_exporter_test extends \advanced_testcase {
* Data provider for the timestamp min limit test case to confirm
* that the minimum time limit is set correctly on the boundary cases.
*/
public function get_timestamp_min_limit_test_cases() {
public static function get_timestamp_min_limit_test_cases(): array {
$now = time();
$todaymidnight = usergetmidnight($now);
$tomorrowmidnight = $todaymidnight + DAYSECS;
@@ -70,7 +70,7 @@ class calendar_event_exporter_test extends \advanced_testcase {
}
/**
* @dataProvider get_timestamp_min_limit_test_cases()
* @dataProvider get_timestamp_min_limit_test_cases
*/
public function test_get_timestamp_min_limit($starttime, $min, $expected) {
$class = calendar_event_exporter::class;
@@ -91,7 +91,7 @@ class calendar_event_exporter_test extends \advanced_testcase {
* Data provider for the timestamp max limit test case to confirm
* that the maximum time limit is set correctly on the boundary cases.
*/
public function get_timestamp_max_limit_test_cases() {
public static function get_timestamp_max_limit_test_cases(): array {
$now = time();
$todaymidnight = usergetmidnight($now);
$yesterdaymidnight = $todaymidnight - DAYSECS;
@@ -127,7 +127,7 @@ class calendar_event_exporter_test extends \advanced_testcase {
}
/**
* @dataProvider get_timestamp_max_limit_test_cases()
* @dataProvider get_timestamp_max_limit_test_cases
*/
public function test_get_timestamp_max_limit($starttime, $max, $expected) {
$class = calendar_event_exporter::class;
+6 -6
View File
@@ -67,7 +67,7 @@ class container_test extends \advanced_testcase {
/**
* Test that the event factory correctly creates instances of events.
*
* @dataProvider get_event_factory_testcases()
* @dataProvider get_event_factory_testcases
* @param \stdClass $dbrow Row from the "database".
*/
public function test_event_factory_create_instance($dbrow) {
@@ -128,7 +128,7 @@ class container_test extends \advanced_testcase {
/**
* Test that the event factory deals with invisible modules properly as admin.
*
* @dataProvider get_event_factory_testcases()
* @dataProvider get_event_factory_testcases
* @param \stdClass $dbrow Row from the "database".
*/
public function test_event_factory_when_module_visibility_is_toggled_as_admin($dbrow) {
@@ -154,7 +154,7 @@ class container_test extends \advanced_testcase {
/**
* Test that the event factory deals with invisible modules properly as a guest.
*
* @dataProvider get_event_factory_testcases()
* @dataProvider get_event_factory_testcases
* @param \stdClass $dbrow Row from the "database".
*/
public function test_event_factory_when_module_visibility_is_toggled_as_guest($dbrow) {
@@ -183,7 +183,7 @@ class container_test extends \advanced_testcase {
/**
* Test that the event factory deals with invisible courses as an admin.
*
* @dataProvider get_event_factory_testcases()
* @dataProvider get_event_factory_testcases
* @param \stdClass $dbrow Row from the "database".
*/
public function test_event_factory_when_course_visibility_is_toggled_as_admin($dbrow) {
@@ -208,7 +208,7 @@ class container_test extends \advanced_testcase {
/**
* Test that the event factory deals with invisible courses as a student.
*
* @dataProvider get_event_factory_testcases()
* @dataProvider get_event_factory_testcases
* @param \stdClass $dbrow Row from the "database".
*/
public function test_event_factory_when_course_visibility_is_toggled_as_student($dbrow) {
@@ -504,7 +504,7 @@ class container_test extends \advanced_testcase {
/**
* Test cases for the get event factory test.
*/
public function get_event_factory_testcases() {
public static function get_event_factory_testcases(): array {
return [
'Data set 1' => [
'dbrow' => (object)[
+2 -2
View File
@@ -29,7 +29,7 @@ class event_description_test extends \advanced_testcase {
/**
* Test event description class getters.
*
* @dataProvider getters_testcases()
* @dataProvider getters_testcases
* @param array $constructorparams Associative array of constructor parameters.
*/
public function test_getters($constructorparams) {
@@ -45,7 +45,7 @@ class event_description_test extends \advanced_testcase {
/**
* Test cases for getters test.
*/
public function getters_testcases() {
public static function getters_testcases(): array {
return [
'Dataset 1' => [
'constructorparams' => [
+2 -2
View File
@@ -35,7 +35,7 @@ class event_factory_test extends \advanced_testcase {
/**
* Test event class getters.
*
* @dataProvider create_instance_testcases()
* @dataProvider create_instance_testcases
* @param \stdClass $dbrow Row from the event table.
* @param callable $actioncallbackapplier Action callback applier.
* @param callable $visibilitycallbackapplier Visibility callback applier.
@@ -343,7 +343,7 @@ class event_factory_test extends \advanced_testcase {
*
* @return array Array of testcases.
*/
public function create_instance_testcases() {
public static function create_instance_testcases(): array {
return [
'Sample event record with event exposed' => [
'dbrow' => (object)[
+2 -2
View File
@@ -36,7 +36,7 @@ class event_test extends \advanced_testcase {
/**
* Test event class getters.
*
* @dataProvider getters_testcases()
* @dataProvider getters_testcases
* @param array $constructorparams Associative array of constructor parameters.
*/
public function test_getters($constructorparams) {
@@ -71,7 +71,7 @@ class event_test extends \advanced_testcase {
/**
* Test cases for getters test.
*/
public function getters_testcases() {
public static function getters_testcases(): array {
$lamecallable = function($id) {
return (object)['id' => $id, 'modname' => 'assign'];
};
+2 -2
View File
@@ -29,7 +29,7 @@ class event_times_test extends \advanced_testcase {
/**
* Test event times class getters.
*
* @dataProvider getters_testcases()
* @dataProvider getters_testcases
* @param array $constructorparams Associative array of constructor parameters.
*/
public function test_getters($constructorparams) {
@@ -51,7 +51,7 @@ class event_times_test extends \advanced_testcase {
/**
* Test cases for getters test.
*/
public function getters_testcases() {
public static function getters_testcases(): array {
return [
'Dataset 1' => [
'constructorparams' => [
+2 -2
View File
@@ -2795,7 +2795,7 @@ class externallib_test extends externallib_advanced_testcase {
*
* @return array
*/
public function get_calendar_event_by_id_prevent_read_other_users_events_data_provider(): array {
public static function get_calendar_event_by_id_prevent_read_other_users_events_data_provider(): array {
$syscontext = \context_system::instance();
$managerrole = 'manager';
return [
@@ -2866,7 +2866,7 @@ class externallib_test extends externallib_advanced_testcase {
*
* @return array
*/
public function edit_or_delete_other_users_events_data_provider(): array {
public static function edit_or_delete_other_users_events_data_provider(): array {
$syscontext = \context_system::instance();
$managerrole = 'manager';
return [
+1 -1
View File
@@ -1050,7 +1050,7 @@ class lib_test extends \advanced_testcase {
*
* @return array[]
*/
public function calendar_format_event_location_provider(): array {
public static function calendar_format_event_location_provider(): array {
return [
'Empty' => ['', ''],
'Text' => ['Barcelona', 'Barcelona'],
+2 -2
View File
@@ -115,7 +115,7 @@ class std_proxy_test extends \advanced_testcase {
/**
* Test cases for proxying test.
*/
public function proxy_testcases() {
public static function proxy_testcases(): array {
return [
'Object 1 member 1' => [
1,
@@ -153,7 +153,7 @@ class std_proxy_test extends \advanced_testcase {
/**
* Test cases for getting and setting tests.
*/
public function get_set_testcases() {
public static function get_set_testcases(): array {
return [
'Object 1' => [1],
'Object 2' => [5]
@@ -80,7 +80,7 @@ class cohorts_test extends core_reportbuilder_testcase {
*
* @return array[]
*/
public function cohorts_datasource_user_select_provider(): array {
public static function datasource_filters_provider(): array {
return [
['user01', 'Cohort01'],
['user02', 'Cohort02'],
@@ -93,7 +93,7 @@ class cohorts_test extends core_reportbuilder_testcase {
* @param string $username
* @param string $expectedcohort
*
* @dataProvider cohorts_datasource_user_select_provider
* @dataProvider datasource_filters_provider
*/
public function test_cohorts_datasource_user_select(string $username, string $expectedcohort): void {
$this->resetAfterTest();
@@ -123,7 +123,7 @@ class comments_test extends core_reportbuilder_testcase {
*
* @return array[]
*/
public function datasource_filters_provider(): array {
public static function datasource_filters_provider(): array {
return [
// Comment.
'Filter content' => ['comment:content', [
@@ -48,7 +48,7 @@ class activity_custom_completion_test extends advanced_testcase {
/**
* Data provider for test_get_overall_completion_state().
*/
public function overall_completion_state_provider(): array {
public static function overall_completion_state_provider(): array {
global $CFG;
require_once($CFG->libdir . '/completionlib.php');
return [
@@ -121,7 +121,7 @@ class activity_custom_completion_test extends advanced_testcase {
*
* @return array[]
*/
public function validate_rule_provider() {
public static function validate_rule_provider(): array {
return [
'Not defined' => [
false, true, coding_exception::class
+2 -2
View File
@@ -36,7 +36,7 @@ class bulk_update_test extends \advanced_testcase {
* Provider for test_bulk_form_submit_single
* @return array
*/
public function bulk_form_submit_single_provider() {
public static function bulk_form_submit_single_provider(): array {
return [
'assign-1' => ['assign', ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionsubmit' => 1]],
'assign-2' => ['assign', ['completion' => COMPLETION_TRACKING_MANUAL]],
@@ -171,7 +171,7 @@ class bulk_update_test extends \advanced_testcase {
* Provider for test_bulk_form_submit_multiple
* @return array
*/
public function bulk_form_submit_multiple_provider() {
public static function bulk_form_submit_multiple_provider(): array {
return [
'Several modules with the same module type (choice)' => [
[
@@ -104,7 +104,7 @@ class cm_completion_details_test extends advanced_testcase {
*
* @return array[]
*/
public function has_completion_provider(): array {
public static function has_completion_provider(): array {
return [
'Automatic' => [
COMPLETION_TRACKING_AUTOMATIC, true
@@ -136,7 +136,7 @@ class cm_completion_details_test extends advanced_testcase {
*
* @return array[]
*/
public function is_automatic_provider(): array {
public static function is_automatic_provider(): array {
return [
'Automatic' => [
COMPLETION_TRACKING_AUTOMATIC, true
@@ -167,7 +167,7 @@ class cm_completion_details_test extends advanced_testcase {
* Data provider for test_get_overall_completion().
* @return array[]
*/
public function overall_completion_provider(): array {
public static function overall_completion_provider(): array {
return [
'Complete' => [COMPLETION_COMPLETE],
'Incomplete' => [COMPLETION_INCOMPLETE],
@@ -190,7 +190,7 @@ class cm_completion_details_test extends advanced_testcase {
* Data provider for test_get_details().
* @return array[]
*/
public function get_details_provider() {
public static function get_details_provider(): array {
return [
'No completion tracking' => [
COMPLETION_TRACKING_NONE, null, null, null, []
@@ -350,7 +350,7 @@ class cm_completion_details_test extends advanced_testcase {
* Data provider for test_get_details_custom_order().
* @return array[]
*/
public function get_details_custom_order_provider() {
public static function get_details_custom_order_provider(): array {
return [
'Custom and view/grade standard conditions, view first and grade last' => [
true,
@@ -138,7 +138,7 @@ class content_h5p_test extends \advanced_testcase {
*
* @return array
*/
public function is_view_allowed_provider(): array {
public static function is_view_allowed_provider(): array {
return [
'Editing teacher with all libraries enabled' => [
'role' => 'editingteacher',
@@ -56,6 +56,7 @@ Feature: Content bank use editor feature
Then I click on "Edit" "link"
And I switch to "h5p-editor-iframe" class iframe
And I switch to the main frame
And I change viewport size to "800x1400"
And I click on "Cancel" "button"
And I should see "filltheblanks.h5p" in the "h2" "css_element"
+1 -1
View File
@@ -74,7 +74,7 @@ class content_test extends \advanced_testcase {
*
* @return array
*/
public function set_name_provider() {
public static function set_name_provider(): array {
return [
'Standard name' => ['New name', 'New name'],
'Name with digits' => ['Today is 17/04/2017', 'Today is 17/04/2017'],
+4 -4
View File
@@ -65,7 +65,7 @@ class contentbank_test extends advanced_testcase {
*
* @return array
*/
public function get_extension_provider() {
public static function get_extension_provider(): array {
return [
'H5P file' => ['something.h5p', '.h5p'],
'PDF file' => ['something.pdf', '.pdf']
@@ -95,7 +95,7 @@ class contentbank_test extends advanced_testcase {
*
* @return array
*/
public function get_extension_supporters_provider() {
public static function get_extension_supporters_provider(): array {
return [
'H5P first' => [['.h5p' => ['h5p', 'testable']], '.h5p', 'h5p'],
'Testable first (but upload not implemented)' => [['.h5p' => ['testable', 'h5p']], '.h5p', 'h5p'],
@@ -259,7 +259,7 @@ class contentbank_test extends advanced_testcase {
*
* @return array
*/
public function search_contents_provider(): array {
public static function search_contents_provider(): array {
return [
'Search all content in all contexts' => [
@@ -519,7 +519,7 @@ class contentbank_test extends advanced_testcase {
*
* @return array
*/
public function get_contenttypes_with_capability_feature_provider(): array {
public static function get_contenttypes_with_capability_feature_provider(): array {
return [
'no-contenttypes_enabled' => [
'contenttypesenabled' => [],
+2 -2
View File
@@ -245,7 +245,7 @@ class contenttype_test extends \advanced_testcase {
*
* @return array
*/
public function upload_content_provider() {
public static function upload_content_provider(): array {
return [
'With record' => [true],
'Without record' => [false],
@@ -454,7 +454,7 @@ class contenttype_test extends \advanced_testcase {
*
* @return array
*/
public function rename_content_provider() {
public static function rename_content_provider(): array {
return [
'Standard name' => ['New name', 'New name', true],
'Name with digits' => ['Today is 17/04/2017', 'Today is 17/04/2017', true],
+1 -1
View File
@@ -50,7 +50,7 @@ class rename_content_test extends \externallib_advanced_testcase {
*
* @return array
*/
public function rename_content_provider() {
public static function rename_content_provider(): array {
return [
'Standard name' => ['New name', 'New name', true],
'Name with digits' => ['Today is 17/04/2017', 'Today is 17/04/2017', true],
+2 -2
View File
@@ -263,7 +263,7 @@ class base_test extends advanced_testcase {
*
* @return array the testing scenarios
*/
public function get_output_classname_provider(): array {
public static function get_output_classname_provider(): array {
return [
'overridden class' => [
'find' => 'state\\course',
@@ -498,7 +498,7 @@ class base_test extends advanced_testcase {
*
* @return array the testing scenarios
*/
public function delete_format_data_provider(): array {
public static function delete_format_data_provider(): array {
return [
'direct call' => [
'usehook' => false
+1 -1
View File
@@ -167,7 +167,7 @@ class get_state_test extends \externallib_advanced_testcase {
*
* @return array
*/
public function get_state_provider(): array {
public static function get_state_provider(): array {
return [
// ROLES. Testing behaviour depending on the user role calling the method.
'Admin user should work' => [
+1 -1
View File
@@ -104,7 +104,7 @@ class update_course_test extends \externallib_advanced_testcase {
*
* @return array of testing scenarios
*/
public function execute_course_state_provider(): array {
public static function execute_course_state_provider(): array {
return [
'Execute a core state action (cm_state)' => [
'format' => 'topics',
@@ -153,7 +153,7 @@ class cm_test extends \advanced_testcase {
*
* @return array
*/
public function hasrestrictions_state_provider(): array {
public static function hasrestrictions_state_provider(): array {
return [
// Teacher scenarios (topics).
'Teacher, Topics, can edit, has availability and is available' => [
@@ -145,7 +145,7 @@ class section_test extends \advanced_testcase {
*
* @return array
*/
public function hasrestrictions_state_provider(): array {
public static function hasrestrictions_state_provider(): array {
return [
// Teacher scenarios (topics).
'Teacher, Topics, can edit, has availability and is available' => [
@@ -142,7 +142,7 @@ class state_test extends \advanced_testcase {
*
* @return array
*/
public function state_provider(): array {
public static function state_provider(): array {
return [
// COURSEFORMAT. Test behaviour depending on course formats.
'Single activity format' => [
+27 -33
View File
@@ -28,8 +28,7 @@ use stdClass;
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @coversDefaultClass \core_courseformat\stateactions
*/
class stateactions_test extends \advanced_testcase {
final class stateactions_test extends \advanced_testcase {
/**
* Setup to ensure that fixtures are loaded.
*/
@@ -53,7 +52,6 @@ class stateactions_test extends \advanced_testcase {
int $section,
bool $visible = true
): int {
$activity = $this->getDataGenerator()->create_module(
$type,
['course' => $courseid],
@@ -188,7 +186,6 @@ class stateactions_test extends \advanced_testcase {
* @param array $params the ids, targetsection and targetcm to use as params
* @param array $expectedresults List of the course module names expected after calling the method.
* @param bool $expectedexception If this call will raise an exception.
*/
public function test_get_state(
string $format,
@@ -198,7 +195,6 @@ class stateactions_test extends \advanced_testcase {
array $expectedresults,
bool $expectedexception = false
): void {
$this->resetAfterTest();
// Create a course with 3 sections, 1 of them hidden.
@@ -266,29 +262,29 @@ class stateactions_test extends \advanced_testcase {
*
* @return array the testing scenarios
*/
public function get_state_provider(): array {
public static function get_state_provider(): array {
return array_merge(
$this->course_state_provider('weeks'),
$this->course_state_provider('topics'),
$this->course_state_provider('social'),
$this->section_state_provider('weeks', 'admin'),
$this->section_state_provider('weeks', 'editingteacher'),
$this->section_state_provider('weeks', 'student'),
$this->section_state_provider('topics', 'admin'),
$this->section_state_provider('topics', 'editingteacher'),
$this->section_state_provider('topics', 'student'),
$this->section_state_provider('social', 'admin'),
$this->section_state_provider('social', 'editingteacher'),
$this->section_state_provider('social', 'student'),
$this->cm_state_provider('weeks', 'admin'),
$this->cm_state_provider('weeks', 'editingteacher'),
$this->cm_state_provider('weeks', 'student'),
$this->cm_state_provider('topics', 'admin'),
$this->cm_state_provider('topics', 'editingteacher'),
$this->cm_state_provider('topics', 'student'),
$this->cm_state_provider('social', 'admin'),
$this->cm_state_provider('social', 'editingteacher'),
$this->cm_state_provider('social', 'student'),
static::course_state_provider('weeks'),
static::course_state_provider('topics'),
static::course_state_provider('social'),
static::section_state_provider('weeks', 'admin'),
static::section_state_provider('weeks', 'editingteacher'),
static::section_state_provider('weeks', 'student'),
static::section_state_provider('topics', 'admin'),
static::section_state_provider('topics', 'editingteacher'),
static::section_state_provider('topics', 'student'),
static::section_state_provider('social', 'admin'),
static::section_state_provider('social', 'editingteacher'),
static::section_state_provider('social', 'student'),
static::cm_state_provider('weeks', 'admin'),
static::cm_state_provider('weeks', 'editingteacher'),
static::cm_state_provider('weeks', 'student'),
static::cm_state_provider('topics', 'admin'),
static::cm_state_provider('topics', 'editingteacher'),
static::cm_state_provider('topics', 'student'),
static::cm_state_provider('social', 'admin'),
static::cm_state_provider('social', 'editingteacher'),
static::cm_state_provider('social', 'student'),
);
}
@@ -298,7 +294,7 @@ class stateactions_test extends \advanced_testcase {
* @param string $format the course format
* @return array the testing scenarios
*/
public function course_state_provider(string $format): array {
public static function course_state_provider(string $format): array {
$expectedexception = ($format === 'social');
return [
// Tests for course_state.
@@ -354,8 +350,7 @@ class stateactions_test extends \advanced_testcase {
* @param string $role the user role
* @return array the testing scenarios
*/
public function section_state_provider(string $format, string $role): array {
public static function section_state_provider(string $format, string $role): array {
// Social format will raise an exception and debug messages because it does not
// use sections and it does not provide a renderer.
$expectedexception = ($format === 'social');
@@ -483,8 +478,7 @@ class stateactions_test extends \advanced_testcase {
* @param string $role the user role
* @return array the testing scenarios
*/
public function cm_state_provider(string $format, string $role): array {
public static function cm_state_provider(string $format, string $role): array {
// All sections and cms that the user can access to.
$usersections = ['section0', 'section1', 'section2', 'section3'];
$usercms = ['cm0', 'cm1', 'cm2', 'cm3'];
@@ -850,7 +844,7 @@ class stateactions_test extends \advanced_testcase {
*
* @return array the testing scenarios
*/
public function basic_role_provider() {
public static function basic_role_provider(): array {
return [
'editingteacher' => [
'role' => 'editingteacher',
+11 -11
View File
@@ -81,7 +81,7 @@ class stateupdates_test extends \advanced_testcase {
*
* @return array testing scenarios
*/
public function add_course_put_provider() {
public static function add_course_put_provider(): array {
return [
'Admin role' => [
'admin',
@@ -199,11 +199,11 @@ class stateupdates_test extends \advanced_testcase {
*
* @return array testing scenarios
*/
public function add_section_provider(): array {
public static function add_section_provider(): array {
return array_merge(
$this->add_section_provider_helper('put'),
$this->add_section_provider_helper('create'),
$this->add_section_provider_helper('remove'),
self::add_section_provider_helper('put'),
self::add_section_provider_helper('create'),
self::add_section_provider_helper('remove'),
);
}
@@ -213,7 +213,7 @@ class stateupdates_test extends \advanced_testcase {
* @param string $action the action to perform
* @return array testing scenarios
*/
private function add_section_provider_helper(string $action): array {
private static function add_section_provider_helper(string $action): array {
// Delete does not depends on user permissions.
if ($action == 'remove') {
$studentsections = [0, 1, 2];
@@ -343,11 +343,11 @@ class stateupdates_test extends \advanced_testcase {
*
* @return array testing scenarios
*/
public function add_cm_provider(): array {
public static function add_cm_provider(): array {
return array_merge(
$this->add_cm_provider_helper('put'),
$this->add_cm_provider_helper('create'),
$this->add_cm_provider_helper('remove'),
self::add_cm_provider_helper('put'),
self::add_cm_provider_helper('create'),
self::add_cm_provider_helper('remove'),
);
}
@@ -357,7 +357,7 @@ class stateupdates_test extends \advanced_testcase {
* @param string $action the action to perform
* @return array testing scenarios
*/
private function add_cm_provider_helper(string $action): array {
private static function add_cm_provider_helper(string $action): array {
// Delete does not depends on user permissions.
if ($action == 'remove') {
$studentcms = [0, 1, 2, 3];
+1 -1
View File
@@ -1256,7 +1256,7 @@ class category_test extends \advanced_testcase {
*
* @return array
*/
public function get_nearest_editable_subcategory_provider(): array {
public static function get_nearest_editable_subcategory_provider(): array {
return [
'Hidden main category for manager. Checking create and manage' => [
0,
+18 -18
View File
@@ -636,7 +636,7 @@ class courselib_test extends advanced_testcase {
*
* @return array An array of arrays contain test data
*/
public function provider_course_delete_module() {
public static function provider_course_delete_module(): array {
$data = array();
$data['assign'] = array('assign', array('duedate' => time()));
@@ -801,7 +801,7 @@ class courselib_test extends advanced_testcase {
/**
* Relative dates mode settings provider for course creation.
*/
public function create_course_relative_dates_provider() {
public static function create_course_relative_dates_provider(): array {
return [
[0, 0, 0],
[0, 1, 0],
@@ -3590,7 +3590,7 @@ class courselib_test extends advanced_testcase {
*
* @return array
*/
public function course_enddate_provider() {
public static function course_enddate_provider(): array {
// Each provided example contains startdate, enddate and the expected exception error code if there is any.
return [
[
@@ -3672,7 +3672,7 @@ class courselib_test extends advanced_testcase {
*
* @return array
*/
public function course_dates_reset_provider() {
public static function course_dates_reset_provider(): array {
// Each example contains the following:
// - course startdate
@@ -4573,7 +4573,7 @@ class courselib_test extends advanced_testcase {
/**
* Test cases for the course_classify_courses_for_timeline test.
*/
public function get_course_classify_courses_for_timeline_test_cases() {
public static function get_course_classify_courses_for_timeline_test_cases(): array {
$now = time();
$day = 86400;
@@ -4684,7 +4684,7 @@ class courselib_test extends advanced_testcase {
/**
* Test the course_classify_courses_for_timeline function.
*
* @dataProvider get_course_classify_courses_for_timeline_test_cases()
* @dataProvider get_course_classify_courses_for_timeline_test_cases
* @param array $coursesdata Courses to create
* @param array $expected Expected test results.
*/
@@ -4726,7 +4726,7 @@ class courselib_test extends advanced_testcase {
/**
* Test cases for the course_get_enrolled_courses_for_logged_in_user tests.
*/
public function get_course_get_enrolled_courses_for_logged_in_user_test_cases() {
public static function get_course_get_enrolled_courses_for_logged_in_user_test_cases(): array {
$buildexpectedresult = function($limit, $offset) {
$result = [];
for ($i = $offset; $i < $offset + $limit; $i++) {
@@ -4814,7 +4814,7 @@ class courselib_test extends advanced_testcase {
/**
* Test the course_get_enrolled_courses_for_logged_in_user function.
*
* @dataProvider get_course_get_enrolled_courses_for_logged_in_user_test_cases()
* @dataProvider get_course_get_enrolled_courses_for_logged_in_user_test_cases
* @param int $dbquerylimit Number of records to load per DB request
* @param int $totalcourses Number of courses to create
* @param int $limit Maximum number of results to get.
@@ -4862,7 +4862,7 @@ class courselib_test extends advanced_testcase {
/**
* Test cases for the course_filter_courses_by_timeline_classification tests.
*/
public function get_course_filter_courses_by_timeline_classification_test_cases() {
public static function get_course_filter_courses_by_timeline_classification_test_cases(): array {
$now = time();
$day = 86400;
@@ -5112,7 +5112,7 @@ class courselib_test extends advanced_testcase {
/**
* Test the course_filter_courses_by_timeline_classification function.
*
* @dataProvider get_course_filter_courses_by_timeline_classification_test_cases()
* @dataProvider get_course_filter_courses_by_timeline_classification_test_cases
* @param array $coursedata Course test data to create.
* @param string $classification Timeline classification.
* @param int $limit Maximum number of results to return.
@@ -5161,7 +5161,7 @@ class courselib_test extends advanced_testcase {
/**
* Test cases for the course_filter_courses_by_timeline_classification tests.
*/
public function get_course_filter_courses_by_customfield_test_cases() {
public static function get_course_filter_courses_by_customfield_test_cases(): array {
global $CFG;
require_once($CFG->dirroot.'/blocks/myoverview/lib.php');
$coursedata = [
@@ -5331,7 +5331,7 @@ class courselib_test extends advanced_testcase {
/**
* Test the course_filter_courses_by_customfield function.
*
* @dataProvider get_course_filter_courses_by_customfield_test_cases()
* @dataProvider get_course_filter_courses_by_customfield_test_cases
* @param array $coursedata Course test data to create.
* @param string $customfield Shortname of the customfield.
* @param string $customfieldvalue the value to filter by.
@@ -5417,7 +5417,7 @@ class courselib_test extends advanced_testcase {
/**
* Test cases for the course_filter_courses_by_timeline_classification w/ hidden courses tests.
*/
public function get_course_filter_courses_by_timeline_classification_hidden_courses_test_cases() {
public static function get_course_filter_courses_by_timeline_classification_hidden_courses_test_cases(): array {
$now = time();
$day = 86400;
@@ -5576,7 +5576,7 @@ class courselib_test extends advanced_testcase {
/**
* Test the course_filter_courses_by_timeline_classification function hidden courses.
*
* @dataProvider get_course_filter_courses_by_timeline_classification_hidden_courses_test_cases()
* @dataProvider get_course_filter_courses_by_timeline_classification_hidden_courses_test_cases
* @param array $coursedata Course test data to create.
* @param string $classification Timeline classification.
* @param int $limit Maximum number of results to return.
@@ -5786,7 +5786,7 @@ class courselib_test extends advanced_testcase {
*
* @return array
*/
function course_get_recent_courses_sort_validation_provider() {
public static function course_get_recent_courses_sort_validation_provider(): array {
return [
'Invalid sort format (SQL injection attempt)' =>
[
@@ -5860,7 +5860,7 @@ class courselib_test extends advanced_testcase {
/**
* Test cases for the course_get_course_dates_for_user_ids tests.
*/
public function get_course_get_course_dates_for_user_ids_test_cases() {
public static function get_course_get_course_dates_for_user_ids_test_cases(): array {
$now = time();
$pastcoursestart = $now - 100;
$futurecoursestart = $now + 100;
@@ -7074,7 +7074,7 @@ class courselib_test extends advanced_testcase {
/**
* Test the course_get_course_dates_for_user_ids function.
*
* @dataProvider get_course_get_course_dates_for_user_ids_test_cases()
* @dataProvider get_course_get_course_dates_for_user_ids_test_cases
* @param bool $relativedatemode Set the course to relative dates mode
* @param int $coursestart Course start date
* @param int $usercount Number of users to create
@@ -7167,7 +7167,7 @@ class courselib_test extends advanced_testcase {
*
* @return array An array of arrays contain test data
*/
public function provider_course_modules_pending_deletion() {
public static function provider_course_modules_pending_deletion(): array {
return [
'Non-gradable activity, check all' => [['forum'], 0, false, true],
'Gradable activity, check all' => [['assign'], 0, false, true],
+1 -1
View File
@@ -3494,7 +3494,7 @@ final class externallib_test extends externallib_advanced_testcase {
/**
* Test the get_enrolled_courses_by_timeline_classification function.
*
* @dataProvider get_get_enrolled_courses_by_timeline_classification_test_cases()
* @dataProvider get_get_enrolled_courses_by_timeline_classification_test_cases
* @param array $coursedata Courses to create
* @param string $classification Timeline classification
* @param int $limit Maximum number of results

Some files were not shown because too many files have changed in this diff Show More