Compare commits
509 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 78f0557607 | |||
| dd1a805bae | |||
| 00e3145a61 | |||
| dfb8817998 | |||
| 76e2b6ef9f | |||
| d5c66fa1a4 | |||
| e9a7520a17 | |||
| c13b24dcaa | |||
| db67f81aa6 | |||
| e851106c8f | |||
| 754b7af680 | |||
| d0fd8c6ff4 | |||
| b0388fdc49 | |||
| 3cbcba14ca | |||
| cdbdc89b32 | |||
| bcd0bdaf51 | |||
| d53fbbdd5c | |||
| cb0ab077ff | |||
| 4e3b6edaaf | |||
| 66401fdedb | |||
| a3d771cdca | |||
| a034c10238 | |||
| 1a7939778b | |||
| 68b3f1e4a7 | |||
| 357960c02f | |||
| 798edb457c | |||
| 4e0aa8af6c | |||
| 9dca9da48c | |||
| ee48012f9c | |||
| a9a1791fe7 | |||
| 8eb4217a49 | |||
| eb1ea16009 | |||
| b9277ef5e2 | |||
| 61421c7930 | |||
| 287d2a5e12 | |||
| ff60bfb0bf | |||
| 8a79df8f2a | |||
| f5342a222d | |||
| 1cc0b4832d | |||
| 3363d697f6 | |||
| b1837e6cf9 | |||
| 4fecc12ea1 | |||
| 2937e76650 | |||
| b1f8463bc1 | |||
| 1947886e0e | |||
| 38d68b8f3e | |||
| c4b3e06f8a | |||
| 9ff2f0d7de | |||
| e9ae523134 | |||
| 16c5a3a0dd | |||
| 8dae0dec69 | |||
| e839fe812d | |||
| f164065979 | |||
| 58dd489eae | |||
| 05875057c6 | |||
| 8ee995dfad | |||
| f313b73822 | |||
| 492bac151d | |||
| 241b6628f5 | |||
| 5f68f288a0 | |||
| 1c47240630 | |||
| a866652ea4 | |||
| 80b9cafca8 | |||
| b81c83e461 | |||
| b360784c5b | |||
| 306a4e04aa | |||
| 092213c80d | |||
| 321a8cb0ca | |||
| 0f62627d13 | |||
| 319a50649e | |||
| 5715b74d3a | |||
| c83345aa11 | |||
| 9d03236862 | |||
| 1b40599fbf | |||
| 7cd2e70ec9 | |||
| 15d70438bc | |||
| eb5cce9b4e | |||
| c096179b1c | |||
| 1a6985d6e2 | |||
| abb6bc93a6 | |||
| 2ccd0743fb | |||
| 80f90252b9 | |||
| b5d567068c | |||
| bfcaab9a0f | |||
| 350d1df507 | |||
| 0de2f98aaa | |||
| e658f9f04a | |||
| 017833a2ab | |||
| 8c9179174d | |||
| 8cb6079b4f | |||
| 39d606ec27 | |||
| d6cf61731e | |||
| 9294b6a37f | |||
| 4525bada77 | |||
| 993cc8ff8a | |||
| 5ac9ff15a0 | |||
| 15eec33f91 | |||
| 437db87b3e | |||
| 73d5d4d51f | |||
| 7d36cf9b34 | |||
| 0483366b23 | |||
| f374651109 | |||
| fef4736613 | |||
| 4a27fe0a25 | |||
| c1910fc822 | |||
| daf6a7c39e | |||
| fd82af2f5e | |||
| 0fa050c328 | |||
| 890828d9b4 | |||
| ffbea7e4fc | |||
| de0773cb42 | |||
| b5fc4139c8 | |||
| 1dab36ae65 | |||
| 60af848bb3 | |||
| cf7274f36e | |||
| 0476854339 | |||
| 25a9d276e1 | |||
| cb5943094d | |||
| af0e9fd216 | |||
| fdca502808 | |||
| 6f9a0826d7 | |||
| 8dc41648e3 | |||
| f62ae260f4 | |||
| fe7c20d157 | |||
| d069cb9337 | |||
| 30533452cf | |||
| ee2e8890f8 | |||
| 140f43198d | |||
| ef8eeba26c | |||
| 93b132bbd1 | |||
| 27b19d4daa | |||
| 31ad2a3e0e | |||
| 4d5fab8cf2 | |||
| d4af150760 | |||
| 0ba63f8913 | |||
| 4969af736f | |||
| 839740a522 | |||
| ac87f038e2 | |||
| 0a6c734fab | |||
| 62f71f1c81 | |||
| 2cc78b27de | |||
| cca619f966 | |||
| 1bd32a28e8 | |||
| 7be2023401 | |||
| 0397ea7e59 | |||
| f38397544a | |||
| a212b1ec3e | |||
| 945e79573f | |||
| b327defe5d | |||
| 2f0c3f4f7d | |||
| 7ff7ca5c6e | |||
| a5f36b8de2 | |||
| f99c21b543 | |||
| 004ceed0c1 | |||
| 10b6240719 | |||
| e475728710 | |||
| 634115240a | |||
| 5040b9b579 | |||
| 3d2ad7d76a | |||
| 0b31712cf4 | |||
| 573ee63a0e | |||
| 580dfbaeaa | |||
| e088975109 | |||
| 63fa452f51 | |||
| 09e0ba70ec | |||
| 56ae87b4d2 | |||
| 4572bf9827 | |||
| 41f365d633 | |||
| feeac598b1 | |||
| bab7bdc53e | |||
| 3c3090b6f9 | |||
| de95714ae0 | |||
| da07dbda3f | |||
| 54c4cf6ac1 | |||
| 1e7d038247 | |||
| 1a1684a6fc | |||
| 63c3c3f76e | |||
| 57d86b6a69 | |||
| c47a4021df | |||
| 1294e283ad | |||
| 787fee79c8 | |||
| 64fa2930e5 | |||
| 60a5ecfe46 | |||
| b59920cce3 | |||
| db9a86ff42 | |||
| 5463c97506 | |||
| 4fd50e8cd9 | |||
| fe88f321a2 | |||
| 6f78835258 | |||
| 191c8452d3 | |||
| 2e1636bb52 | |||
| ebb328750a | |||
| 5523816c38 | |||
| e3fe0299a1 | |||
| ab2a97b33d | |||
| 1bb9eb8467 | |||
| 42a0b73dc1 | |||
| ced2e3aca6 | |||
| 805bb41d5b | |||
| 50a2df69c3 | |||
| 066459d375 | |||
| 0551129c39 | |||
| 59b6d343bf | |||
| 2f22088b38 | |||
| 8516a494b6 | |||
| 53dd76348c | |||
| def51280c2 | |||
| 230e8d8485 | |||
| 91b88a51a5 | |||
| cdcfa083ff | |||
| 8a5e4412d9 | |||
| deae2cf2fd | |||
| 5666c34237 | |||
| 4535493590 | |||
| c4ed6da1c5 | |||
| 991056f698 | |||
| 937eab02f6 | |||
| e6441d7fdb | |||
| a12fbfae35 | |||
| 0074e485cd | |||
| aa168505a9 | |||
| bbff432ffa | |||
| 9c81a8e93f | |||
| 6dfe557c7e | |||
| cb53c504d3 | |||
| 41445fa1bf | |||
| 0be775af96 | |||
| 979fd06b47 | |||
| 0198546f6e | |||
| 12fc4c5e7a | |||
| 5b993c63c7 | |||
| 5673f75524 | |||
| efa7b639d0 | |||
| 948616f4a0 | |||
| 221b7618a1 | |||
| 5ceafdc943 | |||
| 40e58f8e3a | |||
| 2b84963424 | |||
| f35f522991 | |||
| bd26046264 | |||
| e2de61b74b | |||
| c2996f9301 | |||
| 9f26a1a312 | |||
| 2e7ca2f071 | |||
| 4cd34267b6 | |||
| f02b730069 | |||
| ceb4b0e0b4 | |||
| feb621d4de | |||
| 490929b3ba | |||
| 14d4bfdd2a | |||
| 837e0cdce3 | |||
| 211419a9c6 | |||
| 92a2ccff5e | |||
| dce7206e8a | |||
| 65cc1b695a | |||
| b8602beb62 | |||
| e8ef35b7c9 | |||
| 9fb4b68799 | |||
| 8ed775e45f | |||
| fafa45112a | |||
| 9b8ce4d82b | |||
| 006b32290c | |||
| ba7c038739 | |||
| 4b2efd494e | |||
| 8e58b0bace | |||
| 7bca8a175f | |||
| 24d82b3e4a | |||
| eab32b304a | |||
| 86d0e4f7d7 | |||
| b9d50fc8fe | |||
| 8781ef341c | |||
| 4dfd7a290b | |||
| f3bfa720ad | |||
| 867cce4152 | |||
| 17bb38c307 | |||
| 47a4ef1e5e | |||
| b8bf53eb4b | |||
| eab8c74464 | |||
| 2d9c3446e9 | |||
| 79651c7d22 | |||
| fb5e0c453b | |||
| 6228f13bdd | |||
| 5bb2452ace | |||
| 8275662ed3 | |||
| f4eb5cb554 | |||
| f2fc73c674 | |||
| 9fc49012bd | |||
| 86f4f6864d | |||
| ca8715654b | |||
| d9a62c9fac | |||
| 4a9fa426bc | |||
| f1d4fd0db7 | |||
| 129d445908 | |||
| c6ad71859c | |||
| 2c58871a74 | |||
| 42d214d0cc | |||
| fb4a9db65e | |||
| f5e1074653 | |||
| 3ec081f2de | |||
| c374c271b1 | |||
| 09bdf8c905 | |||
| be3348d85e | |||
| cb9d48373b | |||
| 98018a490f | |||
| 1e1cd2fa6b | |||
| 603486e1f7 | |||
| 2409c05065 | |||
| df98fb57ee | |||
| 28e2f8bc2a | |||
| 2408bd007b | |||
| a22898e2af | |||
| d29cdb623e | |||
| eb4a12f1f0 | |||
| aee5fc1223 | |||
| 26a8d1fd81 | |||
| 25212b83c3 | |||
| c6cc60cb79 | |||
| eaf62826c3 | |||
| 90f855220d | |||
| d0cedfa840 | |||
| c4920eab6d | |||
| 48f59ff4e6 | |||
| 264d4289da | |||
| a91c937935 | |||
| b5f4e35746 | |||
| 1201a5fad5 | |||
| 1d6529f5ea | |||
| 6cce66dcf7 | |||
| ead2f17b57 | |||
| 99935628cf | |||
| 825766216d | |||
| e17c20a424 | |||
| 76f327d195 | |||
| ffb62740c0 | |||
| 59c9a5f46b | |||
| 9009e1bd30 | |||
| dfb3226883 | |||
| e84729de92 | |||
| 7262d95895 | |||
| d4f34b0904 | |||
| 59bfaeda37 | |||
| 887e106a6c | |||
| be06a75a36 | |||
| ac39bac81b | |||
| 8a5e048594 | |||
| f91db6c35e | |||
| 66a3d9edba | |||
| f843322982 | |||
| 17e1d23c3f | |||
| fd2c90c29a | |||
| d2a6a5b164 | |||
| 7a5dabe6aa | |||
| de6d21497d | |||
| 0921c43e2c | |||
| 38db48744d | |||
| 582f1bc1fe | |||
| c496c5b819 | |||
| 9d40a13eb6 | |||
| 5990158a6f | |||
| cc262124db | |||
| 5ad18a4070 | |||
| ca4ac3e8b6 | |||
| c06e1de52d | |||
| daf1199956 | |||
| 5451d79a8c | |||
| 763a4a3dac | |||
| c9b5f15fb3 | |||
| 88667463ac | |||
| af1936faf4 | |||
| 2ea21b9ccf | |||
| 275c174cbf | |||
| 04757718b1 | |||
| b81a2f80f7 | |||
| 86cd6040f1 | |||
| c5ce22a2e6 | |||
| c18cf220a2 | |||
| 6bd67f0a5f | |||
| 8beef3f70b | |||
| b4c081fa08 | |||
| 7ee27356af | |||
| 1ecfc86f97 | |||
| 252dbc9605 | |||
| 9b9823a56a | |||
| 77134d5bb4 | |||
| e9aa483add | |||
| 95742edc54 | |||
| f3150d4a26 | |||
| d237a6312f | |||
| c36a037c20 | |||
| 3373632225 | |||
| c885df9202 | |||
| 1818370854 | |||
| 8ff3de4299 | |||
| 86899b14cb | |||
| b259811d7a | |||
| 7edd6995e5 | |||
| 35f7c54107 | |||
| 70d17adc0a | |||
| c05e07923f | |||
| f81b1125f5 | |||
| 454ec455bf | |||
| 5a1f0fd327 | |||
| 0a3eedbebf | |||
| 02bc67f6c5 | |||
| 7d4c2fb5f2 | |||
| f0066123a3 | |||
| b65077c4c0 | |||
| d58770969c | |||
| f7922dbe1d | |||
| 53f6f1ce05 | |||
| b4829f2475 | |||
| e8f9288606 | |||
| 72bdc3766e | |||
| d8ea630f24 | |||
| ac9e395ed6 | |||
| 8bdba9bdca | |||
| 99fc164199 | |||
| 64a7e06f61 | |||
| 9ec2c12f3d | |||
| 6ec89f6374 | |||
| 834c80849c | |||
| 674198a799 | |||
| 66c32a3687 | |||
| 0118227509 | |||
| 2e1478b094 | |||
| 6961258bc2 | |||
| b4f6816952 | |||
| 16b30d920b | |||
| 61d140e99f | |||
| cc5eb38cea | |||
| 3b7bba9e75 | |||
| 2e020b506a | |||
| 74cdb7c4c8 | |||
| ef8d381a2f | |||
| 39717b72b1 | |||
| e7ff99758e | |||
| 26492d4979 | |||
| 3abbcd9976 | |||
| 1456551ba6 | |||
| c1ebec7cbc | |||
| 812c8b37e5 | |||
| 8b2b7f97ee | |||
| f2ab11aa5b | |||
| 240b402523 | |||
| 34c4b3ce0c | |||
| 8b098b4a4e | |||
| 38a40c5e4b | |||
| 72580a5413 | |||
| 6253ab0170 | |||
| d25f2eeee6 | |||
| ff89abc311 | |||
| 7878d79359 | |||
| 93319747b2 | |||
| f46c1b4fa9 | |||
| a0297df86e | |||
| da9ab8a2f9 | |||
| 33829b8b68 | |||
| f5f468f6e1 | |||
| 6b4f55c91b | |||
| 63ed56bc7c | |||
| 841214dab2 | |||
| 43cbc05a2d | |||
| 973ea46697 | |||
| 98dbb93589 | |||
| 5fa19e43b3 | |||
| 0d3a2c9181 | |||
| 4f7bd72f72 | |||
| cc182408aa | |||
| 8b3913605a | |||
| 8ff67c91de | |||
| 4cbd6a0c6a | |||
| 203a55f57a | |||
| 5b05a9378c | |||
| b51257df71 | |||
| 81e5d425c4 | |||
| 6362d7b51c | |||
| 51d3df8d30 | |||
| a60a6d41a3 | |||
| d6ba7724ae | |||
| 4f1be71581 | |||
| 58ddfe84c2 | |||
| dd156a4160 | |||
| 3bc8fa20bf | |||
| 954ae33aa9 | |||
| 24dbcc0008 | |||
| ebb96c2850 | |||
| 870c5ffbde | |||
| 049e27a805 | |||
| 6c7fa91d59 | |||
| 7c84b92be3 | |||
| bb36c3a1bb | |||
| 990bfee024 | |||
| 17584f9c92 | |||
| f551072f9e | |||
| 3447ab640c | |||
| 3dbad11471 | |||
| 43b4b87fbf | |||
| 7d33385a1d | |||
| 657617ac21 | |||
| 205e4152cc | |||
| e36fb751e5 | |||
| a0c1acd7fd | |||
| 2184ea5b64 | |||
| c81b3dc384 | |||
| ca6a4b1953 | |||
| 20cefd70e2 | |||
| bc87d55a1f | |||
| 51c376cfca | |||
| e0034b0566 |
@@ -13,7 +13,7 @@ env:
|
||||
|
||||
jobs:
|
||||
Grunt:
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- name: Checking out code
|
||||
@@ -54,11 +54,11 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-18.04
|
||||
- os: ubuntu-20.04
|
||||
php: 7.3
|
||||
extensions:
|
||||
db: mysqli
|
||||
- os: ubuntu-18.04
|
||||
- os: ubuntu-20.04
|
||||
php: 8.0
|
||||
db: pgsql
|
||||
extensions: xmlrpc-beta
|
||||
@@ -111,4 +111,5 @@ jobs:
|
||||
- name: Running PHPUnit tests
|
||||
env:
|
||||
dbtype: ${{ matrix.db }}
|
||||
run: vendor/bin/phpunit -v
|
||||
phpunit_options: ${{ secrets.phpunit_options }}
|
||||
run: vendor/bin/phpunit $phpunit_options
|
||||
|
||||
@@ -54,3 +54,4 @@ moodle-plugin-ci.phar
|
||||
/admin/tool/componentlibrary/docs
|
||||
/admin/tool/componentlibrary/hugo/site/data/my-index.json
|
||||
.hugo_build.lock
|
||||
.phpcs.xml
|
||||
|
||||
@@ -21,6 +21,43 @@
|
||||
*/
|
||||
|
||||
module.exports = grunt => {
|
||||
|
||||
/**
|
||||
* Generate the PHPCS configuration.
|
||||
*
|
||||
* @param {Object} thirdPartyPaths
|
||||
*/
|
||||
const phpcsIgnore = (thirdPartyPaths) => {
|
||||
const {toXML} = require('jstoxml');
|
||||
|
||||
const config = {
|
||||
_name: 'ruleset',
|
||||
_attrs: {
|
||||
name: "MoodleCore",
|
||||
},
|
||||
_content: [
|
||||
{
|
||||
rule: {
|
||||
_attrs: {
|
||||
ref: './.phpcs.xml.dist',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
thirdPartyPaths.forEach(library => {
|
||||
config._content.push({
|
||||
'exclude-pattern': library,
|
||||
});
|
||||
});
|
||||
|
||||
grunt.file.write('.phpcs.xml', toXML(config, {
|
||||
header: true,
|
||||
indent: ' ',
|
||||
}) + "\n");
|
||||
};
|
||||
|
||||
/**
|
||||
* Generate ignore files (utilising thirdpartylibs.xml data)
|
||||
*/
|
||||
@@ -53,6 +90,8 @@ module.exports = grunt => {
|
||||
'admin/tool/componentlibrary/hugo/dist/css/docs.css',
|
||||
].concat(thirdPartyPaths);
|
||||
grunt.file.write('.stylelintignore', stylelintIgnores.join('\n') + '\n');
|
||||
|
||||
phpcsIgnore(thirdPartyPaths);
|
||||
};
|
||||
|
||||
grunt.registerTask('ignorefiles', 'Generate ignore files for linters', handler);
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ruleset name="MoodleCore">
|
||||
<rule ref="moodle"/>
|
||||
</ruleset>
|
||||
@@ -36,7 +36,7 @@ jobs:
|
||||
- php: 7.3
|
||||
env: DB=none TASK=CITEST
|
||||
- php: 7.3
|
||||
env: DB=none TASK=GRUNT NVM_VERSION='lts/carbon'
|
||||
env: DB=none TASK=GRUNT NVM_VERSION='lts/gallium'
|
||||
|
||||
- if: env(MOODLE_DATABASE) = "pgsql" OR env(MOODLE_DATABASE) = "all" OR env(MOODLE_DATABASE) IS NOT present
|
||||
php: 7.3
|
||||
@@ -52,7 +52,7 @@ jobs:
|
||||
env: DB=none TASK=CITEST
|
||||
- if: env(MOODLE_PHP) = "all"
|
||||
php: 8.0
|
||||
env: DB=none TASK=GRUNT NVM_VERSION='lts/carbon'
|
||||
env: DB=none TASK=GRUNT NVM_VERSION='lts/gallium'
|
||||
|
||||
- if: env(MOODLE_PHP) = "all" AND (env(MOODLE_DATABASE) = "pgsql" OR env(MOODLE_DATABASE) = "all" OR env(MOODLE_DATABASE) IS NOT present)
|
||||
php: 8.0
|
||||
|
||||
@@ -69,11 +69,11 @@ if ($options['help'] or (!$options['list'] and !$options['execute'])) {
|
||||
die;
|
||||
}
|
||||
|
||||
if ($options['showdebugging']) {
|
||||
if ($options['showdebugging'] || !empty($CFG->showcrondebugging)) {
|
||||
set_debugging(DEBUG_DEVELOPER, true);
|
||||
}
|
||||
|
||||
if ($options['showsql']) {
|
||||
if ($options['showsql'] || !empty($CFG->showcronsql)) {
|
||||
$DB->set_debug(true);
|
||||
}
|
||||
if ($options['list']) {
|
||||
|
||||
@@ -3539,6 +3539,8 @@
|
||||
</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_xmlrpc_usage" level="optional">
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="4.0" requires="3.6">
|
||||
@@ -3733,4 +3735,196 @@
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="4.1" requires="3.9">
|
||||
<UNICODE level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unicoderequired" />
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mariadb" version="10.4" />
|
||||
<VENDOR name="mysql" version="5.7" />
|
||||
<VENDOR name="postgres" version="12" />
|
||||
<VENDOR name="mssql" version="14.0" />
|
||||
<VENDOR name="oracle" version="19" />
|
||||
</DATABASE>
|
||||
<PHP version="7.4.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="xmlrpc" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="xmlrpcrecommended" />
|
||||
</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="optional"/>
|
||||
<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="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="sixtyfourbitswarning" />
|
||||
</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_CHECKS>
|
||||
</MOODLE>
|
||||
</COMPATIBILITY_MATRIX>
|
||||
|
||||
@@ -38,11 +38,22 @@
|
||||
}
|
||||
|
||||
if (!empty($show) and confirm_sesskey()) {
|
||||
$class = \core_plugin_manager::resolve_plugininfo_class('mod');
|
||||
$class::enable_plugin($show, true);
|
||||
$canenablemodule = true;
|
||||
$modulename = $show;
|
||||
|
||||
admin_get_root(true, false); // settings not required - only pages
|
||||
redirect(new moodle_url('/admin/modules.php'));
|
||||
// Invoking a callback function that enables plugins to force additional actions (e.g. displaying notifications,
|
||||
// modals, etc.) and also specify through its returned value (bool) whether the process of enabling the plugin
|
||||
// should continue after these actions or not.
|
||||
if (component_callback_exists("mod_{$modulename}", 'pre_enable_plugin_actions')) {
|
||||
$canenablemodule = component_callback("mod_{$modulename}", 'pre_enable_plugin_actions');
|
||||
}
|
||||
|
||||
if ($canenablemodule) {
|
||||
$class = \core_plugin_manager::resolve_plugininfo_class('mod');
|
||||
$class::enable_plugin($show, true);
|
||||
admin_get_root(true, false); // Settings not required - only pages.
|
||||
redirect(new moodle_url('/admin/modules.php'));
|
||||
}
|
||||
}
|
||||
|
||||
echo $OUTPUT->header();
|
||||
|
||||
@@ -14,19 +14,19 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace core_role;
|
||||
|
||||
use core_role_preset;
|
||||
|
||||
/**
|
||||
* Role XML presets test case.
|
||||
*
|
||||
* @package core_role
|
||||
* @category phpunit
|
||||
* @category test
|
||||
* @copyright 2013 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
|
||||
class core_role_preset_testcase extends advanced_testcase {
|
||||
class preset_test extends \advanced_testcase {
|
||||
public function test_xml() {
|
||||
global $DB;
|
||||
|
||||
@@ -61,7 +61,7 @@ class core_role_preset_testcase extends advanced_testcase {
|
||||
FROM {role_capabilities}
|
||||
WHERE contextid = :syscontext AND roleid = :roleid
|
||||
ORDER BY capability ASC",
|
||||
array('syscontext'=>context_system::instance()->id, 'roleid'=>$role->id));
|
||||
array('syscontext' => \context_system::instance()->id, 'roleid' => $role->id));
|
||||
|
||||
foreach ($capabilities as $cap) {
|
||||
$this->assertEquals($cap->permission, $info['permissions'][$cap->capability]);
|
||||
|
||||
@@ -33,8 +33,16 @@ if (!($settingspage->check_access())) {
|
||||
die;
|
||||
}
|
||||
|
||||
$hassiteconfig = has_capability('moodle/site:config', $PAGE->context);
|
||||
if ($hassiteconfig) {
|
||||
// If the context in the admin_settingpage object is explicitly defined and it is not system, reset the current
|
||||
// page context and use that one instead. This ensures that the proper navigation is displayed and highlighted.
|
||||
if ($settingspage->context && !$settingspage->context instanceof \context_system) {
|
||||
$PAGE->set_context($settingspage->context);
|
||||
}
|
||||
|
||||
$hassiteconfig = has_capability('moodle/site:config', context_system::instance());
|
||||
// Display the admin search input element in the page header if the user has the capability to change the site
|
||||
// configuration and the current page context is system.
|
||||
if ($hassiteconfig && $PAGE->context instanceof \context_system) {
|
||||
$PAGE->add_header_action($OUTPUT->render_from_template('core_admin/header_search_input', [
|
||||
'action' => new moodle_url('/admin/search.php'),
|
||||
]));
|
||||
@@ -125,13 +133,6 @@ if (empty($SITE->fullname)) {
|
||||
|
||||
$PAGE->set_title("$SITE->shortname: " . implode(": ",$visiblepathtosection));
|
||||
$PAGE->set_heading($SITE->fullname);
|
||||
if ($section === 'frontpagesettings') {
|
||||
$frontpagenode = $PAGE->settingsnav->find('frontpage', navigation_node::TYPE_SETTING);
|
||||
$frontpagenode->make_active();
|
||||
$PAGE->navbar->add(get_string('frontpage', 'admin'),
|
||||
new moodle_url('/admin/category.php', ['category' => 'frontpage']));
|
||||
$PAGE->navbar->add(get_string('frontpagesettings', 'admin'), $PAGE->url);
|
||||
}
|
||||
echo $OUTPUT->header();
|
||||
|
||||
if ($errormsg !== '') {
|
||||
|
||||
@@ -88,6 +88,15 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
|
||||
$downloadcontentsitedefault->add_dependent_on('downloadcoursecontentallowed');
|
||||
$temp->add($downloadcontentsitedefault);
|
||||
|
||||
$temp->add(
|
||||
new admin_setting_configtext(
|
||||
'moodlecourse/participantsperpage',
|
||||
new lang_string('participants:perpage', 'course'),
|
||||
new lang_string('participants:perpage_help', 'course'),
|
||||
20
|
||||
)
|
||||
);
|
||||
|
||||
// Course format.
|
||||
$temp->add(new admin_setting_heading('courseformathdr', new lang_string('type_format', 'plugin'), ''));
|
||||
|
||||
|
||||
@@ -527,7 +527,10 @@ if ($hassiteconfig && !empty($CFG->enableplagiarism)) {
|
||||
$plugin->load_settings($ADMIN, 'plagiarism', $hassiteconfig);
|
||||
}
|
||||
}
|
||||
$ADMIN->add('reports', new admin_externalpage('comments', new lang_string('comments'), $CFG->wwwroot.'/comment/', 'moodle/site:viewreports'));
|
||||
|
||||
// Comments report, note this page is really just a means to delete comments so check that.
|
||||
$ADMIN->add('reports', new admin_externalpage('comments', new lang_string('comments'), $CFG->wwwroot . '/comment/index.php',
|
||||
'moodle/comment:delete'));
|
||||
|
||||
// Course reports settings
|
||||
if ($hassiteconfig) {
|
||||
|
||||
@@ -240,7 +240,8 @@ if ($hassiteconfig
|
||||
if ($field->param2 > 255 || $field->datatype != 'text') {
|
||||
continue;
|
||||
}
|
||||
$fields['profile_field_' . $field->shortname] = $field->name . ' *';
|
||||
$fields['profile_field_' . $field->shortname] = format_string($field->name, true,
|
||||
['context' => context_system::instance()]) . ' *';
|
||||
}
|
||||
|
||||
return $fields;
|
||||
|
||||
@@ -18,6 +18,10 @@ Feature: An administrator can filter user accounts by role, cohort and other pro
|
||||
And the following "cohorts" exist:
|
||||
| name | idnumber |
|
||||
| Cohort 1 | CH1 |
|
||||
And the following "cohort members" exist:
|
||||
| user | cohort |
|
||||
| user2 | CH1 |
|
||||
| user3 | CH1 |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
@@ -27,8 +31,6 @@ Feature: An administrator can filter user accounts by role, cohort and other pro
|
||||
| user2 | C1 | student |
|
||||
| user3 | C1 | student |
|
||||
And I log in as "admin"
|
||||
And I add "User Two (two@example.com)" user to "CH1" cohort members
|
||||
And I add "User Three (three@example.com)" user to "CH1" cohort members
|
||||
And I navigate to "Users > Accounts > Browse list of users" in site administration
|
||||
|
||||
Scenario: Filter user accounts by role and cohort
|
||||
|
||||
@@ -63,7 +63,7 @@ Feature: View task logs report and use its filters
|
||||
Then I should see "Filters applied"
|
||||
And I should see "Filters (1)" in the "#dropdownFiltersButton" "css_element"
|
||||
And I should see "Nothing to display"
|
||||
And I click on "Reset" "button" in the "[data-region='report-filters']" "css_element"
|
||||
And I click on "Reset all" "button" in the "[data-region='report-filters']" "css_element"
|
||||
And I should see "Filters reset"
|
||||
And I should not see "Filters (1)" in the "#dropdownFiltersButton" "css_element"
|
||||
And I should see "Filters" in the "#dropdownFiltersButton" "css_element"
|
||||
|
||||
@@ -7,8 +7,8 @@ Feature: Behat steps for interacting with form work
|
||||
@javascript
|
||||
Scenario: Test fields in containers
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname |
|
||||
| Course 1 | C1 |
|
||||
| fullname | shortname | summary | summaryformat |
|
||||
| Course 1 | C1 | Red | 1 |
|
||||
When I log in as "admin"
|
||||
And I am on "Course 1" course homepage
|
||||
# Just get to any form.
|
||||
@@ -17,11 +17,15 @@ Feature: Behat steps for interacting with form work
|
||||
And I set the following fields in the "Appearance" "fieldset" to these values:
|
||||
| Show activity reports | Yes |
|
||||
| Number of announcements | 1 |
|
||||
And I set the following fields in the "Description" "fieldset" to these values:
|
||||
| Course summary | Green |
|
||||
Then the field "Show activity reports" in the "Appearance" "fieldset" matches value "Yes"
|
||||
And the field "Show activity reports" in the "Appearance" "fieldset" does not match value "No"
|
||||
And the following fields in the "region-main" "region" match these values:
|
||||
| Course full name | Frog |
|
||||
| Number of announcements | 1 |
|
||||
| Course summary | Green |
|
||||
And the following fields in the "region-main" "region" do not match these values:
|
||||
| Course full name | Course 1 |
|
||||
| Number of announcements | 5 |
|
||||
| Course summary | Red |
|
||||
|
||||
@@ -20,9 +20,10 @@ Feature: Forms manipulation
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And I log in as "admin"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "Quiz" to section "1"
|
||||
And the following "activities" exist:
|
||||
| activity | course | section | name |
|
||||
| quiz | C1 | 1 | Quiz 1 |
|
||||
And I am on the "Quiz 1" "quiz activity editing" page logged in as admin
|
||||
When I expand all fieldsets
|
||||
Then I should see "Close the quiz"
|
||||
And I should see "Group mode"
|
||||
|
||||
@@ -248,7 +248,7 @@ $string['printable:toolname'] = 'Summary report';
|
||||
$string['printable:toolshortname'] = 'Summary report';
|
||||
$string['printable:downloadpdf'] = 'Download PDF';
|
||||
$string['printable:printreport'] = 'Printable report';
|
||||
$string['error:nocoursespecified'] = 'This summary report requires a valid course id. Please access the accessibility toolkit from within a course, via the actions menu, which will then supply this required course id.';
|
||||
$string['error:nocoursespecified'] = 'The summary report requires a valid course ID. Please access the accessibility toolkit from within a course.';
|
||||
$string['pdf:filename'] = 'Brickfield_Summaryreport_CourseID-{$a}';
|
||||
|
||||
// Advanced page.
|
||||
|
||||
@@ -44,5 +44,8 @@ function xmldb_tool_cohortroles_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -41,5 +41,8 @@ function xmldb_tool_customlang_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -786,6 +786,18 @@ class api {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if user has permission to create data download request for themselves
|
||||
*
|
||||
* @param int|null $userid
|
||||
* @return bool
|
||||
*/
|
||||
public static function can_create_data_download_request_for_self(int $userid = null): bool {
|
||||
global $USER;
|
||||
$userid = $userid ?: $USER->id;
|
||||
return has_capability('tool/dataprivacy:downloadownrequest', \context_user::instance($userid), $userid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if user has permisson to create data deletion request for themselves.
|
||||
*
|
||||
@@ -847,7 +859,7 @@ class api {
|
||||
|
||||
$usercontext = \context_user::instance($userid);
|
||||
// If it's your own and you have the right capability, you can download it.
|
||||
if ($userid == $downloaderid && has_capability('tool/dataprivacy:downloadownrequest', $usercontext, $downloaderid)) {
|
||||
if ($userid == $downloaderid && self::can_create_data_download_request_for_self($downloaderid)) {
|
||||
return true;
|
||||
}
|
||||
// If you can download anyone's in that context, you can download it.
|
||||
|
||||
@@ -96,6 +96,11 @@ if ($data = $mform->get_data()) {
|
||||
throw new moodle_exception('nopermissions', 'error', '',
|
||||
get_string('errorcannotrequestdeleteforother', 'tool_dataprivacy'));
|
||||
}
|
||||
} else if ($data->type == \tool_dataprivacy\api::DATAREQUEST_TYPE_EXPORT) {
|
||||
if ($data->userid == $USER->id && !\tool_dataprivacy\api::can_create_data_download_request_for_self()) {
|
||||
throw new moodle_exception('nopermissions', 'error', '',
|
||||
get_string('errorcannotrequestexportforself', 'tool_dataprivacy'));
|
||||
}
|
||||
}
|
||||
|
||||
\tool_dataprivacy\api::create_data_request($data->userid, $data->type, $data->comments);
|
||||
|
||||
@@ -97,10 +97,11 @@ class tool_dataprivacy_data_request_form extends \core\form\persistent {
|
||||
$mform->setType('userid', PARAM_INT);
|
||||
|
||||
// Subject access request type.
|
||||
$options = [
|
||||
api::DATAREQUEST_TYPE_EXPORT => get_string('requesttypeexport', 'tool_dataprivacy'),
|
||||
api::DATAREQUEST_TYPE_DELETE => get_string('requesttypedelete', 'tool_dataprivacy')
|
||||
];
|
||||
$options = [];
|
||||
if ($this->manage || api::can_create_data_download_request_for_self()) {
|
||||
$options[api::DATAREQUEST_TYPE_EXPORT] = get_string('requesttypeexport', 'tool_dataprivacy');
|
||||
}
|
||||
$options[api::DATAREQUEST_TYPE_DELETE] = get_string('requesttypedelete', 'tool_dataprivacy');
|
||||
|
||||
$mform->addElement('select', 'type', get_string('requesttype', 'tool_dataprivacy'), $options);
|
||||
$mform->addHelpButton('type', 'requesttype', 'tool_dataprivacy');
|
||||
@@ -174,7 +175,7 @@ class tool_dataprivacy_data_request_form extends \core\form\persistent {
|
||||
$errors['type'] = get_string('errorrequestalreadyexists', 'tool_dataprivacy');
|
||||
}
|
||||
|
||||
// Check if current user can create data deletion request.
|
||||
// Check if current user can create data requests.
|
||||
if ($data->type == api::DATAREQUEST_TYPE_DELETE) {
|
||||
if ($userid == $USER->id) {
|
||||
if (!api::can_create_data_deletion_request_for_self()) {
|
||||
@@ -184,6 +185,10 @@ class tool_dataprivacy_data_request_form extends \core\form\persistent {
|
||||
&& !api::can_create_data_deletion_request_for_children($userid)) {
|
||||
$errors['type'] = get_string('errorcannotrequestdeleteforother', 'tool_dataprivacy');
|
||||
}
|
||||
} else if ($data->type == api::DATAREQUEST_TYPE_EXPORT) {
|
||||
if ($userid == $USER->id && !api::can_create_data_download_request_for_self()) {
|
||||
$errors['type'] = get_string('errorcannotrequestexportforself', 'tool_dataprivacy');
|
||||
}
|
||||
}
|
||||
|
||||
return $errors;
|
||||
|
||||
@@ -78,5 +78,8 @@ function xmldb_tool_dataprivacy_upgrade($oldversion) {
|
||||
upgrade_plugin_savepoint(true, 2020061501, 'tool', 'dataprivacy');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -135,6 +135,7 @@ $string['effectiveretentionperioduser'] = '{$a} (since the last time the user ac
|
||||
$string['emailsalutation'] = 'Dear {$a},';
|
||||
$string['errorcannotrequestdeleteforself'] = 'You don\'t have permission to create deletion request for yourself.';
|
||||
$string['errorcannotrequestdeleteforother'] = 'You don\'t have permission to create deletion request for this user.';
|
||||
$string['errorcannotrequestexportforself'] = 'You don\'t have permission to create export request for yourself.';
|
||||
$string['errorcontactdpodisabled'] = 'The option to contact the privacy officer is disabled.';
|
||||
$string['errorinvalidrequestcomments'] = 'The comments field may contain plain text only.';
|
||||
$string['errorinvalidrequestcreationmethod'] = 'Invalid request creation method!';
|
||||
|
||||
@@ -68,8 +68,9 @@ function tool_dataprivacy_myprofile_navigation(tree $tree, $user, $iscurrentuser
|
||||
|
||||
// Check if the user has an ongoing data export request.
|
||||
$hasexportrequest = \tool_dataprivacy\api::has_ongoing_request($user->id, \tool_dataprivacy\api::DATAREQUEST_TYPE_EXPORT);
|
||||
// Show data export link only if the user doesn't have an ongoing data export request.
|
||||
if (!$hasexportrequest) {
|
||||
// Show data export link only if the user doesn't have an ongoing data export request and has permission
|
||||
// to download own data.
|
||||
if (!$hasexportrequest && \tool_dataprivacy\api::can_create_data_download_request_for_self()) {
|
||||
$exportparams = ['type' => \tool_dataprivacy\api::DATAREQUEST_TYPE_EXPORT];
|
||||
$exporturl = new moodle_url('/admin/tool/dataprivacy/createdatarequest.php', $exportparams);
|
||||
$exportnode = new core_user\output\myprofile\node('privacyandpolicies', 'requestdataexport',
|
||||
|
||||
@@ -26,6 +26,7 @@ use tool_dataprivacy\task\process_data_request_task;
|
||||
* API tests.
|
||||
*
|
||||
* @package tool_dataprivacy
|
||||
* @covers \tool_dataprivacy\api
|
||||
* @copyright 2018 Jun Pataleta
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
@@ -2174,6 +2175,27 @@ class api_test extends \advanced_testcase {
|
||||
return $request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test whether user can create data download request for themselves
|
||||
*/
|
||||
public function test_can_create_data_download_request_for_self(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
$this->setUser($user);
|
||||
|
||||
// The default user role allows for the creation of download data requests.
|
||||
$this->assertTrue(api::can_create_data_download_request_for_self());
|
||||
|
||||
// Prohibit that capability.
|
||||
$userrole = $DB->get_field('role', 'id', ['shortname' => 'user'], MUST_EXIST);
|
||||
assign_capability('tool/dataprivacy:downloadownrequest', CAP_PROHIBIT, $userrole, \context_user::instance($user->id));
|
||||
|
||||
$this->assertFalse(api::can_create_data_download_request_for_self());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test user cannot create data deletion request for themselves if they don't have
|
||||
* "tool/dataprivacy:requestdelete" capability.
|
||||
|
||||
@@ -14,17 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Unit tests for the data_registry class.
|
||||
*
|
||||
* @package tool_dataprivacy
|
||||
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
use \tool_dataprivacy\data_registry;
|
||||
namespace tool_dataprivacy;
|
||||
|
||||
/**
|
||||
* Unit tests for the data_registry class.
|
||||
@@ -33,7 +23,7 @@ use \tool_dataprivacy\data_registry;
|
||||
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_dataprivacy_dataregistry_testcase extends advanced_testcase {
|
||||
class data_registry_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Ensure that the get_effective_context_value only errors if provided an inappropriate element.
|
||||
@@ -41,7 +31,7 @@ class tool_dataprivacy_dataregistry_testcase extends advanced_testcase {
|
||||
* This test is not great because we only test a limited set of values. This is a fault of the underlying API.
|
||||
*/
|
||||
public function test_get_effective_context_value_invalid_element() {
|
||||
$this->expectException(coding_exception::class);
|
||||
$this->expectException(\coding_exception::class);
|
||||
data_registry::get_effective_context_value(\context_system::instance(), 'invalid');
|
||||
}
|
||||
|
||||
@@ -51,7 +41,7 @@ class tool_dataprivacy_dataregistry_testcase extends advanced_testcase {
|
||||
* This test is not great because we only test a limited set of values. This is a fault of the underlying API.
|
||||
*/
|
||||
public function test_get_effective_contextlevel_value_invalid_element() {
|
||||
$this->expectException(coding_exception::class);
|
||||
$this->expectException(\coding_exception::class);
|
||||
data_registry::get_effective_contextlevel_value(\context_system::instance(), 'invalid');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,19 +14,13 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Tests for the data_request persistent.
|
||||
*
|
||||
* @package tool_dataprivacy
|
||||
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace tool_dataprivacy;
|
||||
|
||||
use data_privacy_testcase;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
require_once('data_privacy_testcase.php');
|
||||
|
||||
use tool_dataprivacy\api;
|
||||
|
||||
/**
|
||||
* Tests for the data_request persistent.
|
||||
*
|
||||
@@ -34,7 +28,7 @@ use tool_dataprivacy\api;
|
||||
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_dataprivacy_data_request_testcase extends data_privacy_testcase {
|
||||
class data_request_test extends data_privacy_testcase {
|
||||
|
||||
/**
|
||||
* Data provider for testing is_resettable, and is_active.
|
||||
|
||||
@@ -14,25 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Expired contexts tests.
|
||||
*
|
||||
* @package tool_dataprivacy
|
||||
* @copyright 2018 David Monllao
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
use tool_dataprivacy\api;
|
||||
use tool_dataprivacy\data_registry;
|
||||
use tool_dataprivacy\expired_context;
|
||||
use tool_dataprivacy\purpose;
|
||||
use tool_dataprivacy\purpose_override;
|
||||
use tool_dataprivacy\category;
|
||||
use tool_dataprivacy\contextlevel;
|
||||
use tool_dataprivacy\expired_contexts_manager;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
global $CFG;
|
||||
namespace tool_dataprivacy;
|
||||
|
||||
/**
|
||||
* Expired contexts tests.
|
||||
@@ -41,7 +23,7 @@ global $CFG;
|
||||
* @copyright 2018 David Monllao
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
|
||||
class expired_contexts_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Setup the basics with the specified retention period.
|
||||
|
||||
@@ -14,21 +14,11 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Expired data requests tests.
|
||||
*
|
||||
* @package tool_dataprivacy
|
||||
* @copyright 2018 Michael Hawkins
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace tool_dataprivacy;
|
||||
|
||||
use tool_dataprivacy\api;
|
||||
use tool_dataprivacy\category;
|
||||
use tool_dataprivacy\data_request;
|
||||
use tool_dataprivacy\purpose;
|
||||
use data_privacy_testcase;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
global $CFG;
|
||||
|
||||
require_once('data_privacy_testcase.php');
|
||||
|
||||
@@ -39,7 +29,7 @@ require_once('data_privacy_testcase.php');
|
||||
* @copyright 2018 Michael Hawkins
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_dataprivacy_expired_data_requests_testcase extends data_privacy_testcase {
|
||||
class expired_data_requests_test extends data_privacy_testcase {
|
||||
|
||||
/**
|
||||
* Test tearDown.
|
||||
@@ -59,7 +49,7 @@ class tool_dataprivacy_expired_data_requests_testcase extends data_privacy_testc
|
||||
// Set up test users.
|
||||
$this->setAdminUser();
|
||||
$studentuser = $this->getDataGenerator()->create_user();
|
||||
$studentusercontext = context_user::instance($studentuser->id);
|
||||
$studentusercontext = \context_user::instance($studentuser->id);
|
||||
|
||||
$dpouser = $this->getDataGenerator()->create_user();
|
||||
$this->assign_site_dpo($dpouser);
|
||||
|
||||
@@ -14,13 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Unit tests for the filtered_userlist.
|
||||
*
|
||||
* @package tool_dataprivacy
|
||||
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace tool_dataprivacy;
|
||||
|
||||
/**
|
||||
* Unit tests for the filtered_userlist.
|
||||
@@ -29,7 +23,7 @@
|
||||
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_dataprivacy_filtered_userlist_testcase extends advanced_testcase {
|
||||
class filtered_userlist_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the apply_expired_contexts_filters function with arange of options.
|
||||
*
|
||||
|
||||
@@ -14,6 +14,13 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace tool_dataprivacy;
|
||||
|
||||
use data_privacy_testcase;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
require_once('data_privacy_testcase.php');
|
||||
|
||||
/**
|
||||
* Tests for the manager observer.
|
||||
*
|
||||
@@ -21,18 +28,7 @@
|
||||
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
require_once('data_privacy_testcase.php');
|
||||
|
||||
/**
|
||||
* API tests.
|
||||
*
|
||||
* @package tool_dataprivacy
|
||||
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_dataprivacy_manager_observer_testcase extends data_privacy_testcase {
|
||||
class manager_observer_test extends data_privacy_testcase {
|
||||
/**
|
||||
* Ensure that when users are configured as DPO, they are sent an message upon failure.
|
||||
*/
|
||||
|
||||
@@ -14,16 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Metadata registry tests.
|
||||
*
|
||||
* @package tool_dataprivacy
|
||||
* @copyright 2018 Adrian Greeve <adriangreeve.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
global $CFG;
|
||||
namespace tool_dataprivacy;
|
||||
|
||||
/**
|
||||
* Metadata registry tests.
|
||||
@@ -32,7 +23,7 @@ global $CFG;
|
||||
* @copyright 2018 Adrian Greeve <adriangreeve.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_dataprivacy_metadata_registry_testcase extends advanced_testcase {
|
||||
class metadata_registry_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Fetch the meta data and return it in a form that we can easily unit test.
|
||||
|
||||
@@ -14,18 +14,9 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Tests for the event observer.
|
||||
*
|
||||
* @package tool_dataprivacy
|
||||
* @copyright 2018 Mihail Geshoski <mihail@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace tool_dataprivacy;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
use \tool_dataprivacy\event\user_deleted_observer;
|
||||
use \tool_dataprivacy\api;
|
||||
use tool_dataprivacy\event\user_deleted_observer;
|
||||
|
||||
/**
|
||||
* Event observer test.
|
||||
@@ -34,7 +25,7 @@ use \tool_dataprivacy\api;
|
||||
* @copyright 2018 Mihail Geshoski <mihail@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_dataprivacy_user_deleted_observer_testcase extends advanced_testcase {
|
||||
class user_deleted_observer_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Ensure that a delete data request is created upon user deletion.
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
This file describes API changes in /admin/tool/dataprivacy/*
|
||||
Information provided here is intended especially for developers.
|
||||
|
||||
=== 4.0.2 ===
|
||||
* New `api::can_create_data_download_request_for_self` method for determining whether user has permission to create their
|
||||
own data download requests
|
||||
@@ -14,7 +14,9 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
namespace tool_generator;
|
||||
|
||||
use tool_generator_course_backend;
|
||||
|
||||
/**
|
||||
* Automated unit testing. This tests the 'make large course' backend,
|
||||
@@ -24,7 +26,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @copyright 2013 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_generator_maketestcourse_testcase extends advanced_testcase {
|
||||
class maketestcourse_test extends \advanced_testcase {
|
||||
/**
|
||||
* Creates a small test course and checks all the components have been put in place.
|
||||
*/
|
||||
@@ -52,7 +54,7 @@ class tool_generator_maketestcourse_testcase extends advanced_testcase {
|
||||
|
||||
// Get course details.
|
||||
$course = get_course($courseid);
|
||||
$context = context_course::instance($courseid);
|
||||
$context = \context_course::instance($courseid);
|
||||
$modinfo = get_fast_modinfo($course);
|
||||
|
||||
// Check course names.
|
||||
@@ -88,7 +90,7 @@ class tool_generator_maketestcourse_testcase extends advanced_testcase {
|
||||
|
||||
// Check it contains 2 files (the default txt and a dat file).
|
||||
$fs = get_file_storage();
|
||||
$resourcecontext = context_module::instance($resource->id);
|
||||
$resourcecontext = \context_module::instance($resource->id);
|
||||
$files = $fs->get_area_files($resourcecontext->id, 'mod_resource', 'content', false, 'filename', false);
|
||||
$files = array_values($files);
|
||||
$this->assertEquals(2, count($files));
|
||||
@@ -106,7 +108,7 @@ class tool_generator_maketestcourse_testcase extends advanced_testcase {
|
||||
$this->assertTrue($ok);
|
||||
|
||||
// Check it contains 2 files.
|
||||
$resourcecontext = context_module::instance($resource->id);
|
||||
$resourcecontext = \context_module::instance($resource->id);
|
||||
$files = $fs->get_area_files($resourcecontext->id, 'mod_resource', 'content', false, 'filename', false);
|
||||
$files = array_values($files);
|
||||
$this->assertEquals(2, count($files));
|
||||
@@ -155,7 +157,7 @@ class tool_generator_maketestcourse_testcase extends advanced_testcase {
|
||||
$lastusernumber = 0;
|
||||
$discussionstarters = array();
|
||||
foreach ($discussions as $discussion) {
|
||||
$usernumber = core_user::get_user($discussion->userid, 'id, idnumber')->idnumber;
|
||||
$usernumber = \core_user::get_user($discussion->userid, 'id, idnumber')->idnumber;
|
||||
|
||||
// Checks that the users are odd numbers.
|
||||
$this->assertEquals(1, $usernumber % 2);
|
||||
@@ -190,7 +192,7 @@ class tool_generator_maketestcourse_testcase extends advanced_testcase {
|
||||
$fs = get_file_storage();
|
||||
$resources = $modinfo->get_instances_of('resource');
|
||||
foreach ($resources as $resource) {
|
||||
$resourcecontext = context_module::instance($resource->id);
|
||||
$resourcecontext = \context_module::instance($resource->id);
|
||||
$files = $fs->get_area_files($resourcecontext->id, 'mod_resource', 'content', false, 'filename', false);
|
||||
foreach ($files as $file) {
|
||||
if ($file->get_mimetype() == 'application/octet-stream') {
|
||||
@@ -210,7 +212,7 @@ class tool_generator_maketestcourse_testcase extends advanced_testcase {
|
||||
$fs = get_file_storage();
|
||||
$resources = $modinfo->get_instances_of('resource');
|
||||
foreach ($resources as $resource) {
|
||||
$resourcecontext = context_module::instance($resource->id);
|
||||
$resourcecontext = \context_module::instance($resource->id);
|
||||
$files = $fs->get_area_files($resourcecontext->id, 'mod_resource', 'content', false, 'filename', false);
|
||||
foreach ($files as $file) {
|
||||
if ($file->get_mimetype() == 'application/octet-stream') {
|
||||
|
||||
@@ -22,27 +22,12 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tool_generator;
|
||||
|
||||
use tool_generator_site_backend;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Silly class to access site_backend internal methods.
|
||||
*
|
||||
* @package tool_generator
|
||||
* @copyright 2013 David Monllaó
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class testable_tool_generator_site_backend extends tool_generator_site_backend {
|
||||
|
||||
/**
|
||||
* Public accessor.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function get_last_testcourse_id() {
|
||||
return parent::get_last_testcourse_id();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unit test for the site generator
|
||||
*
|
||||
@@ -50,7 +35,7 @@ class testable_tool_generator_site_backend extends tool_generator_site_backend {
|
||||
* @copyright 2013 David Monllaó
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_generator_maketestsite_testcase extends advanced_testcase {
|
||||
class maketestsite_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Checks that site courses shortnames are properly generated.
|
||||
@@ -102,5 +87,22 @@ class tool_generator_maketestsite_testcase extends advanced_testcase {
|
||||
$lastshortname = testable_tool_generator_site_backend::get_last_testcourse_id();
|
||||
$this->assertEquals(20, $lastshortname);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Silly class to access site_backend internal methods.
|
||||
*
|
||||
* @copyright 2013 David Monllaó
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class testable_tool_generator_site_backend extends tool_generator_site_backend {
|
||||
|
||||
/**
|
||||
* Public accessor.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function get_last_testcourse_id() {
|
||||
return parent::get_last_testcourse_id();
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 207 B After Width: | Height: | Size: 329 B |
@@ -1,3 +1,3 @@
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
|
||||
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
|
||||
]><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" preserveAspectRatio="xMinYMid meet" overflow="visible"><path d="M16 9v6c0 .5-.5 1-1 1H1c-.5 0-1-.5-1-1V9c0-.5.5-1 1-1h1c.5 0 1 .5 1 1v4h10V9c0-.5.5-1 1-1h1c.5 0 1 .5 1 1zm-3.6-3.9l-.7-.7c-.4-.4-1-.4-1.4 0l-.8.8V1c0-.5-.4-1-1-1h-1c-.5 0-1 .5-1 1v4.2l-.8-.8c-.4-.4-1-.4-1.4 0l-.7.7c-.4.4-.4 1 0 1.4l3.7 3.7c.2.2.5.3.7.3.3 0 .5-.1.7-.3l3.7-3.7c.4-.3.4-1 0-1.4z" fill="#999"/></svg>
|
||||
]><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" preserveAspectRatio="xMinYMid meet" overflow="visible"><path d="M16 9v6c0 .5-.5 1-1 1H1c-.5 0-1-.5-1-1V9c0-.5.5-1 1-1h1c.5 0 1 .5 1 1v4h10V9c0-.5.5-1 1-1h1c.5 0 1 .5 1 1zm-3.6-3.9l-.7-.7c-.4-.4-1-.4-1.4 0l-.8.8V1c0-.5-.4-1-1-1h-1c-.5 0-1 .5-1 1v4.2l-.8-.8c-.4-.4-1-.4-1.4 0l-.7.7c-.4.4-.4 1 0 1.4l3.7 3.7c.2.2.5.3.7.3.3 0 .5-.1.7-.3l3.7-3.7c.4-.3.4-1 0-1.4z" fill="#888"/></svg>
|
||||
|
Before Width: | Height: | Size: 618 B After Width: | Height: | Size: 618 B |
@@ -15,14 +15,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Provides the unit tests class and some helper classes
|
||||
*
|
||||
* @package tool_installaddon
|
||||
* @category test
|
||||
* @copyright 2013 David Mudrak <david@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace tool_installaddon;
|
||||
|
||||
use testable_tool_installaddon_installer;
|
||||
use tool_installaddon_installer;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
@@ -32,10 +28,12 @@ require_once(__DIR__.'/fixtures/testable_installer.php');
|
||||
/**
|
||||
* Unit tests for the {@link tool_installaddon_installer} class
|
||||
*
|
||||
* @package tool_installaddon
|
||||
* @category test
|
||||
* @copyright 2013 David Mudrak <david@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_installaddon_installer_testcase extends advanced_testcase {
|
||||
class installer_test extends \advanced_testcase {
|
||||
|
||||
public function test_get_addons_repository_url() {
|
||||
$installer = testable_tool_installaddon_installer::instance();
|
||||
|
||||
@@ -22,15 +22,17 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
namespace tool_langimport;
|
||||
|
||||
/**
|
||||
* Tests for \tool_langimport\locale class.
|
||||
*
|
||||
* @package tool_langimport
|
||||
* @category test
|
||||
* @copyright 2018 Université Rennes 2 {@link https://www.univ-rennes2.fr}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class locale_testcase extends \advanced_testcase {
|
||||
class locale_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test that \tool_langimport\locale::check_locale_availability() works as expected.
|
||||
*
|
||||
@@ -65,7 +67,7 @@ class locale_testcase extends \advanced_testcase {
|
||||
|
||||
// Test an invalid parameter.
|
||||
$locale = new \tool_langimport\locale();
|
||||
$this->expectException(coding_exception::class);
|
||||
$this->expectException(\coding_exception::class);
|
||||
$locale->check_locale_availability('');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,5 +45,8 @@ function xmldb_tool_log_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -46,5 +46,8 @@ function xmldb_logstore_database_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -46,5 +46,8 @@ function xmldb_logstore_standard_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 345 B After Width: | Height: | Size: 510 B |
@@ -9,7 +9,7 @@
|
||||
xml:space="preserve" preserveAspectRatio="xMinYMid meet">
|
||||
<defs>
|
||||
</defs>
|
||||
<path style="fill:#999999;" d="M8.5,9.5C8.8,10,9,10.6,9,11.2c0,0.6-0.3,1.1-0.7,1.6l-2.5,2.5C5.2,15.8,4.7,16,4,16
|
||||
<path style="fill:#888;" d="M8.5,9.5C8.8,10,9,10.6,9,11.2c0,0.6-0.3,1.1-0.7,1.6l-2.5,2.5C5.2,15.8,4.7,16,4,16
|
||||
s-1.3-0.2-1.7-0.7l-1.5-1.5C0.2,13.3,0,12.7,0,12c0-0.7,0.2-1.3,0.7-1.7l2.5-2.5C3.7,7.3,4.3,7,5,7c0.5,0,1,0.2,1.5,0.5l-1,1
|
||||
C5.3,8.5,5.2,8.4,5,8.4c-0.3,0-0.5,0.1-0.8,0.3l-2.5,2.5c-0.2,0.2-0.3,0.5-0.3,0.7c0,0.3,0.1,0.5,0.3,0.7l1.5,1.5
|
||||
c0.2,0.2,0.5,0.3,0.7,0.3s0.5-0.1,0.7-0.3l2.5-2.5c0.2-0.2,0.3-0.5,0.3-0.8c0-0.2,0-0.3-0.1-0.4L8.5,9.5z M5,10L10,5
|
||||
|
||||
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
@@ -63,4 +63,67 @@ class behat_tool_lp extends behat_base {
|
||||
$this->execute('behat_general::i_click_on', [$xpathtarget, 'xpath_element']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert page names to URLs for steps like 'When I am on the "[identifier]" "[page type]" page'.
|
||||
*
|
||||
* Recognised page names are:
|
||||
* | pagetype | name meaning | description |
|
||||
* | Course competencies | Course name | The course competencies page |
|
||||
*
|
||||
* @param string $page identifies which type of page this is, e.g. 'Course competencies'.
|
||||
* @param string $identifier identifies the particular page, e.g. 'C1'.
|
||||
* @return moodle_url the corresponding URL.
|
||||
* @throws Exception with a meaningful error message if the specified page cannot be found.
|
||||
*/
|
||||
protected function resolve_page_instance_url(string $page, string $identifier): moodle_url {
|
||||
switch (strtolower($page)) {
|
||||
case 'course competencies':
|
||||
$courseid = $this->get_course_id($identifier);
|
||||
return new moodle_url('/admin/tool/lp/coursecompetencies.php', [
|
||||
'courseid' => $courseid,
|
||||
]);
|
||||
default:
|
||||
throw new Exception("Unrecognised page type '{$page}'");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of the exact named selectors for the component.
|
||||
*
|
||||
* @return behat_component_named_selector[]
|
||||
*/
|
||||
public static function get_exact_named_selectors(): array {
|
||||
return [
|
||||
new behat_component_named_selector('competency', [
|
||||
"//*[@data-region='coursecompetencies']//table[contains(@class,'managecompetencies')]".
|
||||
"//tr[contains(., //a[@title='View details'][contains(., %locator%)])]",
|
||||
]),
|
||||
new behat_component_named_selector('learning plan', [
|
||||
"//*[@data-region='plan-competencies']//table[contains(@class,'managecompetencies')]".
|
||||
"//tr[@data-node='user-competency'][contains(., //a[@data-usercompetency='true'][contains(., %locator%)])]",
|
||||
]),
|
||||
new behat_component_named_selector('competency description', [
|
||||
"//td/p[contains(., %locator%)]",
|
||||
]),
|
||||
new behat_component_named_selector('competency grade', [
|
||||
"//span[contains(concat(' ', normalize-space(@class), ' '), ' badge ')][contains(., %locator%)]",
|
||||
]),
|
||||
new behat_component_named_selector('learning plan rating', [
|
||||
"//td[position()=2][contains(., %locator%)]",
|
||||
]),
|
||||
new behat_component_named_selector('learning plan proficiency', [
|
||||
"//td[position()=3][contains(., %locator%)]",
|
||||
]),
|
||||
new behat_component_named_selector('competency page proficiency', [
|
||||
"//dt[contains(., 'Proficient')]/following-sibling::dd[1][contains(., %locator%)]",
|
||||
]),
|
||||
new behat_component_named_selector('competency page rating', [
|
||||
"//dt[contains(., 'Rating')]/following-sibling::dd[1][contains(., %locator%)]",
|
||||
]),
|
||||
new behat_component_named_selector('competency page related competency', [
|
||||
"//*[@data-region='relatedcompetencies']//a[contains(., %locator%)]",
|
||||
]),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,187 @@
|
||||
@tool @tool_lp @javascript
|
||||
Feature: View competencies
|
||||
In order to access competency information
|
||||
As a user
|
||||
I need to view user competencies
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname |
|
||||
| student1 | Student | first |
|
||||
| teacher1 | Teacher | first |
|
||||
And the following "system role assigns" exist:
|
||||
| user | role | contextlevel |
|
||||
| teacher1 | editingteacher | System |
|
||||
And the following "permission overrides" exist:
|
||||
| capability | permission | role | contextlevel | reference |
|
||||
| moodle/competency:planview | Allow | editingteacher | System | |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname |
|
||||
| Course 1 | C1 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| student1 | C1 | student |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
And the following "scales" exist:
|
||||
| name | scale |
|
||||
| Test Scale | Bad, Good, Great |
|
||||
And the following "core_competency > frameworks" exist:
|
||||
| shortname | idnumber | scale |
|
||||
| Cookery | cookery | Test Scale |
|
||||
| Literacy | literacy | Test Scale |
|
||||
And the following "core_competency > competencies" exist:
|
||||
| shortname | idnumber | description | competencyframework |
|
||||
| Salads | salads | Salads are important | cookery |
|
||||
| Desserts | desserts | Desserts are important | cookery |
|
||||
| Cakes | cakes | Cakes are important | cookery |
|
||||
| Reading | reading | Reading is important | literacy |
|
||||
| Writing | writing | Writing is important | literacy |
|
||||
And the following "core_competency > related_competencies" exist:
|
||||
| competency | relatedcompetency |
|
||||
| desserts | cakes |
|
||||
And the following "core_competency > plans" exist:
|
||||
| name | description | competencies | user |
|
||||
| Cookery | Cookery is important | salads, desserts, cakes | student1 |
|
||||
| Literacy | Literacy is important | reading, writing | student1 |
|
||||
And the following "core_competency > course_competencies" exist:
|
||||
| course | competency |
|
||||
| C1 | salads |
|
||||
| C1 | desserts |
|
||||
| C1 | cakes |
|
||||
| C1 | reading |
|
||||
| C1 | writing |
|
||||
And the following "core_competency > user_competency" exist:
|
||||
| competency | user | grade |
|
||||
| salads | student1 | Good |
|
||||
| desserts | student1 | Great |
|
||||
| cakes | student1 | Great |
|
||||
And the following "core_competency > user_competency_courses" exist:
|
||||
| course | competency | user | grade |
|
||||
| C1 | salads | student1 | Good |
|
||||
| C1 | desserts | student1 | Great |
|
||||
| C1 | cakes | student1 | Great |
|
||||
|
||||
Scenario: Student view
|
||||
# Course competencies
|
||||
Given I am on the "C1" "tool_lp > course competencies" page logged in as "student1"
|
||||
Then I should see "You are proficient in 3 out of 5 competencies in this course"
|
||||
|
||||
And "Salads are important" "tool_lp > competency description" should exist in the "Salads" "tool_lp > competency"
|
||||
And "Good" "tool_lp > competency grade" should exist in the "Salads" "tool_lp > competency"
|
||||
|
||||
And "Desserts are important" "tool_lp > competency description" should exist in the "Desserts" "tool_lp > competency"
|
||||
And "Great" "tool_lp > competency grade" should exist in the "Desserts" "tool_lp > competency"
|
||||
|
||||
And "Cakes are important" "tool_lp > competency description" should exist in the "Cakes" "tool_lp > competency"
|
||||
And "Great" "tool_lp > competency grade" should exist in the "Cakes" "tool_lp > competency"
|
||||
|
||||
And "Reading is important" "tool_lp > competency description" should exist in the "Reading" "tool_lp > competency"
|
||||
And "Good" "tool_lp > competency grade" should not exist in the "Reading" "tool_lp > competency"
|
||||
And "Great" "tool_lp > competency grade" should not exist in the "Reading" "tool_lp > competency"
|
||||
And "Bad" "tool_lp > competency grade" should not exist in the "Reading" "tool_lp > competency"
|
||||
|
||||
And "Writing is important" "tool_lp > competency description" should exist in the "Writing" "tool_lp > competency"
|
||||
And "Good" "tool_lp > competency grade" should not exist in the "Writing" "tool_lp > competency"
|
||||
And "Great" "tool_lp > competency grade" should not exist in the "Writing" "tool_lp > competency"
|
||||
And "Bad" "tool_lp > competency grade" should not exist in the "Writing" "tool_lp > competency"
|
||||
|
||||
# Course competencies details
|
||||
And I click on "Desserts" "link" in the "Desserts" "tool_lp > competency"
|
||||
And I should see "Desserts are important"
|
||||
And "Yes" "tool_lp > competency page proficiency" should exist
|
||||
And "Great" "tool_lp > competency page rating" should exist
|
||||
|
||||
# Course competencies summary
|
||||
And I click on "Cakes" "link"
|
||||
And I should see "Cakes are important"
|
||||
|
||||
# Learning plans
|
||||
And I click on "Close" "button" in the "Cakes" "dialogue"
|
||||
And I follow "Profile" in the user menu
|
||||
And I click on "Learning plans" "link"
|
||||
And I should see "Cookery"
|
||||
And I should see "Literacy"
|
||||
|
||||
# Learning plans details
|
||||
And I click on "Cookery" "link"
|
||||
And I should see "Cookery is important"
|
||||
And I should see "3 out of 3 competencies are proficient"
|
||||
|
||||
And "Good" "tool_lp > learning plan rating" should exist in the "Salads" "tool_lp > learning plan"
|
||||
And "Yes" "tool_lp > learning plan proficiency" should exist in the "Salads" "tool_lp > learning plan"
|
||||
|
||||
And "Great" "tool_lp > learning plan rating" should exist in the "Desserts" "tool_lp > learning plan"
|
||||
And "Yes" "tool_lp > learning plan proficiency" should exist in the "Desserts" "tool_lp > learning plan"
|
||||
|
||||
And "Great" "tool_lp > learning plan rating" should exist in the "Cakes" "tool_lp > learning plan"
|
||||
And "Yes" "tool_lp > learning plan proficiency" should exist in the "Cakes" "tool_lp > learning plan"
|
||||
|
||||
And I should not see "Literacy"
|
||||
And I should not see "Reading"
|
||||
And I should not see "Writing"
|
||||
|
||||
# Learning plans competency details
|
||||
And I click on "Desserts" "link" in the "Desserts" "tool_lp > learning plan"
|
||||
And I should see "Desserts are important"
|
||||
And "Yes" "tool_lp > competency page proficiency" should exist
|
||||
And "Great" "tool_lp > competency page rating" should exist
|
||||
|
||||
# Learning plans competency summary
|
||||
And I click on "Cakes cakes" "link"
|
||||
And I should see "Cakes are important"
|
||||
|
||||
Scenario: Teacher view
|
||||
# Participant competencies
|
||||
Given I am on the "C1" "report_competency > breakdown" page logged in as "teacher1"
|
||||
Then I should see "Student first"
|
||||
And "Good" "report_competency > breakdown rating" should exist in the "Salads" "report_competency > breakdown"
|
||||
And "Great" "report_competency > breakdown rating" should exist in the "Desserts" "report_competency > breakdown"
|
||||
And "Great" "report_competency > breakdown rating" should exist in the "Cakes" "report_competency > breakdown"
|
||||
And "Not rated" "report_competency > breakdown rating" should exist in the "Reading" "report_competency > breakdown"
|
||||
And "Not rated" "report_competency > breakdown rating" should exist in the "Writing" "report_competency > breakdown"
|
||||
|
||||
# Participant competencies details
|
||||
And I click on "Great" "report_competency > breakdown rating" in the "Desserts" "report_competency > breakdown"
|
||||
And "Yes" "tool_lp > competency page proficiency" should exist
|
||||
And "Great" "tool_lp > competency page rating" should exist
|
||||
|
||||
# Participant competencies summary
|
||||
And I click on "Cakes" "tool_lp > competency page related competency"
|
||||
And I should see "Cakes are important"
|
||||
|
||||
# Participant learning plans
|
||||
And I click on "Close" "button" in the "Cakes" "dialogue"
|
||||
And I click on "Close" "button" in the "User competency summary" "dialogue"
|
||||
And I navigate to course participants
|
||||
And I click on "Student first" "link"
|
||||
And I click on "Learning plans" "link"
|
||||
And I should see "Cookery"
|
||||
And I should see "Literacy"
|
||||
|
||||
# Participant learning plans details
|
||||
And I click on "Cookery" "link"
|
||||
And I should see "Cookery is important"
|
||||
And I should see "3 out of 3 competencies are proficient"
|
||||
|
||||
And "Good" "tool_lp > learning plan rating" should exist in the "Salads" "tool_lp > learning plan"
|
||||
And "Yes" "tool_lp > learning plan proficiency" should exist in the "Salads" "tool_lp > learning plan"
|
||||
|
||||
And "Great" "tool_lp > learning plan rating" should exist in the "Desserts" "tool_lp > learning plan"
|
||||
And "Yes" "tool_lp > learning plan proficiency" should exist in the "Desserts" "tool_lp > learning plan"
|
||||
|
||||
And "Great" "tool_lp > learning plan rating" should exist in the "Cakes" "tool_lp > learning plan"
|
||||
And "Yes" "tool_lp > learning plan proficiency" should exist in the "Cakes" "tool_lp > learning plan"
|
||||
|
||||
And I should not see "Literacy"
|
||||
And I should not see "Reading"
|
||||
And I should not see "Writing"
|
||||
|
||||
# Learning plans competency details
|
||||
And I click on "Desserts" "link"
|
||||
And I should see "Desserts are important"
|
||||
And "Yes" "tool_lp > competency page proficiency" should exist
|
||||
And "Great" "tool_lp > competency page rating" should exist
|
||||
|
||||
# Learning plans competency summary
|
||||
And I click on "Cakes" "tool_lp > competency page related competency"
|
||||
And I should see "Cakes are important"
|
||||
@@ -27,7 +27,8 @@ require_once($CFG->libdir . '/externallib.php');
|
||||
|
||||
$userid = required_param('userid', PARAM_INT); // The user id the key belongs to (for double-checking).
|
||||
$key = required_param('key', PARAM_ALPHANUMEXT); // The key generated by the tool_mobile_external::get_autologin_key() external function.
|
||||
$urltogo = optional_param('urltogo', $CFG->wwwroot, PARAM_URL); // URL to redirect.
|
||||
$urltogo = optional_param('urltogo', $CFG->wwwroot, PARAM_LOCALURL); // URL to redirect.
|
||||
$urltogo = $urltogo ?: $CFG->wwwroot;
|
||||
|
||||
$context = context_system::instance();
|
||||
$PAGE->set_context($context);
|
||||
|
||||
@@ -504,6 +504,7 @@ class api {
|
||||
'NoDelegate_H5POffline' => new lang_string('h5poffline', 'tool_mobile'),
|
||||
'NoDelegate_DarkMode' => new lang_string('darkmode', 'tool_mobile'),
|
||||
'CoreFilterDelegate' => new lang_string('type_filter_plural', 'plugin'),
|
||||
'CoreReportBuilderDelegate' => new lang_string('reportbuilder', 'core_reportbuilder'),
|
||||
),
|
||||
"$mainmenu" => array(
|
||||
'$mmSideMenuDelegate_mmaFrontpage' => new lang_string('sitehome'),
|
||||
|
||||
@@ -51,5 +51,8 @@ function xmldb_tool_mobile_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -45,5 +45,8 @@ function xmldb_tool_monitor_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -14,14 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Unit tests for event observers.
|
||||
*
|
||||
* @package tool_monitor
|
||||
* @category test
|
||||
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace tool_monitor;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
@@ -30,11 +23,14 @@ require_once($CFG->dirroot . '/blog/locallib.php');
|
||||
require_once($CFG->dirroot . '/blog/lib.php');
|
||||
|
||||
/**
|
||||
* Class tool_monitor_eventobservers_testcase
|
||||
* Unit tests for event observers.
|
||||
*
|
||||
* Tests for event observers
|
||||
* @package tool_monitor
|
||||
* @category test
|
||||
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_monitor_eventobservers_testcase extends advanced_testcase {
|
||||
class eventobservers_test extends \advanced_testcase {
|
||||
/**
|
||||
* Set up method.
|
||||
*/
|
||||
@@ -57,12 +53,12 @@ class tool_monitor_eventobservers_testcase extends advanced_testcase {
|
||||
$course2 = $this->getDataGenerator()->create_course();
|
||||
$monitorgenerator = $this->getDataGenerator()->get_plugin_generator('tool_monitor');
|
||||
|
||||
$rule = new stdClass();
|
||||
$rule = new \stdClass();
|
||||
$rule->userid = $user->id;
|
||||
$rule->courseid = $course1->id;
|
||||
$rule->plugin = 'test';
|
||||
|
||||
$sub = new stdClass();
|
||||
$sub = new \stdClass();
|
||||
$sub->courseid = $course1->id;
|
||||
$sub->userid = $user->id;
|
||||
|
||||
@@ -83,7 +79,7 @@ class tool_monitor_eventobservers_testcase extends advanced_testcase {
|
||||
}
|
||||
|
||||
// Add a site rule.
|
||||
$rule = new stdClass();
|
||||
$rule = new \stdClass();
|
||||
$rule->userid = $user->id;
|
||||
$rule->courseid = 0;
|
||||
$rule->plugin = 'core';
|
||||
@@ -135,7 +131,7 @@ class tool_monitor_eventobservers_testcase extends advanced_testcase {
|
||||
// Fire a bunch of events.
|
||||
// Trigger a bunch of other events.
|
||||
$eventparams = array(
|
||||
'context' => context_course::instance($course->id)
|
||||
'context' => \context_course::instance($course->id)
|
||||
);
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
\core\event\course_viewed::create($eventparams)->trigger();
|
||||
@@ -148,14 +144,14 @@ class tool_monitor_eventobservers_testcase extends advanced_testcase {
|
||||
$this->assertEquals(0, $DB->count_records('tool_monitor_events'));
|
||||
|
||||
// Now, let's create a rule so an event can be stored.
|
||||
$rule = new stdClass();
|
||||
$rule = new \stdClass();
|
||||
$rule->courseid = $course->id;
|
||||
$rule->plugin = 'mod_book';
|
||||
$rule->eventname = '\mod_book\event\course_module_instance_list_viewed';
|
||||
$rule = $monitorgenerator->create_rule($rule);
|
||||
|
||||
// Let's subscribe to this rule.
|
||||
$sub = new stdClass;
|
||||
$sub = new \stdClass;
|
||||
$sub->courseid = $course->id;
|
||||
$sub->ruleid = $rule->id;
|
||||
$sub->userid = $user->id;
|
||||
@@ -187,14 +183,14 @@ class tool_monitor_eventobservers_testcase extends advanced_testcase {
|
||||
$DB->delete_records('tool_monitor_events');
|
||||
|
||||
// Now, let's create a site wide rule.
|
||||
$rule = new stdClass();
|
||||
$rule = new \stdClass();
|
||||
$rule->courseid = 0;
|
||||
$rule->plugin = 'mod_book';
|
||||
$rule->eventname = '\mod_book\event\course_module_instance_list_viewed';
|
||||
$rule = $monitorgenerator->create_rule($rule);
|
||||
|
||||
// Let's subscribe to this rule.
|
||||
$sub = new stdClass;
|
||||
$sub = new \stdClass;
|
||||
$sub->courseid = 0;
|
||||
$sub->ruleid = $rule->id;
|
||||
$sub->userid = $user->id;
|
||||
@@ -231,14 +227,14 @@ class tool_monitor_eventobservers_testcase extends advanced_testcase {
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$toolgenerator = $this->getDataGenerator()->get_plugin_generator('tool_monitor');
|
||||
|
||||
$rulerecord = new stdClass();
|
||||
$rulerecord = new \stdClass();
|
||||
$rulerecord->courseid = $course->id;
|
||||
$rulerecord->eventname = '\mod_book\event\course_module_instance_list_viewed';
|
||||
$rulerecord->frequency = 1;
|
||||
|
||||
$rule = $toolgenerator->create_rule($rulerecord);
|
||||
|
||||
$subrecord = new stdClass();
|
||||
$subrecord = new \stdClass();
|
||||
$subrecord->courseid = $course->id;
|
||||
$subrecord->ruleid = $rule->id;
|
||||
$subrecord->userid = $USER->id;
|
||||
@@ -279,7 +275,7 @@ class tool_monitor_eventobservers_testcase extends advanced_testcase {
|
||||
$DB->delete_records('tool_monitor_events');
|
||||
|
||||
// Now let us create a rule specific to a module instance.
|
||||
$cm = new stdClass();
|
||||
$cm = new \stdClass();
|
||||
$cm->course = $course->id;
|
||||
$book = $this->getDataGenerator()->create_module('book', $cm);
|
||||
$rulerecord->eventname = '\mod_book\event\course_module_viewed';
|
||||
@@ -290,7 +286,7 @@ class tool_monitor_eventobservers_testcase extends advanced_testcase {
|
||||
|
||||
// Let us trigger events.
|
||||
$params = array(
|
||||
'context' => context_module::instance($book->cmid),
|
||||
'context' => \context_module::instance($book->cmid),
|
||||
'objectid' => $book->id
|
||||
);
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
@@ -337,10 +333,10 @@ class tool_monitor_eventobservers_testcase extends advanced_testcase {
|
||||
$toolgenerator->create_subscription($subrecord);
|
||||
|
||||
// Let us trigger events.
|
||||
$blog = new blog_entry();
|
||||
$blog = new \blog_entry();
|
||||
$blog->subject = "Subject of blog";
|
||||
$blog->userid = $USER->id;
|
||||
$states = blog_entry::get_applicable_publish_states();
|
||||
$states = \blog_entry::get_applicable_publish_states();
|
||||
$blog->publishstate = reset($states);
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
$newblog = fullclone($blog);
|
||||
@@ -367,14 +363,14 @@ class tool_monitor_eventobservers_testcase extends advanced_testcase {
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$toolgenerator = $this->getDataGenerator()->get_plugin_generator('tool_monitor');
|
||||
|
||||
$rulerecord = new stdClass();
|
||||
$rulerecord = new \stdClass();
|
||||
$rulerecord->courseid = $course->id;
|
||||
$rulerecord->eventname = '\mod_book\event\course_module_instance_list_viewed';
|
||||
$rulerecord->frequency = 5;
|
||||
|
||||
$rule = $toolgenerator->create_rule($rulerecord);
|
||||
|
||||
$subrecord = new stdClass();
|
||||
$subrecord = new \stdClass();
|
||||
$subrecord->courseid = $course->id;
|
||||
$subrecord->ruleid = $rule->id;
|
||||
$subrecord->userid = $USER->id;
|
||||
@@ -416,7 +412,7 @@ class tool_monitor_eventobservers_testcase extends advanced_testcase {
|
||||
*
|
||||
* @param phpunit_message_sink $msgsink Message sink
|
||||
*/
|
||||
protected function verify_processed_data(phpunit_message_sink $msgsink) {
|
||||
protected function verify_processed_data(\phpunit_message_sink $msgsink) {
|
||||
global $DB, $USER;
|
||||
|
||||
$recordexists = $DB->count_records('task_adhoc', array('component' => 'tool_monitor'));
|
||||
@@ -435,7 +431,7 @@ class tool_monitor_eventobservers_testcase extends advanced_testcase {
|
||||
*
|
||||
* @param phpunit_message_sink $msgsink Message sink
|
||||
*/
|
||||
protected function verify_message_not_sent_yet(phpunit_message_sink $msgsink) {
|
||||
protected function verify_message_not_sent_yet(\phpunit_message_sink $msgsink) {
|
||||
$msgs = $msgsink->get_messages();
|
||||
$this->assertCount(0, $msgs);
|
||||
$msgsink->clear();
|
||||
@@ -457,12 +453,12 @@ class tool_monitor_eventobservers_testcase extends advanced_testcase {
|
||||
$context = \context_user::instance($USER->id, IGNORE_MISSING);
|
||||
|
||||
// Creating book.
|
||||
$cm = new stdClass();
|
||||
$cm = new \stdClass();
|
||||
$cm->course = $course->id;
|
||||
$book = $this->getDataGenerator()->create_module('book', $cm);
|
||||
|
||||
// Creating rule.
|
||||
$rulerecord = new stdClass();
|
||||
$rulerecord = new \stdClass();
|
||||
$rulerecord->courseid = $course->id;
|
||||
$rulerecord->eventname = '\mod_book\event\course_module_viewed';
|
||||
$rulerecord->cmid = $book->cmid;
|
||||
@@ -478,7 +474,7 @@ class tool_monitor_eventobservers_testcase extends advanced_testcase {
|
||||
$rule = $toolgenerator->create_rule($rulerecord);
|
||||
|
||||
// Creating subscription.
|
||||
$subrecord = new stdClass();
|
||||
$subrecord = new \stdClass();
|
||||
$subrecord->courseid = $course->id;
|
||||
$subrecord->ruleid = $rule->id;
|
||||
$subrecord->userid = $USER->id;
|
||||
@@ -486,7 +482,7 @@ class tool_monitor_eventobservers_testcase extends advanced_testcase {
|
||||
|
||||
// Now let us trigger the event.
|
||||
$params = array(
|
||||
'context' => context_module::instance($book->cmid),
|
||||
'context' => \context_module::instance($book->cmid),
|
||||
'objectid' => $book->id
|
||||
);
|
||||
|
||||
@@ -496,7 +492,7 @@ class tool_monitor_eventobservers_testcase extends advanced_testcase {
|
||||
$msgs = $msgsink->get_messages();
|
||||
$msg = array_pop($msgs);
|
||||
|
||||
$modurl = new moodle_url('/mod/book/view.php', array('id' => $book->cmid));
|
||||
$modurl = new \moodle_url('/mod/book/view.php', array('id' => $book->cmid));
|
||||
|
||||
$this->assertMatchesRegularExpression('~<h2>.*' . preg_quote($event->get_url()->out(), '~') . '.*</h2>~',
|
||||
$msg->fullmessagehtml);
|
||||
@@ -529,12 +525,12 @@ class tool_monitor_eventobservers_testcase extends advanced_testcase {
|
||||
$course2 = $this->getDataGenerator()->create_course();
|
||||
$monitorgenerator = $this->getDataGenerator()->get_plugin_generator('tool_monitor');
|
||||
|
||||
$rule = new stdClass();
|
||||
$rule = new \stdClass();
|
||||
$rule->userid = $user->id;
|
||||
$rule->courseid = $course1->id;
|
||||
$rule->plugin = 'test';
|
||||
|
||||
$sub = new stdClass();
|
||||
$sub = new \stdClass();
|
||||
$sub->courseid = $course1->id;
|
||||
$sub->userid = $user->id;
|
||||
|
||||
@@ -585,16 +581,16 @@ class tool_monitor_eventobservers_testcase extends advanced_testcase {
|
||||
$monitorgenerator = $this->getDataGenerator()->get_plugin_generator('tool_monitor');
|
||||
|
||||
// Now let us create a rule specific to a module instance.
|
||||
$cm = new stdClass();
|
||||
$cm = new \stdClass();
|
||||
$cm->course = $course1->id;
|
||||
$book = $this->getDataGenerator()->create_module('book', $cm);
|
||||
|
||||
$rule = new stdClass();
|
||||
$rule = new \stdClass();
|
||||
$rule->userid = $user->id;
|
||||
$rule->courseid = $course1->id;
|
||||
$rule->plugin = 'test';
|
||||
|
||||
$sub = new stdClass();
|
||||
$sub = new \stdClass();
|
||||
$sub->courseid = $course1->id;
|
||||
$sub->userid = $user->id;
|
||||
$sub->cmid = $book->cmid;
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace tool_monitor;
|
||||
|
||||
/**
|
||||
* Unit tests for rule manager api.
|
||||
*
|
||||
@@ -22,17 +24,7 @@
|
||||
* @copyright 2014 onwards Simey Lameze <simey@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
global $CFG;
|
||||
|
||||
/**
|
||||
* Tests for rule manager.
|
||||
*
|
||||
* Class tool_monitor_rule_manager_testcase
|
||||
*/
|
||||
class tool_monitor_rule_manager_testcase extends advanced_testcase {
|
||||
class rule_manager_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Set up method.
|
||||
@@ -53,7 +45,7 @@ class tool_monitor_rule_manager_testcase extends advanced_testcase {
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$now = time();
|
||||
|
||||
$rule = new stdClass();
|
||||
$rule = new \stdClass();
|
||||
$rule->userid = $user->id;
|
||||
$rule->courseid = $course->id;
|
||||
$rule->name = 'test rule 1';
|
||||
@@ -98,7 +90,7 @@ class tool_monitor_rule_manager_testcase extends advanced_testcase {
|
||||
$monitorgenerator = $this->getDataGenerator()->get_plugin_generator('tool_monitor');
|
||||
$rule = $monitorgenerator->create_rule();
|
||||
|
||||
$ruledata = new stdClass;
|
||||
$ruledata = new \stdClass;
|
||||
$ruledata->id = $rule->id;
|
||||
$ruledata->frequency = 25;
|
||||
|
||||
@@ -119,10 +111,10 @@ class tool_monitor_rule_manager_testcase extends advanced_testcase {
|
||||
$course1 = $this->getDataGenerator()->create_course();
|
||||
$course2 = $this->getDataGenerator()->create_course();
|
||||
|
||||
$record = new stdClass();
|
||||
$record = new \stdClass();
|
||||
$record->courseid = $course1->id;
|
||||
|
||||
$record2 = new stdClass();
|
||||
$record2 = new \stdClass();
|
||||
$record2->courseid = $course2->id;
|
||||
|
||||
$ruleids = array();
|
||||
@@ -147,10 +139,10 @@ class tool_monitor_rule_manager_testcase extends advanced_testcase {
|
||||
|
||||
$monitorgenerator = $this->getDataGenerator()->get_plugin_generator('tool_monitor');
|
||||
|
||||
$record = new stdClass();
|
||||
$record = new \stdClass();
|
||||
$record->plugin = 'core';
|
||||
|
||||
$record2 = new stdClass();
|
||||
$record2 = new \stdClass();
|
||||
$record2->plugin = 'mod_assign';
|
||||
|
||||
$ruleids = array();
|
||||
@@ -175,10 +167,10 @@ class tool_monitor_rule_manager_testcase extends advanced_testcase {
|
||||
$monitorgenerator = $this->getDataGenerator()->get_plugin_generator('tool_monitor');
|
||||
$rule = $monitorgenerator->create_rule();
|
||||
|
||||
$record = new stdClass();
|
||||
$record = new \stdClass();
|
||||
$record->eventname = '\core\event\calendar_event_created';
|
||||
|
||||
$record2 = new stdClass();
|
||||
$record2 = new \stdClass();
|
||||
$record2->eventname = '\core\event\calendar_event_updated';
|
||||
|
||||
$ruleids = array();
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace tool_monitor;
|
||||
|
||||
/**
|
||||
* Unit tests for subscription manager api.
|
||||
*
|
||||
@@ -22,17 +24,7 @@
|
||||
* @copyright 2014 onwards Simey Lameze <simey@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
global $CFG;
|
||||
|
||||
/**
|
||||
* Tests for subscription manager.
|
||||
*
|
||||
* Class tool_monitor_subscription_manager_testcase.
|
||||
*/
|
||||
class tool_monitor_subscription_manager_testcase extends advanced_testcase {
|
||||
class subscription_manager_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test count_rule_subscriptions method.
|
||||
@@ -56,7 +48,7 @@ class tool_monitor_subscription_manager_testcase extends advanced_testcase {
|
||||
$this->assertEquals(0, $subs);
|
||||
|
||||
// Subscribe user 1 to rule 1.
|
||||
$record = new stdClass;
|
||||
$record = new \stdClass;
|
||||
$record->ruleid = $rule1->id;
|
||||
$record->userid = $user1->id;
|
||||
$monitorgenerator->create_subscription($record);
|
||||
@@ -75,4 +67,4 @@ class tool_monitor_subscription_manager_testcase extends advanced_testcase {
|
||||
$this->assertEquals(2, $subs1);
|
||||
$this->assertEquals(1, $subs2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
defined('MOODLE_INTERNAL') || exit();
|
||||
|
||||
namespace tool_monitor;
|
||||
|
||||
/**
|
||||
* Unit tests for the subscription class.
|
||||
@@ -24,7 +25,7 @@ defined('MOODLE_INTERNAL') || exit();
|
||||
* @copyright 2016 Jake Dallimore <jrhdallimore@gmail.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_monitor_subscription_testcase extends advanced_testcase {
|
||||
class subscription_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* @var \tool_monitor\subscription $subscription object.
|
||||
@@ -38,7 +39,7 @@ class tool_monitor_subscription_testcase extends advanced_testcase {
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
// Create the mock subscription.
|
||||
$sub = new stdClass();
|
||||
$sub = new \stdClass();
|
||||
$sub->id = 100;
|
||||
$sub->name = 'My test rule';
|
||||
$sub->courseid = 20;
|
||||
@@ -62,7 +63,7 @@ class tool_monitor_subscription_testcase extends advanced_testcase {
|
||||
*/
|
||||
public function test_magic_get() {
|
||||
$this->assertEquals(20, $this->subscription->courseid);
|
||||
$this->expectException(coding_exception::class);
|
||||
$this->expectException(\coding_exception::class);
|
||||
$this->subscription->ruleid;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
defined('MOODLE_INTERNAL') || exit();
|
||||
|
||||
namespace tool_monitor;
|
||||
|
||||
/**
|
||||
* Unit tests for the tool_monitor clean events task.
|
||||
@@ -24,7 +25,7 @@ defined('MOODLE_INTERNAL') || exit();
|
||||
* @copyright 2016 Jake Dallimore <jrhdallimore@gmail.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_monitor_task_check_subscriptions_testcase extends advanced_testcase {
|
||||
class task_check_subscriptions_test extends \advanced_testcase {
|
||||
|
||||
private $course;
|
||||
private $user;
|
||||
@@ -45,7 +46,7 @@ class tool_monitor_task_check_subscriptions_testcase extends advanced_testcase {
|
||||
$this->user = $this->getDataGenerator()->create_user();
|
||||
$this->course = $this->getDataGenerator()->create_course();
|
||||
|
||||
$rule = new stdClass();
|
||||
$rule = new \stdClass();
|
||||
$rule->userid = 2; // Rule created by admin.
|
||||
$rule->courseid = $this->course->id;
|
||||
$rule->plugin = 'mod_book';
|
||||
@@ -54,7 +55,7 @@ class tool_monitor_task_check_subscriptions_testcase extends advanced_testcase {
|
||||
$monitorgenerator = $this->getDataGenerator()->get_plugin_generator('tool_monitor');
|
||||
$this->rule = $monitorgenerator->create_rule($rule);
|
||||
|
||||
$sub = new stdClass();
|
||||
$sub = new \stdClass();
|
||||
$sub->courseid = $this->course->id;
|
||||
$sub->userid = $this->user->id;
|
||||
$sub->ruleid = $this->rule->id;
|
||||
@@ -90,7 +91,7 @@ class tool_monitor_task_check_subscriptions_testcase extends advanced_testcase {
|
||||
public function test_site_level_subscription() {
|
||||
// Create a site level subscription.
|
||||
$monitorgenerator = $this->getDataGenerator()->get_plugin_generator('tool_monitor');
|
||||
$sub = new stdClass();
|
||||
$sub = new \stdClass();
|
||||
$sub->userid = $this->user->id;
|
||||
$sub->ruleid = $this->rule->id;
|
||||
$this->subscription = $monitorgenerator->create_subscription($sub);
|
||||
@@ -104,7 +105,7 @@ class tool_monitor_task_check_subscriptions_testcase extends advanced_testcase {
|
||||
$this->assertEquals(false, \tool_monitor\subscription_manager::subscription_is_active($this->subscription));
|
||||
|
||||
// Now, assign the user as a teacher role at system context.
|
||||
$this->getDataGenerator()->role_assign($this->teacherrole->id, $this->user->id, context_system::instance());
|
||||
$this->getDataGenerator()->role_assign($this->teacherrole->id, $this->user->id, \context_system::instance());
|
||||
|
||||
// Run the task.
|
||||
$task = new \tool_monitor\task\check_subscriptions();
|
||||
@@ -238,7 +239,7 @@ class tool_monitor_task_check_subscriptions_testcase extends advanced_testcase {
|
||||
$book = $this->getDataGenerator()->create_module('book', array('course' => $this->course->id));
|
||||
|
||||
// And add a subscription to it.
|
||||
$sub = new stdClass();
|
||||
$sub = new \stdClass();
|
||||
$sub->courseid = $this->course->id;
|
||||
$sub->userid = $this->user->id;
|
||||
$sub->ruleid = $this->rule->id;
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace tool_monitor;
|
||||
|
||||
/**
|
||||
* Unit tests for the tool_monitor clean events task.
|
||||
*
|
||||
@@ -22,15 +24,7 @@
|
||||
* @copyright 2014 Mark Nelson <markn@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
global $CFG;
|
||||
|
||||
/**
|
||||
* Class used to test the tool_monitor clean events task.
|
||||
*/
|
||||
class tool_monitor_task_clean_events_testcase extends advanced_testcase {
|
||||
class task_clean_events_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test set up.
|
||||
@@ -51,16 +45,16 @@ class tool_monitor_task_clean_events_testcase extends advanced_testcase {
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$bookgenerator = $this->getDataGenerator()->get_plugin_generator('mod_book');
|
||||
$book = $this->getDataGenerator()->create_module('book', array('course' => $course->id));
|
||||
$bookcontext = context_module::instance($book->cmid);
|
||||
$bookcontext = \context_module::instance($book->cmid);
|
||||
$bookchapter = $bookgenerator->create_chapter(array('bookid' => $book->id));
|
||||
$course2 = $this->getDataGenerator()->create_course();
|
||||
$book2 = $this->getDataGenerator()->create_module('book', array('course' => $course2->id));
|
||||
$book2context = context_module::instance($book2->cmid);
|
||||
$book2context = \context_module::instance($book2->cmid);
|
||||
$book2chapter = $bookgenerator->create_chapter(array('bookid' => $book2->id));
|
||||
$monitorgenerator = $this->getDataGenerator()->get_plugin_generator('tool_monitor');
|
||||
|
||||
// Let's set some data for the rules we need before we can generate them.
|
||||
$rule = new stdClass();
|
||||
$rule = new \stdClass();
|
||||
$rule->userid = $user->id;
|
||||
$rule->courseid = $course->id;
|
||||
$rule->plugin = 'mod_book';
|
||||
@@ -96,7 +90,7 @@ class tool_monitor_task_clean_events_testcase extends advanced_testcase {
|
||||
|
||||
|
||||
// Let's subscribe to these rules.
|
||||
$sub = new stdClass;
|
||||
$sub = new \stdClass;
|
||||
$sub->courseid = $course->id;
|
||||
$sub->ruleid = $rule1->id;
|
||||
$sub->userid = $user->id;
|
||||
@@ -133,7 +127,7 @@ class tool_monitor_task_clean_events_testcase extends advanced_testcase {
|
||||
|
||||
// Trigger a bunch of other events.
|
||||
$eventparams = array(
|
||||
'context' => context_course::instance($course->id)
|
||||
'context' => \context_course::instance($course->id)
|
||||
);
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
\mod_quiz\event\course_module_instance_list_viewed::create($eventparams)->trigger();
|
||||
@@ -164,7 +158,7 @@ class tool_monitor_task_clean_events_testcase extends advanced_testcase {
|
||||
$this->assertEquals($course2->id, $event4->courseid);
|
||||
|
||||
// Update the timewindow for two of the rules.
|
||||
$updaterule = new stdClass();
|
||||
$updaterule = new \stdClass();
|
||||
$updaterule->id = $rule1->id;
|
||||
$updaterule->timewindow = 0;
|
||||
\tool_monitor\rule_manager::update_rule($updaterule);
|
||||
|
||||
@@ -164,5 +164,8 @@ function xmldb_tool_moodlenet_upgrade(int $oldversion) {
|
||||
upgrade_plugin_savepoint(true, 2022021601, 'tool', 'moodlenet');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -58,9 +58,8 @@ $string['mnetprofiledesc'] = '<p>Enter your MoodleNet profile details here to be
|
||||
$string['moodlenetsettings'] = 'MoodleNet settings';
|
||||
$string['moodlenetnotenabled'] = 'The MoodleNet integration must be enabled in Site administration / MoodleNet before resource imports can be processed.';
|
||||
$string['notification'] = 'You are about to import the content "{$a->name} ({$a->type})" into your site. Select the course in which it should be added, or <a href="{$a->cancellink}">cancel</a>.';
|
||||
$string['removedmnetprofilenotification'] = '<p>Due to some recent changes on the MoodleNet platform, users that have previously saved their MoodleNet profile on the site can no longer use this data to authenticate on the MoodleNet platform. The related data has now been removed as it is no longer useful.</p>
|
||||
<p>The users will need to reset this information on the site by linking their MoodleNet profile ID which can be found on their MoodleNet profile.</p>';
|
||||
$string['removedmnetprofilenotification_subject'] = 'Linked MoodleNet profiles removed.';
|
||||
$string['removedmnetprofilenotification'] = 'Due to recent changes on the MoodleNet platform, any users who previously saved their MoodleNet profile ID on the site will need to enter a MoodleNet profile ID in the new format in order to authenticate on the MoodleNet platform.';
|
||||
$string['removedmnetprofilenotification_subject'] = 'MoodleNet profile ID format change';
|
||||
$string['searchcourses'] = "Search courses";
|
||||
$string['selectpagetitle'] = 'Select page';
|
||||
$string['pluginname'] = 'MoodleNet';
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace tool_moodlenet;
|
||||
|
||||
/**
|
||||
* Unit tests for the import_backup_helper
|
||||
*
|
||||
@@ -22,15 +24,7 @@
|
||||
* @copyright 2020 Adrian Greeve <adrian@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
global $CFG;
|
||||
|
||||
/**
|
||||
* Class import_backup_helper tests
|
||||
*/
|
||||
class tool_moodlenet_import_backup_helper_testcase extends advanced_testcase {
|
||||
class import_backup_helper_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test that the first available context with the capability to upload backup files is returned.
|
||||
@@ -47,7 +41,7 @@ class tool_moodlenet_import_backup_helper_testcase extends advanced_testcase {
|
||||
$user5 = $this->getDataGenerator()->create_user();
|
||||
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$coursecontext = context_course::instance($course->id);
|
||||
$coursecontext = \context_course::instance($course->id);
|
||||
|
||||
$this->getDataGenerator()->enrol_user($user1->id, $course->id, 'student');
|
||||
$this->getDataGenerator()->enrol_user($user2->id, $course->id, 'editingteacher');
|
||||
@@ -55,12 +49,12 @@ class tool_moodlenet_import_backup_helper_testcase extends advanced_testcase {
|
||||
|
||||
$category = $this->getDataGenerator()->create_category();
|
||||
$rolerecord = $DB->get_record('role', ['shortname' => 'manager']);
|
||||
$categorycontext = context_coursecat::instance($category->id);
|
||||
$categorycontext = \context_coursecat::instance($category->id);
|
||||
$this->getDataGenerator()->role_assign($rolerecord->id, $user3->id, $categorycontext->id);
|
||||
$this->getDataGenerator()->role_assign($rolerecord->id, $user5->id, $categorycontext->id);
|
||||
|
||||
$roleid = $this->getDataGenerator()->create_role();
|
||||
$sitecontext = context_system::instance();
|
||||
$sitecontext = \context_system::instance();
|
||||
assign_capability('moodle/restore:uploadfile', CAP_ALLOW, $roleid, $sitecontext->id, true);
|
||||
accesslib_clear_all_caches_for_unit_testing();
|
||||
$this->getDataGenerator()->role_assign($roleid, $user4->id, $sitecontext->id);
|
||||
@@ -81,4 +75,4 @@ class tool_moodlenet_import_backup_helper_testcase extends advanced_testcase {
|
||||
$this->assertEquals(CONTEXT_COURSECAT, $result->contextlevel);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace tool_moodlenet;
|
||||
|
||||
/**
|
||||
* Unit tests for the profile manager
|
||||
*
|
||||
@@ -22,15 +24,7 @@
|
||||
* @copyright 2020 Adrian Greeve <adrian@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
global $CFG;
|
||||
|
||||
/**
|
||||
* Class profile_manager tests
|
||||
*/
|
||||
class tool_moodlenet_profile_manager_testcase extends advanced_testcase {
|
||||
class profile_manager_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test that on this site we use the user table to hold moodle net profile information.
|
||||
@@ -57,7 +51,7 @@ class tool_moodlenet_profile_manager_testcase extends advanced_testcase {
|
||||
$this->resetAfterTest();
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
|
||||
$this->expectException(moodle_exception::class);
|
||||
$this->expectException(\moodle_exception::class);
|
||||
$this->expectExceptionMessage(get_string('invalidmoodlenetprofile', 'tool_moodlenet'));
|
||||
$result = new \tool_moodlenet\moodlenet_user_profile("", $user->id);
|
||||
}
|
||||
|
||||
@@ -46,5 +46,8 @@ function xmldb_tool_policy_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 345 B After Width: | Height: | Size: 294 B |
@@ -56,5 +56,5 @@
|
||||
d="m 10.60981,13.748496 q -0.42076,-0.2046 -0.42076,-0.6595 v -2.1834 H 0.36389001 q -0.15919999,0 -0.26154001,-0.102297 Q 0,10.700897 0,10.541796 V 2.5361969 q 0,-0.2388 0.20469002,-0.3297 0.22743999,-0.091 0.39800999,0.045 L 2.7860701,4.0708971 q 0.1250916,0.1024 0.1250916,0.2842998 v 3.639 H 10.18905 V 5.810797 q 0,-0.4548999 0.42076,-0.6596001 0.42075,-0.1932998 0.77327,0.1024 L 15.749821,8.892496 Q 16,9.0971966 16,9.4496973 16,9.8022974 15.749821,10.006998 l -4.366741,3.638798 q -0.36389,0.307 -0.77327,0.102297 z"
|
||||
id="path4552"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#999999;fill-opacity:1;stroke-width:0.9999997" />
|
||||
style="fill:#888;fill-opacity:1;stroke-width:0.9999997" />
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
@@ -14,31 +14,20 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Provides the {@link tool_policy_sitepolicy_handler_testcase} class.
|
||||
*
|
||||
* @package tool_policy
|
||||
* @category test
|
||||
* @copyright 2018 David Mudrák <david@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace tool_policy;
|
||||
|
||||
use tool_policy\api;
|
||||
use tool_policy\policy_version;
|
||||
use tool_policy\privacy\local\sitepolicy\handler;
|
||||
use tool_policy\test\helper;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
global $CFG;
|
||||
|
||||
/**
|
||||
* Unit tests for the {@link \tool_policy\privacy\local\sitepolicy\handler} class.
|
||||
*
|
||||
* @package tool_policy
|
||||
* @category test
|
||||
* @copyright 2018 David Mudrak <david@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_policy_sitepolicy_handler_testcase extends advanced_testcase {
|
||||
class sitepolicy_handler_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test behaviour of the {@link \tool_policy\privacy\local\sitepolicy\handler::get_redirect_url()} method.
|
||||
|
||||
|
Before Width: | Height: | Size: 229 B After Width: | Height: | Size: 247 B |
@@ -9,7 +9,7 @@
|
||||
xml:space="preserve" preserveAspectRatio="xMinYMid meet">
|
||||
<defs>
|
||||
</defs>
|
||||
<path style="fill:#999999;" d="M2,5v9c0,1.1,0.9,2,2,2h8c1.1,0,2-0.9,2-2V5H2z M5,13.5C5,13.8,4.8,14,4.5,14S4,13.8,4,13.5v-6
|
||||
<path style="fill:#888;" d="M2,5v9c0,1.1,0.9,2,2,2h8c1.1,0,2-0.9,2-2V5H2z M5,13.5C5,13.8,4.8,14,4.5,14S4,13.8,4,13.5v-6
|
||||
C4,7.2,4.2,7,4.5,7S5,7.2,5,7.5V13.5z M8.5,13.5C8.5,13.8,8.3,14,8,14s-0.5-0.2-0.5-0.5v-6C7.5,7.2,7.7,7,8,7s0.5,0.2,0.5,0.5V13.5z
|
||||
M12,13.5c0,0.3-0.2,0.5-0.5,0.5S11,13.8,11,13.5v-6C11,7.2,11.2,7,11.5,7S12,7.2,12,7.5V13.5z M0,4c0-1.1,0.9-2,2-2h4v0
|
||||
c0-1.1,0.9-2,2-2s2,0.9,2,2v0h4c1.1,0,2,0.9,2,2H0z"/>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
@@ -19,14 +19,13 @@ Feature: Backup user data
|
||||
And the following config values are set as admin:
|
||||
| coursebinenable | 1 | tool_recyclebin |
|
||||
| autohide | 0 | tool_recyclebin |
|
||||
And the following "activities" exist:
|
||||
| activity | course | section | name | intro |
|
||||
| quiz | C1 | 1 | Quiz 1 | Test quiz description |
|
||||
|
||||
@javascript
|
||||
Scenario: Delete and restore a quiz with user data
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "Quiz" to section "1" and I fill the form with:
|
||||
| Name | Quiz 1 |
|
||||
| Description | Test quiz description |
|
||||
Given I am on the "Quiz 1" "quiz activity" page logged in as teacher1
|
||||
And I add a "True/False" question to the "Quiz 1" quiz with:
|
||||
| Question name | TF1 |
|
||||
| Question text | First question |
|
||||
@@ -41,6 +40,8 @@ Feature: Backup user data
|
||||
| Correct answer | False |
|
||||
| Feedback for the response 'True'. | So you think it is true |
|
||||
| Feedback for the response 'False'. | So you think it is false |
|
||||
And I set the field "maxgrade" to "10.0"
|
||||
And I press "savechanges"
|
||||
And I log out
|
||||
When I am on the "Quiz 1" "quiz activity" page logged in as student1
|
||||
And I press "Attempt quiz"
|
||||
|
||||
@@ -14,15 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Recycle bin tests.
|
||||
*
|
||||
* @package tool_recyclebin
|
||||
* @copyright 2015 University of Kent
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
namespace tool_recyclebin;
|
||||
|
||||
/**
|
||||
* Recycle bin category tests.
|
||||
@@ -31,15 +23,15 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @copyright 2015 University of Kent
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_recyclebin_category_bin_tests extends advanced_testcase {
|
||||
class category_bin_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* @var stdClass $course
|
||||
* @var \stdClass $course
|
||||
*/
|
||||
protected $course;
|
||||
|
||||
/**
|
||||
* @var stdClass $coursebeingrestored
|
||||
* @var \stdClass $coursebeingrestored
|
||||
*/
|
||||
protected $coursebeingrestored;
|
||||
|
||||
@@ -96,7 +88,7 @@ class tool_recyclebin_category_bin_tests extends advanced_testcase {
|
||||
$this->assertEquals(1, $DB->count_records('tool_recyclebin_category'));
|
||||
|
||||
// Now let's delete the course category.
|
||||
$category = core_course_category::get($this->course->category);
|
||||
$category = \core_course_category::get($this->course->category);
|
||||
$category->delete_full(false);
|
||||
|
||||
// Check that the course was deleted from the category recycle bin.
|
||||
@@ -242,7 +234,7 @@ class tool_recyclebin_category_bin_tests extends advanced_testcase {
|
||||
$this->assertEquals(0, count($recyclebin->get_items()));
|
||||
|
||||
// Verify that student DOES continue enrolled.
|
||||
$this->assertTrue(is_enrolled(context_course::instance($newcourse->id), $student->id));
|
||||
$this->assertTrue(is_enrolled(\context_course::instance($newcourse->id), $student->id));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -286,6 +278,6 @@ class tool_recyclebin_category_bin_tests extends advanced_testcase {
|
||||
$this->assertEquals(0, count($recyclebin->get_items()));
|
||||
|
||||
// Verify that student DOES NOT continue enrolled.
|
||||
$this->assertFalse(is_enrolled(context_course::instance($newcourse->id), $student->id));
|
||||
$this->assertFalse(is_enrolled(\context_course::instance($newcourse->id), $student->id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,15 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Recycle bin tests.
|
||||
*
|
||||
* @package tool_recyclebin
|
||||
* @copyright 2015 University of Kent
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
namespace tool_recyclebin;
|
||||
|
||||
/**
|
||||
* Recycle bin course tests.
|
||||
@@ -31,10 +23,10 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @copyright 2015 University of Kent
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_recyclebin_course_bin_tests extends advanced_testcase {
|
||||
class course_bin_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* @var stdClass $course
|
||||
* @var \stdClass $course
|
||||
*/
|
||||
protected $course;
|
||||
|
||||
@@ -72,7 +64,7 @@ class tool_recyclebin_course_bin_tests extends advanced_testcase {
|
||||
course_delete_module($this->quiz->cmid);
|
||||
|
||||
// Now, run the course module deletion adhoc task.
|
||||
phpunit_util::run_all_adhoc_tasks();
|
||||
\phpunit_util::run_all_adhoc_tasks();
|
||||
|
||||
// Check the course module is now in the recycle bin.
|
||||
$this->assertEquals(1, $DB->count_records('tool_recyclebin_course'));
|
||||
@@ -116,7 +108,7 @@ class tool_recyclebin_course_bin_tests extends advanced_testcase {
|
||||
course_delete_module($this->quiz->cmid);
|
||||
|
||||
// Now, run the course module deletion adhoc task.
|
||||
phpunit_util::run_all_adhoc_tasks();
|
||||
\phpunit_util::run_all_adhoc_tasks();
|
||||
|
||||
// Try purging.
|
||||
$recyclebin = new \tool_recyclebin\course_bin($this->course->id);
|
||||
@@ -141,7 +133,7 @@ class tool_recyclebin_course_bin_tests extends advanced_testcase {
|
||||
course_delete_module($this->quiz->cmid);
|
||||
|
||||
// Now, run the course module deletion adhoc task.
|
||||
phpunit_util::run_all_adhoc_tasks();
|
||||
\phpunit_util::run_all_adhoc_tasks();
|
||||
|
||||
// Set deleted date to the distant past.
|
||||
$recyclebin = new \tool_recyclebin\course_bin($this->course->id);
|
||||
@@ -157,7 +149,7 @@ class tool_recyclebin_course_bin_tests extends advanced_testcase {
|
||||
course_delete_module($book->cmid);
|
||||
|
||||
// Now, run the course module deletion adhoc task.
|
||||
phpunit_util::run_all_adhoc_tasks();
|
||||
\phpunit_util::run_all_adhoc_tasks();
|
||||
|
||||
// Should have 2 items now.
|
||||
$this->assertEquals(2, count($recyclebin->get_items()));
|
||||
@@ -223,7 +215,7 @@ class tool_recyclebin_course_bin_tests extends advanced_testcase {
|
||||
// Delete quiz.
|
||||
$cm = get_coursemodule_from_instance('quiz', $this->quiz->id);
|
||||
course_delete_module($cm->id);
|
||||
phpunit_util::run_all_adhoc_tasks();
|
||||
\phpunit_util::run_all_adhoc_tasks();
|
||||
$quizzes = get_coursemodules_in_course('quiz', $this->course->id);
|
||||
$this->assertEquals(0, count($quizzes));
|
||||
|
||||
@@ -240,7 +232,7 @@ class tool_recyclebin_course_bin_tests extends advanced_testcase {
|
||||
$attempts = quiz_get_user_attempts($cm->instance, $student->id);
|
||||
$this->assertEquals(1, count($attempts));
|
||||
$attempt = array_pop($attempts);
|
||||
$attemptobj = quiz_attempt::create($attempt->id);
|
||||
$attemptobj = \quiz_attempt::create($attempt->id);
|
||||
$this->assertEquals($student->id, $attemptobj->get_userid());
|
||||
$this->assertEquals(true, $attemptobj->is_finished());
|
||||
}
|
||||
@@ -270,7 +262,7 @@ class tool_recyclebin_course_bin_tests extends advanced_testcase {
|
||||
// Delete quiz.
|
||||
$cm = get_coursemodule_from_instance('quiz', $this->quiz->id);
|
||||
course_delete_module($cm->id);
|
||||
phpunit_util::run_all_adhoc_tasks();
|
||||
\phpunit_util::run_all_adhoc_tasks();
|
||||
$quizzes = get_coursemodules_in_course('quiz', $this->course->id);
|
||||
$this->assertEquals(0, count($quizzes));
|
||||
|
||||
@@ -303,17 +295,17 @@ class tool_recyclebin_course_bin_tests extends advanced_testcase {
|
||||
quiz_add_quiz_question($numq->id, $quiz);
|
||||
|
||||
// Create quiz attempt.
|
||||
$quizobj = quiz::create($quiz->id, $student->id);
|
||||
$quba = question_engine::make_questions_usage_by_activity('mod_quiz', $quizobj->get_context());
|
||||
$quizobj = \quiz::create($quiz->id, $student->id);
|
||||
$quba = \question_engine::make_questions_usage_by_activity('mod_quiz', $quizobj->get_context());
|
||||
$quba->set_preferred_behaviour($quizobj->get_quiz()->preferredbehaviour);
|
||||
$timenow = time();
|
||||
$attempt = quiz_create_attempt($quizobj, 1, false, $timenow, false, $student->id);
|
||||
quiz_start_new_attempt($quizobj, $quba, $attempt, 1, $timenow);
|
||||
quiz_attempt_save_started($quizobj, $quba, $attempt);
|
||||
$attemptobj = quiz_attempt::create($attempt->id);
|
||||
$attemptobj = \quiz_attempt::create($attempt->id);
|
||||
$tosubmit = array(1 => array('answer' => '0'));
|
||||
$attemptobj->process_submitted_actions($timenow, false, $tosubmit);
|
||||
$attemptobj = quiz_attempt::create($attempt->id);
|
||||
$attemptobj = \quiz_attempt::create($attempt->id);
|
||||
$attemptobj->process_finish($timenow, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,26 +14,16 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* File containing tests for the mform class.
|
||||
*
|
||||
* @package tool_task
|
||||
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
global $CFG;
|
||||
namespace tool_task;
|
||||
|
||||
/**
|
||||
* Mform test class.
|
||||
* Test for the task mform class.
|
||||
*
|
||||
* @package tool_task
|
||||
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or late
|
||||
*/
|
||||
class tool_task_form_testcase extends advanced_testcase {
|
||||
class form_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test validations for minute field.
|
||||
|
||||
@@ -44,6 +44,12 @@ class tool_uploadcourse_course {
|
||||
/** Outcome of the process: deleting the course */
|
||||
const DO_DELETE = 3;
|
||||
|
||||
/** @var array assignable roles. */
|
||||
protected $assignableroles = [];
|
||||
|
||||
/** @var array Roles context levels. */
|
||||
protected $contextlevels = [];
|
||||
|
||||
/** @var array final import data. */
|
||||
protected $data = array();
|
||||
|
||||
@@ -794,16 +800,15 @@ class tool_uploadcourse_course {
|
||||
|
||||
// Get enrolment data. Where the course already exists, we can also perform validation.
|
||||
$this->enrolmentdata = tool_uploadcourse_helper::get_enrolment_data($this->rawdata);
|
||||
if ($exists) {
|
||||
$errors = $this->validate_enrolment_data($coursedata['id'], $this->enrolmentdata);
|
||||
$courseid = $coursedata['id'] ?? 0;
|
||||
$errors = $this->validate_enrolment_data($courseid, $this->enrolmentdata);
|
||||
|
||||
if (!empty($errors)) {
|
||||
foreach ($errors as $key => $message) {
|
||||
$this->error($key, $message);
|
||||
}
|
||||
|
||||
return false;
|
||||
if (!empty($errors)) {
|
||||
foreach ($errors as $key => $message) {
|
||||
$this->error($key, $message);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($this->rawdata['tags']) && strval($this->rawdata['tags']) !== '') {
|
||||
@@ -913,6 +918,8 @@ class tool_uploadcourse_course {
|
||||
* @return lang_string[] Errors keyed on error code
|
||||
*/
|
||||
protected function validate_enrolment_data(int $courseid, array $enrolmentdata): array {
|
||||
global $DB;
|
||||
|
||||
// Nothing to validate.
|
||||
if (empty($enrolmentdata)) {
|
||||
return [];
|
||||
@@ -924,46 +931,67 @@ class tool_uploadcourse_course {
|
||||
$instances = enrol_get_instances($courseid, false);
|
||||
|
||||
foreach ($enrolmentdata as $method => $options) {
|
||||
$plugin = $enrolmentplugins[$method];
|
||||
|
||||
// Find matching instances by enrolment method.
|
||||
$methodinstances = array_filter($instances, static function(stdClass $instance) use ($method) {
|
||||
return (strcmp($instance->enrol, $method) == 0);
|
||||
});
|
||||
if (isset($options['role'])) {
|
||||
$role = $options['role'];
|
||||
if ($courseid) {
|
||||
if (!$this->validate_role_context($courseid, $role)) {
|
||||
$errors['contextrolenotallowed'] = new lang_string('contextrolenotallowed', 'core_role', $role);
|
||||
|
||||
if (!empty($options['delete'])) {
|
||||
// Ensure user is able to delete the instances.
|
||||
foreach ($methodinstances as $methodinstance) {
|
||||
if (!$plugin->can_delete_instance($methodinstance)) {
|
||||
$errors['errorcannotdeleteenrolment'] = new lang_string('errorcannotdeleteenrolment', 'tool_uploadcourse',
|
||||
$plugin->get_instance_name($methodinstance));
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// We can at least check that context level is correct while actual context not exist.
|
||||
$roleid = $DB->get_field('role', 'id', ['shortname' => $role], MUST_EXIST);
|
||||
if (!$this->validate_role_context_level($roleid)) {
|
||||
$errors['contextrolenotallowed'] = new lang_string('contextrolenotallowed', 'core_role', $role);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (!empty($options['disable'])) {
|
||||
// Ensure user is able to toggle instance statuses.
|
||||
foreach ($methodinstances as $methodinstance) {
|
||||
if (!$plugin->can_hide_show_instance($methodinstance)) {
|
||||
$errors['errorcannotdisableenrolment'] =
|
||||
new lang_string('errorcannotdisableenrolment', 'tool_uploadcourse',
|
||||
}
|
||||
|
||||
if ($courseid) {
|
||||
$plugin = $enrolmentplugins[$method];
|
||||
|
||||
// Find matching instances by enrolment method.
|
||||
$methodinstances = array_filter($instances, static function (stdClass $instance) use ($method) {
|
||||
return (strcmp($instance->enrol, $method) == 0);
|
||||
});
|
||||
|
||||
if (!empty($options['delete'])) {
|
||||
// Ensure user is able to delete the instances.
|
||||
foreach ($methodinstances as $methodinstance) {
|
||||
if (!$plugin->can_delete_instance($methodinstance)) {
|
||||
$errors['errorcannotdeleteenrolment'] = new lang_string('errorcannotdeleteenrolment',
|
||||
'tool_uploadcourse', $plugin->get_instance_name($methodinstance));
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (!empty($options['disable'])) {
|
||||
// Ensure user is able to toggle instance statuses.
|
||||
foreach ($methodinstances as $methodinstance) {
|
||||
if (!$plugin->can_hide_show_instance($methodinstance)) {
|
||||
$errors['errorcannotdisableenrolment'] =
|
||||
new lang_string('errorcannotdisableenrolment', 'tool_uploadcourse',
|
||||
$plugin->get_instance_name($methodinstance));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Ensure user is able to create/update instance.
|
||||
$methodinstance = empty($methodinstances) ? null : reset($methodinstances);
|
||||
if ((empty($methodinstance) && !$plugin->can_add_instance($courseid)) ||
|
||||
(!empty($methodinstance) && !$plugin->can_edit_instance($methodinstance))) {
|
||||
|
||||
$errors['errorcannotcreateorupdateenrolment'] =
|
||||
new lang_string('errorcannotcreateorupdateenrolment', 'tool_uploadcourse',
|
||||
$plugin->get_instance_name($methodinstance));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Ensure user is able to create/update instance.
|
||||
$methodinstance = empty($methodinstances) ? null : reset($methodinstances);
|
||||
if ((empty($methodinstance) && !$plugin->can_add_instance($courseid)) ||
|
||||
(!empty($methodinstance) && !$plugin->can_edit_instance($methodinstance))) {
|
||||
|
||||
$errors['errorcannotcreateorupdateenrolment'] =
|
||||
new lang_string('errorcannotcreateorupdateenrolment', 'tool_uploadcourse',
|
||||
$plugin->get_instance_name($methodinstance));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1079,8 +1107,15 @@ class tool_uploadcourse_course {
|
||||
$instance->enrolenddate = $instance->enrolstartdate;
|
||||
}
|
||||
|
||||
// Sort out the given role. This does not filter the roles allowed in the course.
|
||||
// Sort out the given role.
|
||||
if (isset($method['role'])) {
|
||||
$role = $method['role'];
|
||||
if (!$this->validate_role_context($course->id, $role)) {
|
||||
$this->error('contextrolenotallowed',
|
||||
new lang_string('contextrolenotallowed', 'core_role', $role));
|
||||
break;
|
||||
}
|
||||
|
||||
$roleids = tool_uploadcourse_helper::get_role_ids();
|
||||
if (isset($roleids[$method['role']])) {
|
||||
$instance->roleid = $roleids[$method['role']];
|
||||
@@ -1093,6 +1128,41 @@ class tool_uploadcourse_course {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if role is allowed in course context
|
||||
*
|
||||
* @param int $courseid course context.
|
||||
* @param string $role Role.
|
||||
* @return bool
|
||||
*/
|
||||
protected function validate_role_context(int $courseid, string $role) : bool {
|
||||
if (empty($this->assignableroles[$courseid])) {
|
||||
$coursecontext = \context_course::instance($courseid);
|
||||
$this->assignableroles[$courseid] = get_assignable_roles($coursecontext, ROLENAME_SHORT);
|
||||
}
|
||||
if (!in_array($role, $this->assignableroles[$courseid])) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if role is allowed at this context level.
|
||||
*
|
||||
* @param int $roleid Role ID.
|
||||
* @return bool
|
||||
*/
|
||||
protected function validate_role_context_level(int $roleid) : bool {
|
||||
if (empty($this->contextlevels[$roleid])) {
|
||||
$this->contextlevels[$roleid] = get_role_contextlevels($roleid);
|
||||
}
|
||||
|
||||
if (!in_array(CONTEXT_COURSE, $this->contextlevels[$roleid])) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the current course.
|
||||
*
|
||||
|
||||
@@ -325,6 +325,11 @@ class tool_uploadcourse_helper {
|
||||
continue;
|
||||
}
|
||||
$rolenames['role_' . $rolesids[$matches[1]]] = $value;
|
||||
} else if (preg_match('/^(.+)?_role$/', $field, $matches)) {
|
||||
if (!isset($rolesids[$value])) {
|
||||
$invalidroles[] = $value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -219,6 +219,10 @@ class tool_uploadcourse_processor {
|
||||
|
||||
$data = array_merge($data, $course->get_data(), array('id' => $course->get_id()));
|
||||
$tracker->output($this->linenb, true, $status, $data);
|
||||
if ($course->has_errors()) {
|
||||
$errors++;
|
||||
$tracker->output($this->linenb, false, $course->get_errors(), $data);
|
||||
}
|
||||
} else {
|
||||
$errors++;
|
||||
$tracker->output($this->linenb, false, $course->get_errors(), $data);
|
||||
|
||||
@@ -105,3 +105,28 @@ Feature: An admin can create courses using a CSV file
|
||||
And I should see "Field 3: b"
|
||||
And I should see "Field 4: Hello"
|
||||
And I should see "Field 5: Some text"
|
||||
|
||||
@javascript
|
||||
Scenario: Validation of role for uploaded courses
|
||||
Given I navigate to "Users > Permissions > Define roles" in site administration
|
||||
And I click on "Add a new role" "button"
|
||||
And I click on "Continue" "button"
|
||||
And I set the following fields to these values:
|
||||
| Short name | notallowed |
|
||||
| Custom full name | notallowed |
|
||||
| contextlevel80 | 1 |
|
||||
And I click on "Create this role" "button"
|
||||
And I navigate to "Courses > Upload courses" in site administration
|
||||
And I upload "admin/tool/uploadcourse/tests/fixtures/enrolment_role.csv" file to "File" filemanager
|
||||
And I click on "Preview" "button"
|
||||
And I should see "Invalid role names: notexist"
|
||||
And I should see "Role notallowed not allowed in this context."
|
||||
When I click on "Upload courses" "button"
|
||||
And I should see "Course created"
|
||||
And I should see "Courses total: 3"
|
||||
And I should see "Courses created: 1"
|
||||
And I should see "Courses errors: 2"
|
||||
And I should see "Invalid role names: notexist"
|
||||
And I should see "Role notallowed not allowed in this context."
|
||||
And I am on site homepage
|
||||
And I should see "coursez"
|
||||
|
||||
@@ -1561,6 +1561,94 @@ class course_test extends \advanced_testcase {
|
||||
$this->assertArrayHasKey('cannotrenameshortnamealreadyinuse', $co->get_errors());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test when role doesn't exist.
|
||||
*
|
||||
* @covers \tool_uploadcourse_course::prepare
|
||||
*/
|
||||
public function test_role_not_exist() {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
$mode = tool_uploadcourse_processor::MODE_CREATE_NEW;
|
||||
$updatemode = tool_uploadcourse_processor::UPDATE_NOTHING;
|
||||
|
||||
$upload = new tool_uploadcourse_course($mode, $updatemode, [
|
||||
'category' => 1,
|
||||
'fullname' => 'Testing',
|
||||
'shortname' => 'T101',
|
||||
'enrolment_1' => 'manual',
|
||||
'enrolment_1_role' => 'notexist'
|
||||
]);
|
||||
|
||||
$this->assertFalse($upload->prepare());
|
||||
$this->assertArrayHasKey('invalidroles', $upload->get_errors());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test when role not allowed in course context.
|
||||
*
|
||||
* @covers \tool_uploadcourse_course::proceed
|
||||
*/
|
||||
public function test_role_not_allowed() {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
$roleid = create_role('New student role', 'student2', 'New student description', 'student');
|
||||
set_role_contextlevels($roleid, [CONTEXT_BLOCK]);
|
||||
|
||||
$mode = tool_uploadcourse_processor::MODE_CREATE_NEW;
|
||||
$updatemode = tool_uploadcourse_processor::UPDATE_NOTHING;
|
||||
|
||||
$upload = new tool_uploadcourse_course($mode, $updatemode, [
|
||||
'category' => 1,
|
||||
'fullname' => 'Testing',
|
||||
'shortname' => 'T101',
|
||||
'enrolment_1' => 'manual',
|
||||
'enrolment_1_role' => 'student2'
|
||||
]);
|
||||
|
||||
$this->assertFalse($upload->prepare());
|
||||
$this->assertArrayHasKey('contextrolenotallowed', $upload->get_errors());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test when role is allowed.
|
||||
*
|
||||
* @covers \tool_uploadcourse_course::proceed
|
||||
*/
|
||||
public function test_role_allowed() {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
$mode = tool_uploadcourse_processor::MODE_UPDATE_ONLY;
|
||||
$updatemode = tool_uploadcourse_processor::UPDATE_MISSING_WITH_DATA_OR_DEFAUTLS;
|
||||
|
||||
$course = $this->getDataGenerator()->create_course([
|
||||
'shortname' => 'c1',
|
||||
]);
|
||||
|
||||
$instances = enrol_get_instances($course->id, true);
|
||||
$studentrole = $DB->get_record('role', ['shortname' => 'student']);
|
||||
$teacherrole = $DB->get_record('role', ['shortname' => 'teacher']);
|
||||
$instance = reset($instances);
|
||||
$this->assertEquals($studentrole->id, $instance->roleid);
|
||||
|
||||
$upload = new tool_uploadcourse_course($mode, $updatemode, [
|
||||
'shortname' => 'c1',
|
||||
'enrolment_1' => 'manual',
|
||||
'enrolment_1_role' => 'teacher'
|
||||
]);
|
||||
|
||||
$this->assertTrue($upload->prepare());
|
||||
$upload->proceed();
|
||||
$instances = enrol_get_instances($course->id, true);
|
||||
$instance = reset($instances);
|
||||
$this->assertEquals($teacherrole->id, $instance->roleid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom field plugin generator
|
||||
*
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
shortname,fullname,category,enrolment_1,enrolment_1_role
|
||||
CX,coursex,1,manual,notexist
|
||||
CY,coursey,1,manual,notallowed
|
||||
CZ,coursez,1,manual,student
|
||||
|
@@ -14,15 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Tests for CLI tool_uploaduser.
|
||||
*
|
||||
* @package tool_uploaduser
|
||||
* @copyright 2020 Marina Glancy
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
use \tool_uploaduser\cli_helper;
|
||||
namespace tool_uploaduser;
|
||||
|
||||
/**
|
||||
* Tests for CLI tool_uploaduser.
|
||||
@@ -31,7 +23,7 @@ use \tool_uploaduser\cli_helper;
|
||||
* @copyright 2020 Marina Glancy
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_uploaduser_cli_testcase extends advanced_testcase {
|
||||
class cli_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Generate cli_helper and mock $_SERVER['argv']
|
||||
@@ -117,7 +109,7 @@ class tool_uploaduser_cli_testcase extends advanced_testcase {
|
||||
$this->assertEquals('Users created: 2', $stats[0]);
|
||||
|
||||
// Users have default values applied.
|
||||
$user1 = core_user::get_user_by_username('jonest');
|
||||
$user1 = \core_user::get_user_by_username('jonest');
|
||||
$this->assertEquals('Brighton', $user1->city);
|
||||
$this->assertEquals('Purchasing', $user1->department);
|
||||
}
|
||||
@@ -149,7 +141,7 @@ class tool_uploaduser_cli_testcase extends advanced_testcase {
|
||||
$this->assertEquals('Users created: 2', $stats[0]);
|
||||
|
||||
// Created users have data in the profile fields.
|
||||
$user1 = core_user::get_user_by_username('reznort');
|
||||
$user1 = \core_user::get_user_by_username('reznort');
|
||||
$profilefields1 = profile_user_record($user1->id);
|
||||
$this->assertEquals((object)['superfield' => 'Loves cats'], $profilefields1);
|
||||
}
|
||||
@@ -244,9 +236,9 @@ class tool_uploaduser_cli_testcase extends advanced_testcase {
|
||||
$enrols = array_values(enrol_get_course_users($course->id));
|
||||
$this->assertEqualsCanonicalizing(['jonest'], [$enrols[0]->username]);
|
||||
// User reznor is not created.
|
||||
$this->assertFalse(core_user::get_user_by_username('reznor'));
|
||||
$this->assertFalse(\core_user::get_user_by_username('reznor'));
|
||||
// User jonest is not updated.
|
||||
$this->assertEquals('OLDNAME', core_user::get_user_by_username('jonest')->firstname);
|
||||
$this->assertEquals('OLDNAME', \core_user::get_user_by_username('jonest')->firstname);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -287,8 +279,8 @@ class tool_uploaduser_cli_testcase extends advanced_testcase {
|
||||
$enrols = array_values(enrol_get_course_users($course->id));
|
||||
$this->assertEqualsCanonicalizing(['jonest'], [$enrols[0]->username]);
|
||||
// User reznor is not created.
|
||||
$this->assertFalse(core_user::get_user_by_username('reznor'));
|
||||
$this->assertFalse(\core_user::get_user_by_username('reznor'));
|
||||
// User jonest is updated, new first name is Tom.
|
||||
$this->assertEquals('Tom', core_user::get_user_by_username('jonest')->firstname);
|
||||
$this->assertEquals('Tom', \core_user::get_user_by_username('jonest')->firstname);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,20 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Tests for field value validators of tool_uploaduser.
|
||||
*
|
||||
* @package tool_uploaduser
|
||||
* @copyright 2019 Jun Pataleta
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace tool_uploaduser;
|
||||
|
||||
use tool_uploaduser\local\field_value_validators;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
global $CFG;
|
||||
|
||||
/**
|
||||
* Tests for field value validators of tool_uploaduser.
|
||||
*
|
||||
@@ -35,7 +25,7 @@ global $CFG;
|
||||
* @copyright 2019 Jun Pataleta
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class field_value_validators_testcase extends advanced_testcase {
|
||||
class field_value_validators_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Data provider for \field_value_validators_testcase::test_validate_theme().
|
||||
|
||||
@@ -129,5 +129,8 @@ function xmldb_tool_usertours_upgrade($oldversion) {
|
||||
upgrade_plugin_savepoint(true, 2022040602, 'tool', 'usertours');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 257 B After Width: | Height: | Size: 511 B |
@@ -1,3 +1,3 @@
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
|
||||
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
|
||||
]><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" preserveAspectRatio="xMinYMid meet" overflow="visible"><path d="M7.9 16c4 0 7.4-3 7.8-7h-3c-.5 2-2.5 4-4.9 4-2.8 0-5-2.2-5-5s2.2-5 5-5c1.1 0 2.1 0 3 1h-1c-.5 0-.8.5-.8 1.1v1c0 .5.3.9.8.9h5c.6 0 1.2-.4 1.2-.9v-5c0-.6-.6-1.1-1.2-1.1h-1c-.5 0-.8.5-.8 1.1V2C12 .9 9.9.2 8 .2 3.6.2 0 3.7 0 8.1 0 12.4 3.5 16 7.9 16z" fill="#999"/></svg>
|
||||
]><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" preserveAspectRatio="xMinYMid meet" overflow="visible"><path d="M7.9 16c4 0 7.4-3 7.8-7h-3c-.5 2-2.5 4-4.9 4-2.8 0-5-2.2-5-5s2.2-5 5-5c1.1 0 2.1 0 3 1h-1c-.5 0-.8.5-.8 1.1v1c0 .5.3.9.8.9h5c.6 0 1.2-.4 1.2-.9v-5c0-.6-.6-1.1-1.2-1.1h-1c-.5 0-.8.5-.8 1.1V2C12 .9 9.9.2 8 .2 3.6.2 0 3.7 0 8.1 0 12.4 3.5 16 7.9 16z" fill="#888"/></svg>
|
||||
|
Before Width: | Height: | Size: 569 B After Width: | Height: | Size: 569 B |
|
Before Width: | Height: | Size: 266 B After Width: | Height: | Size: 342 B |
@@ -9,7 +9,7 @@
|
||||
xml:space="preserve" preserveAspectRatio="xMinYMid meet">
|
||||
<defs>
|
||||
</defs>
|
||||
<path style="fill:#999999;" d="M12,7v4c0,0.5-0.5,1-1,1h-0.5l0,0H1c-0.5,0-1-0.5-1-1V7c0-0.5,0.5-1,1-1h0.5c0.5,0,1,0.5,1,1l0,2.5h7
|
||||
<path style="fill:#888;" d="M12,7v4c0,0.5-0.5,1-1,1h-0.5l0,0H1c-0.5,0-1-0.5-1-1V7c0-0.5,0.5-1,1-1h0.5c0.5,0,1,0.5,1,1l0,2.5h7
|
||||
V7c0-0.5,0.5-1,1-1H11C11.5,6,12,6.5,12,7z M9.9,3.6L6.6,0.3C6.4,0.1,6.2,0,5.9,0C5.7,0,5.4,0.1,5.2,0.3L1.9,3.6
|
||||
C1.5,4,1.5,4.6,1.9,5l0.3,0.3c0.4,0.4,1,0.4,1.4,0l1-1.1l0,2.7c0,0.5,0.5,1,1,1l0.5,0c0.5,0,1-0.5,1-1l0-2.7l1,1
|
||||
c0.4,0.4,1,0.4,1.4,0L10,5C10.3,4.6,10.3,4,9.9,3.6z"/>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
@@ -14,17 +14,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Tests for time filter.
|
||||
*
|
||||
* @package tool_usertours
|
||||
* @copyright 2019 Tom Dickman <tomdickman@catalyst-au.net>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace tool_usertours;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
use tool_usertours\tour;
|
||||
use tool_usertours\local\filter\accessdate;
|
||||
|
||||
/**
|
||||
@@ -34,7 +25,7 @@ use tool_usertours\local\filter\accessdate;
|
||||
* @copyright 2019 Tom Dickman <tomdickman@catalyst-au.net>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_usertours_accessdate_filter_test extends advanced_testcase {
|
||||
class accessdate_filter_test extends \advanced_testcase {
|
||||
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
@@ -14,15 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Tests for role filter.
|
||||
*
|
||||
* @package tool_usertours
|
||||
* @copyright 2016 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
namespace tool_usertours;
|
||||
|
||||
/**
|
||||
* Tests for role filter.
|
||||
@@ -31,7 +23,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @copyright 2016 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_usertours_role_filter_testcase extends advanced_testcase {
|
||||
class role_filter_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* @var $course Test course
|
||||
|
||||
@@ -14,15 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Tests for theme filter.
|
||||
*
|
||||
* @package tool_usertours
|
||||
* @copyright 2016 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
namespace tool_usertours;
|
||||
|
||||
/**
|
||||
* Tests for theme filter.
|
||||
@@ -31,7 +23,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @copyright 2016 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_usertours_theme_filter_testcase extends advanced_testcase {
|
||||
class theme_filter_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Data Provider for filter_matches function.
|
||||
|
||||
@@ -14,21 +14,13 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Tests for tour.
|
||||
*
|
||||
* @package tool_usertours
|
||||
* @copyright 2016 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace tool_usertours;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
global $CFG;
|
||||
require_once($CFG->libdir . '/formslib.php');
|
||||
|
||||
use tool_usertours\tour;
|
||||
|
||||
/**
|
||||
* Tests for tour.
|
||||
*
|
||||
@@ -36,7 +28,7 @@ use tool_usertours\tour;
|
||||
* @copyright 2016 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tour_testcase extends advanced_testcase {
|
||||
class tour_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* @var moodle_database
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
This files describes API changes in /admin/*.
|
||||
|
||||
=== 4.0.1 ===
|
||||
|
||||
* A new callback xxx_pre_enable_plugin_actions has been added in admin/modules.php. Plugins can use this callback to
|
||||
force additional actions (e.g. displaying notifications, modals, etc.) before enabling the plugin. The expected
|
||||
return value (bool) from the plugin callback method specifies whether the process of enabling the plugin should
|
||||
continue after the added actions or not.
|
||||
|
||||
=== 3.11 ===
|
||||
|
||||
* New admin setting admin_setting_encryptedpassword allows passwords in admin settings to be
|
||||
|
||||
@@ -52,5 +52,8 @@ function xmldb_auth_cas_upgrade($oldversion) {
|
||||
upgrade_plugin_savepoint(true, 2021052501, 'auth', 'cas');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -44,5 +44,8 @@ function xmldb_auth_db_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace auth_db;
|
||||
|
||||
/**
|
||||
* External database auth sync tests, this also tests adodb drivers
|
||||
* that are matching our four supported Moodle database drivers.
|
||||
@@ -23,11 +25,7 @@
|
||||
* @copyright 2012 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
|
||||
class auth_db_testcase extends advanced_testcase {
|
||||
class db_test extends \advanced_testcase {
|
||||
/** @var string Original error log */
|
||||
protected $oldlog;
|
||||
|
||||
@@ -123,7 +121,7 @@ class auth_db_testcase extends advanced_testcase {
|
||||
throw new exception('Unknown database family ' . $DB->get_dbfamily());
|
||||
}
|
||||
|
||||
$table = new xmldb_table('auth_db_users');
|
||||
$table = new \xmldb_table('auth_db_users');
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('name', XMLDB_TYPE_CHAR, '255', null, null, null);
|
||||
$table->add_field('pass', XMLDB_TYPE_CHAR, '255', null, null, null);
|
||||
@@ -168,7 +166,7 @@ class auth_db_testcase extends advanced_testcase {
|
||||
global $DB;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
$table = new xmldb_table('auth_db_users');
|
||||
$table = new \xmldb_table('auth_db_users');
|
||||
$dbman->drop_table($table);
|
||||
|
||||
ini_set('error_log', $this->oldlog);
|
||||
@@ -222,7 +220,7 @@ class auth_db_testcase extends advanced_testcase {
|
||||
|
||||
$this->assertCount(2, $DB->get_records('user'));
|
||||
|
||||
$trace = new null_progress_trace();
|
||||
$trace = new \null_progress_trace();
|
||||
|
||||
// Sync users and make sure that two events user_created werer triggered.
|
||||
$sink = $this->redirectEvents();
|
||||
@@ -483,7 +481,7 @@ class auth_db_testcase extends advanced_testcase {
|
||||
$extdbuser3 = (object)array('name'=>'u3', 'pass'=>'heslo', 'email'=>'u3@example.com',
|
||||
'lastname' => 'user<script>alert(1);</script>xss');
|
||||
$extdbuser3->id = $DB->insert_record('auth_db_users', $extdbuser3);
|
||||
$trace = new null_progress_trace();
|
||||
$trace = new \null_progress_trace();
|
||||
|
||||
// Let's test user sync make sure still works as expected..
|
||||
$auth->sync_users($trace, true);
|
||||
@@ -529,7 +527,7 @@ class auth_db_testcase extends advanced_testcase {
|
||||
}
|
||||
|
||||
// Sync to moodle.
|
||||
$trace = new null_progress_trace();
|
||||
$trace = new \null_progress_trace();
|
||||
$auth->sync_users($trace, true);
|
||||
|
||||
// Check user is there.
|
||||
|
||||
@@ -44,5 +44,8 @@ function xmldb_auth_email_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -52,5 +52,8 @@ function xmldb_auth_ldap_upgrade($oldversion) {
|
||||
upgrade_plugin_savepoint(true, 2021052501, 'auth', 'ldap');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -85,5 +85,8 @@ function xmldb_auth_lti_upgrade($oldversion) {
|
||||
upgrade_plugin_savepoint(true, 2022030900, 'auth', 'lti');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -44,5 +44,8 @@ function xmldb_auth_manual_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -14,14 +14,9 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Manual authentication tests.
|
||||
*
|
||||
* @package auth_manual
|
||||
* @category test
|
||||
* @copyright 2014 Gilles-Philippe Leblanc <gilles-philippe.leblanc@umontreal.ca>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace auth_manual;
|
||||
|
||||
use auth_plugin_manual;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
@@ -36,7 +31,7 @@ require_once($CFG->dirroot.'/auth/manual/auth.php');
|
||||
* @copyright 2014 Gilles-Philippe Leblanc <gilles-philippe.leblanc@umontreal.ca>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class auth_manual_testcase extends advanced_testcase {
|
||||
class manual_test extends \advanced_testcase {
|
||||
|
||||
/** @var auth_plugin_manual Keeps the authentication plugin. */
|
||||
protected $authplugin;
|
||||
|
||||
@@ -44,5 +44,8 @@ function xmldb_auth_mnet_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||