Compare commits
677 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cc2edf3b8c | |||
| 7052d36f7c | |||
| 04479a6a3c | |||
| 3521b24e51 | |||
| bdfa441f00 | |||
| 6728d1ccc0 | |||
| 40d1da51bb | |||
| c52869afbe | |||
| 18d4531ad4 | |||
| 62aab40860 | |||
| b4525ba984 | |||
| 7b16b52ffe | |||
| ff93557b40 | |||
| 48e8e6f434 | |||
| ecc5f367ef | |||
| 850b4a5f56 | |||
| 91eae783fc | |||
| 912817f097 | |||
| 36412a5fea | |||
| a7f19c9072 | |||
| 4bc773ad03 | |||
| 4973da2768 | |||
| aa145e2669 | |||
| bdc4367460 | |||
| fc467246b4 | |||
| ee502bf6b5 | |||
| ee6e605770 | |||
| 2d953eb291 | |||
| 6e7faf5854 | |||
| 50569e6f4a | |||
| 23a61db0f0 | |||
| d3d580671a | |||
| 8304649791 | |||
| c8c3b17cd2 | |||
| 3e5569a61a | |||
| 80782f8907 | |||
| 51af50ade5 | |||
| b683a38423 | |||
| 54dc1112cb | |||
| 421c0608e8 | |||
| 7678c3f41c | |||
| a3573087d1 | |||
| f809e209e3 | |||
| 59a377abbe | |||
| 83a24b0e9f | |||
| 7ffbd04d35 | |||
| 19284518d1 | |||
| dec2143d73 | |||
| abd4203547 | |||
| 28922ba889 | |||
| b67fb190b9 | |||
| 1e0f46a125 | |||
| 1abeac9ba4 | |||
| 84c134f7c0 | |||
| aa8f7a6a39 | |||
| 01971bc9a4 | |||
| 09fae09cd5 | |||
| e0381615aa | |||
| 349916ae5f | |||
| 5168d9c97b | |||
| fc38c5c7e7 | |||
| 3ab8986eb0 | |||
| be4d15a856 | |||
| 495f38ff3f | |||
| 0fe19ee1dc | |||
| ef3d7a9d18 | |||
| 1970d836c6 | |||
| 96f76208d1 | |||
| 2fb409a999 | |||
| 86afac09e9 | |||
| 45fbccf625 | |||
| 2c2cda1660 | |||
| e6176d6dba | |||
| 0be064b328 | |||
| 5b68c82eb2 | |||
| 94bcaa0d4f | |||
| 971b7b6eb7 | |||
| ad698059ae | |||
| 1114ab3822 | |||
| adf336cbf2 | |||
| b150085bb1 | |||
| f0dd2ae1f5 | |||
| fd63451ecc | |||
| 3d40c9bc47 | |||
| b540ab944c | |||
| d34d87f45a | |||
| abd665d545 | |||
| 5bcdefb516 | |||
| d69212b895 | |||
| 0223b0fefb | |||
| 3452312c8c | |||
| e884c04350 | |||
| a1dcb85347 | |||
| ed179a8d7f | |||
| 30bae49637 | |||
| 0ae247b51f | |||
| d8a1a67fd7 | |||
| acbfa5e1a3 | |||
| 408154a1b6 | |||
| f91d479407 | |||
| 09b9c2a5b9 | |||
| 8d12c2a15e | |||
| a358040701 | |||
| a03674de6f | |||
| b3dbeeecf7 | |||
| e18333d842 | |||
| 67b21bbc99 | |||
| d81770cdbe | |||
| 688ee9e9d1 | |||
| 42cc612a5e | |||
| fa8b74b5eb | |||
| ffc32f80a5 | |||
| 3da6a04461 | |||
| eac19ef151 | |||
| 37a95f12e7 | |||
| 727c4c5a6e | |||
| a52f92a82c | |||
| 067818c2e6 | |||
| d7d19fe136 | |||
| 28a7d39b2a | |||
| da95f8d083 | |||
| b1297a80df | |||
| cbafc55078 | |||
| b7bd55bc82 | |||
| aafb937adf | |||
| 95d011dcf1 | |||
| c930111e17 | |||
| f0c5d668e9 | |||
| a061f1b4c2 | |||
| 2299b73307 | |||
| 85c7dcaf05 | |||
| 8d30ff7575 | |||
| 2e8bf841c6 | |||
| d5b719f6a0 | |||
| d7cb2a66cd | |||
| e96db7beec | |||
| 44801c448c | |||
| 904222b6f2 | |||
| f1bc96a8ab | |||
| d0ce8e8d62 | |||
| c2f3e98cea | |||
| 266c8b73b0 | |||
| 00ce502c67 | |||
| 38ab94e04b | |||
| dc6db54e99 | |||
| d45422ccbf | |||
| c1b4d24095 | |||
| e05fa63684 | |||
| 03f840b4f2 | |||
| fbd674e81b | |||
| 1291503846 | |||
| 21fc6a3016 | |||
| 23f0ec2766 | |||
| b99a81af8e | |||
| 908488e472 | |||
| 7fdb644bd1 | |||
| 70204fd73c | |||
| 389e4fc011 | |||
| ed4a47302e | |||
| 0f0710a249 | |||
| 42511349ae | |||
| 32f1542b5e | |||
| 78bcf355c6 | |||
| 31e0fd81a7 | |||
| 7a21be49f9 | |||
| 43b3bda115 | |||
| 088c523df0 | |||
| 4af5185587 | |||
| b2018b2fbc | |||
| 25f4874743 | |||
| 3ff165b4c5 | |||
| 1d51af0f8e | |||
| aa550ddea6 | |||
| 978ada1047 | |||
| 8b7270f9b1 | |||
| 8741181a5b | |||
| e7065ad471 | |||
| d36cf65ef3 | |||
| 39d46917bb | |||
| 6b3d8fd889 | |||
| b15b73848a | |||
| 6cd08cc382 | |||
| b1a6791aa2 | |||
| 384300011c | |||
| 57fc94747d | |||
| 9956e9ff31 | |||
| 8601c56964 | |||
| 9f1ab61160 | |||
| 4197e50fec | |||
| 23ba4d1792 | |||
| 17e5aaa5be | |||
| dd998e8d88 | |||
| 1bfd61c0fd | |||
| 95274afe55 | |||
| 8d1bf9d92d | |||
| 799e5c9ecc | |||
| 1d20be4c3d | |||
| ed5fde9c1f | |||
| 45d839a7c8 | |||
| 0ebbf88990 | |||
| 2196813e1e | |||
| 562b9775b2 | |||
| cbe78bb3a6 | |||
| 8cfc9387f2 | |||
| 0ea950e710 | |||
| 077f535912 | |||
| e1816e9af1 | |||
| 5ca387bef3 | |||
| 27cd5596e7 | |||
| a10c074f54 | |||
| ba80f884f7 | |||
| 54ec6416b4 | |||
| 83bec3bdb5 | |||
| 8a325684d0 | |||
| 8704a69aed | |||
| d6fbf5661a | |||
| 6a33cb3e08 | |||
| cd2d47dafc | |||
| 1be7820208 | |||
| f297094295 | |||
| 0aeff04c0a | |||
| 959963e1e4 | |||
| 7acefc469c | |||
| 3ae349b86e | |||
| 3413c90bd2 | |||
| 41a5833327 | |||
| 9557a52569 | |||
| f41181c894 | |||
| ff3fb00a96 | |||
| 7f45da44ed | |||
| d9a761f6ee | |||
| 771694018e | |||
| eafd1bcb17 | |||
| 7065a3dca0 | |||
| 5bc2479793 | |||
| 70d257fc5b | |||
| 3423dd2245 | |||
| a0a2015027 | |||
| 96f2686d47 | |||
| 5bbd628f49 | |||
| aad75c1072 | |||
| c35610502f | |||
| f35b8e6651 | |||
| 5be8cf7ba8 | |||
| b3b8f520e9 | |||
| a25eb4cb95 | |||
| f4f7f83ce5 | |||
| f312621f0d | |||
| 6ad723885c | |||
| 2119c703d2 | |||
| 42938d2dd4 | |||
| 462357ebf0 | |||
| a79853672e | |||
| 75b3607fc3 | |||
| f142770c37 | |||
| cf92d64a57 | |||
| 6771eb805b | |||
| 6c7121254d | |||
| f523a01673 | |||
| 75791eabea | |||
| 2c804c3ab2 | |||
| 044e924d8a | |||
| 6b01e331e6 | |||
| 87d7ac1f81 | |||
| 09c7a41d7f | |||
| 219d5bfb44 | |||
| 32d08ee47f | |||
| ef45ffc444 | |||
| 52cbcdbca7 | |||
| 97c21add9e | |||
| 15d331c058 | |||
| 2ac781b76d | |||
| 6d4ea3f3c2 | |||
| b0b17142c7 | |||
| 306b5289a7 | |||
| 99ae088704 | |||
| 7605966155 | |||
| 0f7d291b9c | |||
| ff2164fd3d | |||
| b1072fc937 | |||
| 81900583fe | |||
| 9dde27f0bb | |||
| 40ffccc33b | |||
| 1975be2909 | |||
| 160617d2d5 | |||
| 2b42e986e3 | |||
| e9683d416f | |||
| 85c8395e52 | |||
| fa80a0b8a5 | |||
| 10eead2473 | |||
| f341c774de | |||
| 731bf1cb78 | |||
| 18bf9704e7 | |||
| cd781ab1b7 | |||
| 7ec026173e | |||
| ce6b2f77c9 | |||
| d3078a3f53 | |||
| d5be1b502f | |||
| a74b702a23 | |||
| 4246ca2fbf | |||
| 931f11899a | |||
| f3ade2b67a | |||
| a1334d14d7 | |||
| c2cd21be15 | |||
| 3fb33d314e | |||
| e075cb4c1d | |||
| 7cb072b11e | |||
| d84efee3e2 | |||
| 5fbdb37d60 | |||
| f8eecf37d9 | |||
| 4bdf820437 | |||
| d59f7a04f0 | |||
| 1d753e37af | |||
| 77c9660195 | |||
| 877e585704 | |||
| f64d94dd62 | |||
| f6f6475b8e | |||
| e877329be1 | |||
| 26824c239e | |||
| 6aa18b9c05 | |||
| d348237022 | |||
| 114ddf489e | |||
| f78c93e325 | |||
| 941c866216 | |||
| d9ba8ea3f3 | |||
| 6e41020e44 | |||
| 2be9aaf311 | |||
| ac65869391 | |||
| f7184f748f | |||
| 40995c1030 | |||
| 202c58888a | |||
| 6d35be2af2 | |||
| 754768bad3 | |||
| fbed8034eb | |||
| 73713bd675 | |||
| 347ade6e68 | |||
| ece31e87a6 | |||
| 7b3d547f4a | |||
| 89d93d2632 | |||
| d1f4ca4505 | |||
| f5a2ddef9f | |||
| 533deb42af | |||
| 15b422f3a7 | |||
| 17f080683d | |||
| 9874249ad1 | |||
| 7fae6efbd8 | |||
| e4a8fd37f0 | |||
| c8bdae260b | |||
| 200eb30225 | |||
| d3890caed1 | |||
| 3f1f6192ea | |||
| bf51502049 | |||
| 0d1cbfb3b7 | |||
| 6d717d9c8a | |||
| 4d4efaa72c | |||
| b2ce12db1d | |||
| 96c159f032 | |||
| c260c622b9 | |||
| 71f5eee793 | |||
| 2a86638a15 | |||
| 091b458c52 | |||
| 1093256560 | |||
| 7b6070003a | |||
| d376d8cdbf | |||
| 5541cd1af9 | |||
| dd345ab8ee | |||
| 90c5adee7c | |||
| d5395c4f47 | |||
| 84a3e73aa0 | |||
| c0a966d944 | |||
| 844247aecf | |||
| 90f138fced | |||
| 6a46e9524b | |||
| 21b4aac782 | |||
| 83b9f0e29d | |||
| 6d4a0cbcb2 | |||
| 06b9cbdefd | |||
| 2b4769bb73 | |||
| e858c2e747 | |||
| 222fb603c0 | |||
| f2dbbfe66e | |||
| 821f2a390c | |||
| ac692ebbf6 | |||
| 40960e49bc | |||
| db07c09afc | |||
| 70c8bfa038 | |||
| ccca8adbc1 | |||
| 7e01d53de3 | |||
| 3317a05ec9 | |||
| b0dddbb02a | |||
| 322dae8b9c | |||
| f6be7e2a3e | |||
| aca5d1d5c6 | |||
| 07367f22f1 | |||
| 0c47aa6a92 | |||
| e23f603c41 | |||
| 9af9711c0a | |||
| 30fadc3686 | |||
| 756090ed79 | |||
| 2630591338 | |||
| e00e4487a4 | |||
| 64f1fd7d7b | |||
| 09b06bdb28 | |||
| 9e1723f4b8 | |||
| 3b4e2ae357 | |||
| d35b9dc7bb | |||
| 500cec5757 | |||
| 891e9994b4 | |||
| 1bff691a64 | |||
| 1913cdb088 | |||
| 83b3ee6212 | |||
| 253c16b64d | |||
| 2ed6a57f36 | |||
| af96d4eebe | |||
| 4e6de24f31 | |||
| 7d1563333b | |||
| f7988538b2 | |||
| 6ba71820b1 | |||
| 61c5863b1a | |||
| 0091b1a153 | |||
| b12afc89e4 | |||
| 844aef124c | |||
| 476a8fcb72 | |||
| fe22fe1c83 | |||
| cb9527cd4f | |||
| e71fc4ff3b | |||
| 89fae608a6 | |||
| 2692097272 | |||
| 11ca67f853 | |||
| 34bcb7e70e | |||
| 608f7d6aa0 | |||
| c43d07d0cf | |||
| ad46a97f53 | |||
| da4e626ffa | |||
| cb4904ea25 | |||
| 4d5289e599 | |||
| 0efd3066a2 | |||
| 002b1aed6a | |||
| c73c1bafc1 | |||
| e56c732209 | |||
| cff22cd5ab | |||
| 2ec3b297d7 | |||
| 1e480e2851 | |||
| a22d64816d | |||
| 89d9032e4d | |||
| f540fab1dc | |||
| a49c099ae5 | |||
| 1291869f90 | |||
| 7a420b6a34 | |||
| ff963d9feb | |||
| ad693b830a | |||
| c2b0463539 | |||
| f0445d5cac | |||
| 2debc731ef | |||
| 56aaf7a998 | |||
| 86cb89c5fc | |||
| 9a75b24e1c | |||
| b19ce46723 | |||
| 370843c967 | |||
| da15787ed0 | |||
| 801a2b9497 | |||
| 7a5bdf76b6 | |||
| 63f7c6cc6a | |||
| b35b012e9e | |||
| 0204fbb810 | |||
| 5cf7efb761 | |||
| 2016d4c6dd | |||
| aae18f59aa | |||
| 4d23fe8a58 | |||
| fcfcdd6508 | |||
| 45808a99b4 | |||
| e4acde27c9 | |||
| 5182b60391 | |||
| 23ab7d4973 | |||
| af8f13bac5 | |||
| e5b2b5e0ba | |||
| 9a6b07f0de | |||
| 11e53bf4b0 | |||
| 176caab765 | |||
| bd03886512 | |||
| 6f6d2d9a0f | |||
| e6af0ea94e | |||
| 86b45212e8 | |||
| b2a485e244 | |||
| 80f521eed0 | |||
| f14fdf23e3 | |||
| 25724ebfbb | |||
| c73623506d | |||
| 7450f0e33f | |||
| 55163a6ba9 | |||
| 4e04339cbd | |||
| bf3562d13e | |||
| aca3ad2008 | |||
| f34e050e9b | |||
| c2eb42fc7b | |||
| 625e015ff8 | |||
| 9d74cebd74 | |||
| 64ad970e5e | |||
| f0fb54d907 | |||
| 5da8226f72 | |||
| 2fcd7f93b9 | |||
| 9b30118456 | |||
| dd87304fcf | |||
| b08fbf99db | |||
| b3f708d4d1 | |||
| 4572a114a9 | |||
| c889381be2 | |||
| 1e07a5eef6 | |||
| 2c40c8554b | |||
| 955f4f3bb7 | |||
| 1dca48371d | |||
| c0b9a52430 | |||
| 462b8f9861 | |||
| 242ab5d5aa | |||
| bf8a28b220 | |||
| 20d6ffb9ee | |||
| a76a1e3f5c | |||
| fbd18d8ead | |||
| 78b3369ca0 | |||
| 2f0513b91c | |||
| b25405fd56 | |||
| 5565f47e9b | |||
| 2848c7d6be | |||
| 4e151ddf30 | |||
| 4b9de301c3 | |||
| dbffeb334b | |||
| 165709ff7d | |||
| 0a75d57b13 | |||
| 3182c71093 | |||
| 56fb55683a | |||
| 78229db6a1 | |||
| d04044bb0a | |||
| c1b4ccc4c6 | |||
| 5db3c95e29 | |||
| bcae2164ac | |||
| 207eed1190 | |||
| c948d9e40e | |||
| 9ccdee7687 | |||
| 1a3e68a956 | |||
| dfde819c8b | |||
| ffe67fc6df | |||
| 8a60437bea | |||
| c62143a5df | |||
| 691f2c8950 | |||
| 6ae2c78e9f | |||
| 7a4ea4dd65 | |||
| 217a7af933 | |||
| df176b292a | |||
| fa5a564a17 | |||
| dd1d91486d | |||
| f9ab045794 | |||
| 32bf836fec | |||
| e205d5accc | |||
| 9febdf9b0f | |||
| ce8695ff1f | |||
| 3e80d6ee79 | |||
| 513bafbcfd | |||
| 7fc818ebb8 | |||
| 0219831af4 | |||
| 477aa7c750 | |||
| 47e844d0f4 | |||
| c44c1b5345 | |||
| 28e9e58577 | |||
| 6a628bcd3a | |||
| 10e44e40d9 | |||
| a625583b11 | |||
| 810ab99d7d | |||
| 82a76a1b69 | |||
| ddca055e0d | |||
| b0a11d12ca | |||
| 996564f803 | |||
| 2512e6b09e | |||
| d5d6b0f7f9 | |||
| 52b4f3bb1d | |||
| ad9d4bb4af | |||
| 569d9dfe39 | |||
| 1c2f5dc1df | |||
| 75d95bc4b8 | |||
| a6c17af4c7 | |||
| 7ac2d7f598 | |||
| c4533967d1 | |||
| 5bd4a81e09 | |||
| 72f0a11f0d | |||
| 7b873db958 | |||
| b83cd14d25 | |||
| 4b0ca64617 | |||
| 7741ae3094 | |||
| aa1dc46bc8 | |||
| 27dd2e751f | |||
| f88dbfcafc | |||
| aaf45097b7 | |||
| adb0352ef4 | |||
| da4486b202 | |||
| 778470818a | |||
| 4625eeb998 | |||
| 4e7d555c18 | |||
| 8b7f262aca | |||
| d33dd13fd5 | |||
| a548bccf18 | |||
| 9977c07a69 | |||
| eedb5fde7a | |||
| eabc15f983 | |||
| 18ac43934a | |||
| 35914200b5 | |||
| 48c064505e | |||
| 417fbe1534 | |||
| c70ceb5f7b | |||
| c4735904e5 | |||
| 0792e7bdd9 | |||
| eaf09ebbc4 | |||
| d620ee8cdf | |||
| f7124a4a95 | |||
| 34f1f22b00 | |||
| a95ac513bf | |||
| a829242d47 | |||
| 2479bc2042 | |||
| 67376511ac | |||
| b65b4892ae | |||
| be159037d4 | |||
| eccadb67b7 | |||
| 94d8b7f040 | |||
| c6bf1efac6 | |||
| 50c7842d73 | |||
| 48597285cd | |||
| e13fe01c7b | |||
| 1542a9f9e1 | |||
| 310b932482 | |||
| edf923e38e | |||
| 95a5cb8038 | |||
| 771786ad4d | |||
| 5f6b32c4cb | |||
| 8ee732f391 | |||
| 21e6eea20e | |||
| 1dbc78253c | |||
| c9d48f6f25 | |||
| 894ee17f53 | |||
| cbdfc83b69 | |||
| 6c484f9fc8 | |||
| 6de35b2623 | |||
| f0c1a3789d | |||
| 8f0f474882 | |||
| 452cf5c72d | |||
| dd88b540c2 | |||
| 6a04c121af | |||
| 83eb2a624c | |||
| 1d6bee488d | |||
| 14574fdb56 | |||
| aa213563e7 | |||
| 1d01c74390 | |||
| 0e70a88d03 | |||
| 49b666b670 | |||
| 4c1beb921f | |||
| dcb43cf3b0 | |||
| aa71fcfb7f | |||
| 53557c3be1 | |||
| 16f7008c68 | |||
| 291a5449eb | |||
| 42d52002ee | |||
| c9b7b67fad | |||
| 8a2929c1a9 | |||
| 8f53f30e02 | |||
| 9ea7607613 | |||
| 26a607e8a3 | |||
| 4378d1dadc | |||
| 582eb88404 | |||
| ec0e1d74a0 | |||
| 82eacb2e48 | |||
| 8b976e77ce | |||
| cab8184fcb | |||
| 7b18faed92 | |||
| 4adb2a7695 | |||
| 410b333e47 | |||
| a8908c1a50 | |||
| b0fec7d82b | |||
| dc0cf1f273 | |||
| 5b9fdc0e9a | |||
| d9a8eb2bdb |
@@ -0,0 +1,143 @@
|
||||
name: One by One Testing
|
||||
# Run all the individual unit tests one by one, with
|
||||
# fully independent PHPUnit executions. Useful to
|
||||
# detect issues with some tests that are using stuff
|
||||
# that has been made available by others, but is not
|
||||
# available when running individually.
|
||||
#
|
||||
# Note that we aren't using PHPUnit's own isolation
|
||||
# here but completely separated runs, one for each
|
||||
# test.
|
||||
#
|
||||
# The workflow will fail reporting all the tests
|
||||
# that have failed (and will pass if no failure is
|
||||
# detected, of course).
|
||||
#
|
||||
# It's only executed via workflow dispatch (automated
|
||||
# or manual), not by push/tag. And acceptd configuration
|
||||
# of phpunit, specially useful to run it with PHPUnit's
|
||||
# own isolation or any other option.
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
phpunit_extra_options:
|
||||
description: Additional options to apply to PHPUnit
|
||||
required: false
|
||||
default: ''
|
||||
|
||||
env:
|
||||
chunks: 7
|
||||
|
||||
jobs:
|
||||
collect:
|
||||
name: Collect individual unit tests
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
matrix: ${{steps.individual-tests.outputs.matrix }}
|
||||
|
||||
steps:
|
||||
- name: Checking out code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Looking for all individual tests
|
||||
id: individual-tests
|
||||
run: |
|
||||
count=0 # Number of individual tests found.
|
||||
while read -r testfile; do # For each test file.
|
||||
while read -r testname; do # For each unit test in a file.
|
||||
count=$((count + 1))
|
||||
# Sent it to the correct chunk file.
|
||||
chunk=$(((($count % $chunks)) + 1))
|
||||
echo "$testname $testfile" >> ./chunk_$chunk.txt
|
||||
done < <(grep "function test_" "${testfile}" | sed -r "s/^.*function (test_[a-zA-Z0-9_]+).*/\1/")
|
||||
done < <(find . -name "*_test.php")
|
||||
# Generate the matrix to run tests.
|
||||
echo "matrix=$(ls -1 chunk_*.txt | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
|
||||
echo "$count individual tests collected in $chunks files"
|
||||
|
||||
- name: Upload individual tests files
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: individual_tests
|
||||
path: chunk_*.txt
|
||||
retention-days: 1
|
||||
|
||||
test:
|
||||
name: Run tests
|
||||
needs: collect
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
exttests:
|
||||
image: moodlehq/moodle-exttests
|
||||
ports:
|
||||
- 8080:80
|
||||
redis:
|
||||
image: redis
|
||||
ports:
|
||||
- 6379:6379
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
file: ${{ fromJson(needs.collect.outputs.matrix) }}
|
||||
|
||||
steps:
|
||||
- name: Setting up DB pgsql
|
||||
uses: m4nu56/postgresql-action@v1
|
||||
with:
|
||||
postgresql version: 13
|
||||
postgresql db: test
|
||||
postgresql user: test
|
||||
postgresql password: test
|
||||
|
||||
- name: Setting up PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: 8.3
|
||||
ini-values: max_input_vars=5000
|
||||
coverage: none
|
||||
|
||||
- name: Checking out code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download individual test files
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: individual_tests # Make all the chunk files available for the next steps.
|
||||
|
||||
- name: Setting up PHPUnit
|
||||
env:
|
||||
dbtype: pgsql
|
||||
run: |
|
||||
echo "pathtophp=$(which php)" >> $GITHUB_ENV
|
||||
cp .github/workflows/config-template.php config.php
|
||||
mkdir ../moodledata
|
||||
sudo locale-gen en_AU.UTF-8
|
||||
php admin/tool/phpunit/cli/init.php --no-composer-self-update
|
||||
|
||||
- name: Run PHPUnit test (one by one)
|
||||
env:
|
||||
dbtype: pgsql
|
||||
run: |
|
||||
status=0
|
||||
count=0
|
||||
while read -r line; do # For each line in the chunk file
|
||||
count=$((count + 1))
|
||||
filter="${line% *}"
|
||||
file="${line#* }"
|
||||
# Run the individual unit test and report problems if needed to.
|
||||
if ! php vendor/bin/phpunit \
|
||||
--fail-on-empty-test-suite \
|
||||
--fail-on-warning \
|
||||
--fail-on-risky \
|
||||
--filter "$filter" ${{ inputs.phpunit_extra_options }} \
|
||||
"$file" >/dev/null 2>&1; then
|
||||
if [ $status -eq 0 ]; then
|
||||
echo "Problems found, list of PHPUnit commands failing:"
|
||||
fi
|
||||
echo "vendor/bin/phpunit --filter '${filter}' ${{ inputs.phpunit_extra_options }} $file"
|
||||
status=$((status + 1))
|
||||
fi
|
||||
done < ${{ matrix.file }}
|
||||
echo "Finished: $count individual tests executed, $status tests failed"
|
||||
exit $status
|
||||
@@ -0,0 +1,23 @@
|
||||
name: Web Installer Testing
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
InstallationTest:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
php: [8.1, 8.3]
|
||||
steps:
|
||||
- name: Construct repository URL
|
||||
run: echo "REPOSITORY_URL=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
|
||||
- uses: moodlehq/moodle-webinstaller-test@main
|
||||
with:
|
||||
repository: ${{ env.REPOSITORY_URL }}
|
||||
branch: ${{ github.ref_name }}
|
||||
php: ${{ matrix.php }}
|
||||
+1
-1
@@ -5,6 +5,6 @@ define("core_admin/bulk_user_actions",["exports","core_reportbuilder/local/selec
|
||||
* @module core_admin/bulk_user_actions
|
||||
* @copyright 2024 Marina Glancy
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,reportSelectors=_interopRequireWildcard(reportSelectors),tableEvents=_interopRequireWildcard(tableEvents),FormChangeChecker=_interopRequireWildcard(FormChangeChecker),CustomEvents=_interopRequireWildcard(CustomEvents),_jquery=(obj=_jquery)&&obj.__esModule?obj:{default:obj};const Selectors_bulkActionsForm="form#user-bulk-action-form",Selectors_userReportWrapper='[data-region="report-user-list-wrapper"]',Selectors_checkbox='input[type="checkbox"][data-togglegroup="report-select-all"][data-toggle="slave"]',Selectors_masterCheckbox='input[type="checkbox"][data-togglegroup="report-select-all"][data-toggle="master"]',Selectors_checkedRows='[data-togglegroup="report-select-all"][data-toggle="slave"]:checked';_exports.init=()=>{var _userBulkForm$closest;const userBulkForm=document.querySelector(Selectors_bulkActionsForm),userReport=null==userBulkForm||null===(_userBulkForm$closest=userBulkForm.closest(Selectors_userReportWrapper))||void 0===_userBulkForm$closest?void 0:_userBulkForm$closest.querySelector(reportSelectors.regions.report);if(!userBulkForm||!userReport)return;const actionSelect=userBulkForm.querySelector("select");CustomEvents.define(actionSelect,[CustomEvents.events.accessibleChange]),(0,_jquery.default)(actionSelect).on(CustomEvents.events.accessibleChange,(event=>{if(event.target.value&&"0"!=="".concat(event.target.value)){const e=new Event("submit",{cancelable:!0});userBulkForm.dispatchEvent(e),e.defaultPrevented||(FormChangeChecker.markFormSubmitted(userBulkForm),userBulkForm.submit())}}));const updateUserIds=()=>{const selectedUsers=[...userReport.querySelectorAll(Selectors_checkedRows)],selectedUserIds=selectedUsers.map((check=>parseInt(check.value)));userBulkForm.querySelector('[name="userids"]').value=selectedUserIds.join(","),actionSelect.disabled=0===selectedUsers.length;const selectedUsersNames=selectedUsers.map((check=>document.querySelector('label[for="'.concat(check.id,'"]')).textContent));userBulkForm.data={userids:selectedUserIds,usernames:selectedUsersNames}};updateUserIds(),document.addEventListener("change",(event=>{(event.target.matches(Selectors_checkbox)||event.target.matches(Selectors_masterCheckbox))&&userReport.contains(event.target)&&updateUserIds()})),document.addEventListener(tableEvents.tableContentRefreshed,(event=>{userReport.contains(event.target)&&updateUserIds()}))}}));
|
||||
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,reportSelectors=_interopRequireWildcard(reportSelectors),tableEvents=_interopRequireWildcard(tableEvents),FormChangeChecker=_interopRequireWildcard(FormChangeChecker),CustomEvents=_interopRequireWildcard(CustomEvents),_jquery=(obj=_jquery)&&obj.__esModule?obj:{default:obj};const Selectors_bulkActionsForm="form#user-bulk-action-form",Selectors_userReportWrapper='[data-region="report-user-list-wrapper"]',Selectors_checkbox='input[type="checkbox"][data-togglegroup="report-select-all"][data-toggle="slave"]',Selectors_masterCheckbox='input[type="checkbox"][data-togglegroup="report-select-all"][data-toggle="master"]',Selectors_checkedRows='[data-togglegroup="report-select-all"][data-toggle="slave"]:checked';_exports.init=()=>{var _userBulkForm$closest;const userBulkForm=document.querySelector(Selectors_bulkActionsForm),userReport=null==userBulkForm||null===(_userBulkForm$closest=userBulkForm.closest(Selectors_userReportWrapper))||void 0===_userBulkForm$closest?void 0:_userBulkForm$closest.querySelector(reportSelectors.regions.report);if(!userBulkForm||!userReport)return;const actionSelect=userBulkForm.querySelector("select");CustomEvents.define(actionSelect,[CustomEvents.events.accessibleChange]),(0,_jquery.default)(actionSelect).on(CustomEvents.events.accessibleChange,(event=>{if(event.target.value&&"0"!=="".concat(event.target.value)){const e=new Event("submit",{cancelable:!0});userBulkForm.dispatchEvent(e),e.defaultPrevented||(FormChangeChecker.markFormSubmitted(userBulkForm),userBulkForm.submit())}}));const updateUserIds=()=>{const selectedUsers=[...userReport.querySelectorAll(Selectors_checkedRows)],selectedUserIds=selectedUsers.map((check=>parseInt(check.value)));userBulkForm.querySelector('[name="userids"]').value=selectedUserIds.join(","),actionSelect.disabled=0===selectedUsers.length,actionSelect.disabled&&(actionSelect.value="0");const selectedUsersNames=selectedUsers.map((check=>document.querySelector('label[for="'.concat(check.id,'"]')).textContent));userBulkForm.data={userids:selectedUserIds,usernames:selectedUsersNames}};updateUserIds(),document.addEventListener("change",(event=>{(event.target.matches(Selectors_checkbox)||event.target.matches(Selectors_masterCheckbox))&&userReport.contains(event.target)&&updateUserIds()})),document.addEventListener(tableEvents.tableContentRefreshed,(event=>{userReport.contains(event.target)&&updateUserIds()}))}}));
|
||||
|
||||
//# sourceMappingURL=bulk_user_actions.min.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -65,7 +65,13 @@ export const init = () => {
|
||||
const selectedUsers = [...userReport.querySelectorAll(Selectors.checkedRows)];
|
||||
const selectedUserIds = selectedUsers.map(check => parseInt(check.value));
|
||||
userBulkForm.querySelector('[name="userids"]').value = selectedUserIds.join(',');
|
||||
|
||||
// Disable the action selector if nothing selected, and reset the current selection.
|
||||
actionSelect.disabled = selectedUsers.length === 0;
|
||||
if (actionSelect.disabled) {
|
||||
actionSelect.value = "0";
|
||||
}
|
||||
|
||||
const selectedUsersNames = selectedUsers.map(check => document.querySelector(`label[for="${check.id}"]`).textContent);
|
||||
// Add the user ids and names to the form data attributes so they can be available from the
|
||||
// other JS modules that listen to the form submit event.
|
||||
|
||||
@@ -184,6 +184,7 @@ class users extends system_report {
|
||||
$entityuseralias = $entityuser->get_table_alias('user');
|
||||
|
||||
$filters = [
|
||||
'user:fullname',
|
||||
'user:firstname',
|
||||
'user:lastname',
|
||||
'user:username',
|
||||
|
||||
@@ -4508,4 +4508,199 @@
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="4.5" requires="4.1.2">
|
||||
<UNICODE level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unicoderequired" />
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mariadb" version="10.6.7" />
|
||||
<VENDOR name="mysql" version="8.0" />
|
||||
<VENDOR name="postgres" version="13" />
|
||||
<VENDOR name="mssql" version="14.0" />
|
||||
<VENDOR name="oracle" version="19" />
|
||||
</DATABASE>
|
||||
<PHP version="8.1.0" level="required">
|
||||
</PHP>
|
||||
<PCREUNICODE level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="pcreunicodewarning" />
|
||||
</FEEDBACK>
|
||||
</PCREUNICODE>
|
||||
<PHP_EXTENSIONS>
|
||||
<PHP_EXTENSION name="iconv" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="iconvrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="mbstring" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="mbstringrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="curl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="curlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="openssl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="opensslrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="tokenizer" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="tokenizerrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="soap" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="soaprecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="ctype" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ctyperequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="zip" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ziprequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="zlib" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="gd" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="gdrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="simplexml" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="simplexmlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="spl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="splrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="pcre" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="dom" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xml" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xmlreader" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="intl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="intlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="json" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="hash" level="required"/>
|
||||
<PHP_EXTENSION name="fileinfo" level="required"/>
|
||||
<PHP_EXTENSION name="sodium" level="required"/>
|
||||
<PHP_EXTENSION name="exif" level="optional"/>
|
||||
</PHP_EXTENSIONS>
|
||||
<PHP_SETTINGS>
|
||||
<PHP_SETTING name="memory_limit" value="96M" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="settingmemorylimit" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="file_uploads" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="settingfileuploads" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="opcache.enable" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="opcacherecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
</PHP_SETTINGS>
|
||||
<CUSTOM_CHECKS>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_storage_engine" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbstorageengine" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="question/engine/upgrade/upgradelib.php" function="quiz_attempts_upgraded" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="quizattemptsupgradedmessage" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_slasharguments" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="slashargumentswarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_tables_row_format" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="unsupporteddbtablerowformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_unoconv_version" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="unoconvwarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_libcurl_version" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="libcurlwarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_format" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbfileformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_per_table" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbfilepertable" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_large_prefix" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddblargeprefix" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_is_https" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="ishttpswarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_incomplete_unicode_support" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="incompleteunicodesupport" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_sixtyfour_bits" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="sixtyfourbitsrequired" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_max_input_vars" level="optional">
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_admin_dir_usage" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="iscustomadminwarnings" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_xmlrpc_usage" level="optional">
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mod_assignment" level="required">
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_db_prefix_length" level="required">
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_oracle_usage" level="optional">
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_async_backup" level="recommended">
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
</COMPATIBILITY_MATRIX>
|
||||
|
||||
@@ -29,6 +29,14 @@ use stdClass;
|
||||
* @coversDefaultClass \core_adminpresets\manager
|
||||
*/
|
||||
class manager_test extends \advanced_testcase {
|
||||
/**
|
||||
* Include required libraries.
|
||||
*/
|
||||
public static function setUpBeforeClass(): void {
|
||||
global $CFG;
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the behaviour of protected get_site_settings method.
|
||||
*
|
||||
|
||||
@@ -36,7 +36,7 @@ class privacy_provider_test extends provider_testcase {
|
||||
* Test for provider::get_metadata().
|
||||
* @covers ::get_metadata
|
||||
*/
|
||||
public function test_get_metadata() {
|
||||
public function test_get_metadata(): void {
|
||||
$collection = new collection('core_adminpresets');
|
||||
$newcollection = provider::get_metadata($collection);
|
||||
$itemcollection = $newcollection->get_collection();
|
||||
@@ -49,7 +49,7 @@ class privacy_provider_test extends provider_testcase {
|
||||
* Test for provider::get_contexts_for_userid() doesn't return any context.
|
||||
* @covers ::get_contexts_for_userid
|
||||
*/
|
||||
public function test_get_contexts_for_userid() {
|
||||
public function test_get_contexts_for_userid(): void {
|
||||
global $USER;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -67,7 +67,7 @@ class privacy_provider_test extends provider_testcase {
|
||||
* Test for provider::get_users_in_context() doesn't return any user.
|
||||
* @covers ::get_users_in_context
|
||||
*/
|
||||
public function test_get_users_in_context() {
|
||||
public function test_get_users_in_context(): void {
|
||||
global $USER;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -88,7 +88,7 @@ class privacy_provider_test extends provider_testcase {
|
||||
* Test for provider::export_user_data().
|
||||
* @covers ::export_user_data
|
||||
*/
|
||||
public function test_export_user_data() {
|
||||
public function test_export_user_data(): void {
|
||||
global $USER;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -121,7 +121,7 @@ class privacy_provider_test extends provider_testcase {
|
||||
* Test for provider::delete_data_for_all_users_in_context().
|
||||
* @covers ::delete_data_for_all_users_in_context
|
||||
*/
|
||||
public function test_delete_data_for_all_users_in_context() {
|
||||
public function test_delete_data_for_all_users_in_context(): void {
|
||||
global $DB, $USER;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -146,7 +146,7 @@ class privacy_provider_test extends provider_testcase {
|
||||
* Test for provider::delete_data_for_user().
|
||||
* @covers ::delete_data_for_user
|
||||
*/
|
||||
public function test_delete_data_for_user() {
|
||||
public function test_delete_data_for_user(): void {
|
||||
global $DB, $USER;
|
||||
|
||||
$this->resetAfterTest();
|
||||
|
||||
@@ -27,7 +27,7 @@ use core_role_preset;
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class preset_test extends \advanced_testcase {
|
||||
public function test_xml() {
|
||||
public function test_xml(): void {
|
||||
global $DB;
|
||||
|
||||
$roles = $DB->get_records('role');
|
||||
@@ -81,7 +81,7 @@ class preset_test extends \advanced_testcase {
|
||||
* Tests covered method.
|
||||
* @covers \core_role_preset::parse_preset
|
||||
*/
|
||||
public function test_mixed_levels() {
|
||||
public function test_mixed_levels(): void {
|
||||
// The problem here is that we cannot guarantee plugin contexts
|
||||
// have unique short names, so we have to also support level numbers.
|
||||
$xml = file_get_contents(__DIR__ . '/fixtures/mixed_levels.xml');
|
||||
|
||||
@@ -45,7 +45,7 @@ class provider_test extends provider_testcase {
|
||||
* Test to check export_user_preferences.
|
||||
* returns user preferences data.
|
||||
*/
|
||||
public function test_export_user_preferences() {
|
||||
public function test_export_user_preferences(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
@@ -64,7 +64,7 @@ class provider_test extends provider_testcase {
|
||||
/**
|
||||
* Check all contexts are returned if there is any user data for this user.
|
||||
*/
|
||||
public function test_get_contexts_for_userid() {
|
||||
public function test_get_contexts_for_userid(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -114,7 +114,7 @@ class provider_test extends provider_testcase {
|
||||
/**
|
||||
* Test that user data is exported correctly.
|
||||
*/
|
||||
public function test_export_user_data() {
|
||||
public function test_export_user_data(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -243,7 +243,7 @@ class provider_test extends provider_testcase {
|
||||
/**
|
||||
* Test for provider::delete_data_for_all_users_in_context().
|
||||
*/
|
||||
public function test_delete_data_for_all_users_in_context() {
|
||||
public function test_delete_data_for_all_users_in_context(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -329,7 +329,7 @@ class provider_test extends provider_testcase {
|
||||
/**
|
||||
* Test for provider::delete_data_for_user().
|
||||
*/
|
||||
public function test_delete_data_for_user() {
|
||||
public function test_delete_data_for_user(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -387,7 +387,7 @@ class provider_test extends provider_testcase {
|
||||
/**
|
||||
* Export for a user with a key against a script where no instance is specified.
|
||||
*/
|
||||
public function test_export_user_role_to_cohort() {
|
||||
public function test_export_user_role_to_cohort(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -443,7 +443,7 @@ class provider_test extends provider_testcase {
|
||||
/**
|
||||
* Test for provider::delete_user_role_to_cohort().
|
||||
*/
|
||||
public function test_delete_user_role_to_cohort() {
|
||||
public function test_delete_user_role_to_cohort(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -478,7 +478,7 @@ class provider_test extends provider_testcase {
|
||||
/**
|
||||
* Test that only users within a course context are fetched.
|
||||
*/
|
||||
public function test_get_users_in_context() {
|
||||
public function test_get_users_in_context(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -599,7 +599,7 @@ class provider_test extends provider_testcase {
|
||||
/**
|
||||
* Test that data for users in approved userlist is deleted.
|
||||
*/
|
||||
public function test_delete_data_for_users() {
|
||||
public function test_delete_data_for_users(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
|
||||
@@ -152,7 +152,9 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
$sensiblesettingsdefault .= 'server_password@@search_solr, ssl_keypassword@@search_solr, ';
|
||||
$sensiblesettingsdefault .= 'alternateserver_password@@search_solr, alternatessl_keypassword@@search_solr, ';
|
||||
$sensiblesettingsdefault .= 'test_password@@cachestore_redis, password@@mlbackend_python, ';
|
||||
$sensiblesettingsdefault .= 'badges_badgesalt@@none, calendar_exportsalt@@none';
|
||||
$sensiblesettingsdefault .= 'badges_badgesalt@@none, calendar_exportsalt@@none, ';
|
||||
$sensiblesettingsdefault .= 'bigbluebuttonbn_shared_secret@@none, apikey@@tiny_premium, ';
|
||||
$sensiblesettingsdefault .= 'matrixaccesstoken@@communication_matrix, api_secret@@factor_sms';
|
||||
$temp->add(new admin_setting_configtextarea('adminpresets/sensiblesettings',
|
||||
get_string('sensiblesettings', 'core_adminpresets'),
|
||||
get_string('sensiblesettingstext', 'core_adminpresets'),
|
||||
|
||||
@@ -18,7 +18,7 @@ Feature: An administrator can browse user accounts
|
||||
When I navigate to "Users > Accounts > Browse list of users" in site administration
|
||||
# Name field always present, email field is default for showidentity.
|
||||
Then the following should exist in the "reportbuilder-table" table:
|
||||
| First name / Last name | Email address |
|
||||
| First name | Email address |
|
||||
| User One | one@example.com |
|
||||
| User Two | two@example.com |
|
||||
# Should not see other identity fields or non-default name fields.
|
||||
@@ -34,7 +34,7 @@ Feature: An administrator can browse user accounts
|
||||
| alternativefullnameformat | firstnamephonetic lastname |
|
||||
When I navigate to "Users > Accounts > Browse list of users" in site administration
|
||||
Then the following should exist in the "reportbuilder-table" table:
|
||||
| First name - phonetic / Last name | Email address |
|
||||
| First name - phonetic | Email address |
|
||||
| Yewzer One | one@example.com |
|
||||
| Yoozare Two | two@example.com |
|
||||
|
||||
@@ -43,7 +43,7 @@ Feature: An administrator can browse user accounts
|
||||
| showuseridentity | department,profile_field_frog |
|
||||
When I navigate to "Users > Accounts > Browse list of users" in site administration
|
||||
Then the following should exist in the "reportbuilder-table" table:
|
||||
| First name / Last name | Favourite frog | Department |
|
||||
| First name | Favourite frog | Department |
|
||||
| User One | Kermit | Attack |
|
||||
| User Two | Tree | Defence |
|
||||
And I should not see "Email address" in the "table" "css_element"
|
||||
@@ -103,7 +103,7 @@ Feature: An administrator can browse user accounts
|
||||
| user3 | User | Three | three@example.com | Glass |
|
||||
And I navigate to "Users > Accounts > Browse list of users" in site administration
|
||||
Then the following should exist in the "reportbuilder-table" table:
|
||||
| First name / Last name | Email address |
|
||||
| First name | Email address |
|
||||
| User One | one@example.com |
|
||||
| User Two | two@example.com |
|
||||
| User Three | three@example.com |
|
||||
@@ -137,7 +137,7 @@ Feature: An administrator can browse user accounts
|
||||
| user2 | C1 | student |
|
||||
And I navigate to "Users > Accounts > Browse list of users" in site administration
|
||||
Then the following should exist in the "reportbuilder-table" table:
|
||||
| First name / Last name | Email address |
|
||||
| First name | Email address |
|
||||
| User One | one@example.com |
|
||||
| User Two | two@example.com |
|
||||
And I click on "Filters" "button"
|
||||
@@ -166,7 +166,7 @@ Feature: An administrator can browse user accounts
|
||||
| user1 | coursecreator | system | |
|
||||
And I navigate to "Users > Accounts > Browse list of users" in site administration
|
||||
Then the following should exist in the "reportbuilder-table" table:
|
||||
| First name / Last name | Email address |
|
||||
| First name | Email address |
|
||||
| User One | one@example.com |
|
||||
| User Two | two@example.com |
|
||||
| User Three | three@example.com |
|
||||
|
||||
@@ -159,3 +159,24 @@ Feature: An administrator can filter user accounts by role, cohort and other pro
|
||||
And I should not see "User One" in the "reportbuilder-table" "table"
|
||||
And I should not see "User Three" in the "reportbuilder-table" "table"
|
||||
And I should not see "User Four" in the "reportbuilder-table" "table"
|
||||
|
||||
@javascript
|
||||
Scenario: Filter users by full name
|
||||
When I click on "Filters" "button"
|
||||
And I set the following fields in the "Full name" "core_reportbuilder > Filter" to these values:
|
||||
| Full name operator | Is equal to |
|
||||
| Full name value | User One |
|
||||
And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
|
||||
Then I should see "User One" in the "reportbuilder-table" "table"
|
||||
And I should not see "User Two" in the "reportbuilder-table" "table"
|
||||
And I should not see "User Three" in the "reportbuilder-table" "table"
|
||||
And I should not see "User Four" in the "reportbuilder-table" "table"
|
||||
And I click on "Reset all" "button" in the "[data-region='report-filters']" "css_element"
|
||||
And I set the following fields in the "Full name" "core_reportbuilder > Filter" to these values:
|
||||
| Full name operator | Is equal to |
|
||||
| Full name value | User Two |
|
||||
And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
|
||||
And I should see "User Two" in the "reportbuilder-table" "table"
|
||||
And I should not see "User One" in the "reportbuilder-table" "table"
|
||||
And I should not see "User Three" in the "reportbuilder-table" "table"
|
||||
And I should not see "User Four" in the "reportbuilder-table" "table"
|
||||
|
||||
@@ -30,7 +30,7 @@ class preset_deleted_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test preset_deleted event.
|
||||
*/
|
||||
public function test_preset_deleted_event() {
|
||||
public function test_preset_deleted_event(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class preset_downloaded_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test preset_downloaded event.
|
||||
*/
|
||||
public function test_preset_downloaded_event() {
|
||||
public function test_preset_downloaded_event(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class preset_exported_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test preset_exported event.
|
||||
*/
|
||||
public function test_preset_exported_event() {
|
||||
public function test_preset_exported_event(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class preset_imported_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test preset_imported event.
|
||||
*/
|
||||
public function test_preset_imported_event() {
|
||||
public function test_preset_imported_event(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class preset_loaded_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test preset_loaded event.
|
||||
*/
|
||||
public function test_preset_loaded_event() {
|
||||
public function test_preset_loaded_event(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class preset_previewed_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test preset_previewed event.
|
||||
*/
|
||||
public function test_preset_previewed_event() {
|
||||
public function test_preset_previewed_event(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class preset_reverted_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test preset_reverted event.
|
||||
*/
|
||||
public function test_preset_reverted_event() {
|
||||
public function test_preset_reverted_event(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class presets_listed_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test presets_listed event.
|
||||
*/
|
||||
public function test_presets_listed_event() {
|
||||
public function test_presets_listed_event(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
|
||||
+2
-2
@@ -50,7 +50,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* test_potential_contexts description
|
||||
*/
|
||||
public function test_potential_contexts() {
|
||||
public function test_potential_contexts(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setAdminUser();
|
||||
@@ -71,7 +71,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* test_potential_contexts description
|
||||
*/
|
||||
public function test_potential_contexts_no_manager() {
|
||||
public function test_potential_contexts_no_manager(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
|
||||
@@ -70,7 +70,7 @@ class behat_form_text_test extends \basic_testcase {
|
||||
* @param mixed $expectation value to be checked.
|
||||
* @dataProvider provider_test_set_get_value()
|
||||
*/
|
||||
public function test_set_get_value($value, $expectation) {
|
||||
public function test_set_get_value($value, $expectation): void {
|
||||
$session = $this->createMock(Session::class);
|
||||
$node = $this->createMock(NodeElement::class);
|
||||
$node->method('getValue')->willReturn($value);
|
||||
@@ -115,7 +115,7 @@ class behat_form_text_test extends \basic_testcase {
|
||||
* @param bool $result expected return status of the function.
|
||||
* @dataProvider provider_test_matches()
|
||||
*/
|
||||
public function test_matches($decsep, $value, $match, $result) {
|
||||
public function test_matches($decsep, $value, $match, $result): void {
|
||||
global $CFG;
|
||||
|
||||
// Switch of string manager to avoid having to (slow) customise the lang file.
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tool_behat;
|
||||
|
||||
use behat_config_util;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
global $CFG;
|
||||
@@ -39,7 +43,7 @@ require_once($CFG->libdir . '/behat/classes/behat_config_manager.php');
|
||||
* @copyright 2016 Rajesh Taneja
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_behat_manager_util_testcase extends advanced_testcase {
|
||||
class manager_util_test extends \advanced_testcase {
|
||||
|
||||
/** @var array Fixtures features which are available. */
|
||||
private $featurepaths = array(
|
||||
|
||||
@@ -35,7 +35,7 @@ class accessibility_test extends \advanced_testcase {
|
||||
* @throws \dml_exception
|
||||
* @throws \moodle_exception
|
||||
*/
|
||||
public function test_get_title() {
|
||||
public function test_get_title(): void {
|
||||
$this->resetAfterTest();
|
||||
$object = new accessibility();
|
||||
$filter = new filter();
|
||||
@@ -57,7 +57,7 @@ class accessibility_test extends \advanced_testcase {
|
||||
*
|
||||
* @throws \dml_exception
|
||||
*/
|
||||
public function test_check_ids() {
|
||||
public function test_check_ids(): void {
|
||||
$this->resetAfterTest();
|
||||
$object = new accessibility();
|
||||
|
||||
@@ -74,7 +74,7 @@ class accessibility_test extends \advanced_testcase {
|
||||
*
|
||||
* @throws \dml_exception
|
||||
*/
|
||||
public function test_get_translations() {
|
||||
public function test_get_translations(): void {
|
||||
$this->resetAfterTest();
|
||||
$object = new accessibility();
|
||||
|
||||
@@ -90,7 +90,7 @@ class accessibility_test extends \advanced_testcase {
|
||||
*
|
||||
* @throws \dml_exception
|
||||
*/
|
||||
public function test_get_category_courseids() {
|
||||
public function test_get_category_courseids(): void {
|
||||
$this->resetAfterTest();
|
||||
$object = new accessibility();
|
||||
$category = $this->getDataGenerator()->create_category();
|
||||
|
||||
@@ -32,7 +32,7 @@ class area_test extends area_test_base {
|
||||
/**
|
||||
* Test for the area assign intro
|
||||
*/
|
||||
public function test_assign() {
|
||||
public function test_assign(): void {
|
||||
$this->resetAfterTest();
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$assign1 = $this->getDataGenerator()->create_module('assign', array(
|
||||
@@ -87,7 +87,7 @@ class area_test extends area_test_base {
|
||||
/**
|
||||
* Test for the area questiontext
|
||||
*/
|
||||
public function test_questiontext() {
|
||||
public function test_questiontext(): void {
|
||||
$this->resetAfterTest();
|
||||
/** @var \core_question_generator $generator */
|
||||
$generator = $this->getDataGenerator()->get_plugin_generator('core_question');
|
||||
@@ -147,7 +147,7 @@ class area_test extends area_test_base {
|
||||
/**
|
||||
* test for the area questionanswers
|
||||
*/
|
||||
public function test_questionanswers() {
|
||||
public function test_questionanswers(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -191,7 +191,7 @@ class area_test extends area_test_base {
|
||||
/**
|
||||
* Test for the areas choice intro and choice options
|
||||
*/
|
||||
public function test_choice() {
|
||||
public function test_choice(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
|
||||
@@ -27,7 +27,7 @@ use tool_brickfield\local\tool\filter;
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class filters_test extends \advanced_testcase {
|
||||
public function test_constructor() {
|
||||
public function test_constructor(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Variables.
|
||||
@@ -56,7 +56,7 @@ class filters_test extends \advanced_testcase {
|
||||
$this->assertEquals($object->url, $url);
|
||||
}
|
||||
|
||||
public function test_get_course_sql() {
|
||||
public function test_get_course_sql(): void {
|
||||
$this->resetAfterTest();
|
||||
$object = new filter();
|
||||
|
||||
@@ -73,7 +73,7 @@ class filters_test extends \advanced_testcase {
|
||||
|
||||
}
|
||||
|
||||
public function test_validate_filters() {
|
||||
public function test_validate_filters(): void {
|
||||
$this->resetAfterTest();
|
||||
// Variables.
|
||||
$courseid = 0;
|
||||
@@ -102,7 +102,7 @@ class filters_test extends \advanced_testcase {
|
||||
$this->assertFalse($output);
|
||||
}
|
||||
|
||||
public function test_has_course_filters() {
|
||||
public function test_has_course_filters(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$object = new filter();
|
||||
@@ -114,7 +114,7 @@ class filters_test extends \advanced_testcase {
|
||||
$this->assertTrue($output);
|
||||
}
|
||||
|
||||
public function test_has_capability_in_context() {
|
||||
public function test_has_capability_in_context(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -151,7 +151,7 @@ class filters_test extends \advanced_testcase {
|
||||
$this->assertTrue($output);
|
||||
}
|
||||
|
||||
public function test_get_errormessage() {
|
||||
public function test_get_errormessage(): void {
|
||||
$this->resetAfterTest();
|
||||
// Variables.
|
||||
$courseid = 0;
|
||||
|
||||
@@ -36,7 +36,7 @@ class questionanswers_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test find course areas.
|
||||
*/
|
||||
public function test_find_course_areas() {
|
||||
public function test_find_course_areas(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
@@ -122,7 +122,7 @@ class questionanswers_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test find relevant areas.
|
||||
*/
|
||||
public function test_find_relevant_areas() {
|
||||
public function test_find_relevant_areas(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
@@ -153,7 +153,7 @@ class questionanswers_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test find system areas.
|
||||
*/
|
||||
public function test_find_system_areas() {
|
||||
public function test_find_system_areas(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ class questiontext_test extends area_test_base {
|
||||
/**
|
||||
* Test find course areas.
|
||||
*/
|
||||
public function test_find_course_areas() {
|
||||
public function test_find_course_areas(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
@@ -126,7 +126,7 @@ class questiontext_test extends area_test_base {
|
||||
/**
|
||||
* Test find relevant areas.
|
||||
*/
|
||||
public function test_find_relevant_areas() {
|
||||
public function test_find_relevant_areas(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
@@ -156,7 +156,7 @@ class questiontext_test extends area_test_base {
|
||||
/**
|
||||
* Test find system areas.
|
||||
*/
|
||||
public function test_find_system_areas() {
|
||||
public function test_find_system_areas(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
@@ -197,7 +197,7 @@ class questiontext_test extends area_test_base {
|
||||
*
|
||||
* @covers ::get_course_and_category
|
||||
*/
|
||||
public function test_get_course_and_category() {
|
||||
public function test_get_course_and_category(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
|
||||
+1
-1
@@ -103,7 +103,7 @@ EOD;
|
||||
/**
|
||||
* Test for links opening a new tab or window
|
||||
*/
|
||||
public function test_check() {
|
||||
public function test_check(): void {
|
||||
$results = $this->get_checker_results($this->htmlfail);
|
||||
$this->assertTrue($results[0]->element->tagName == 'a');
|
||||
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ EOD;
|
||||
/**
|
||||
* Test for anchor tags containing text
|
||||
*/
|
||||
public function test_check() {
|
||||
public function test_check(): void {
|
||||
$results = $this->get_checker_results($this->htmlfail);
|
||||
$this->assertTrue($results[0]->element->tagName == 'a');
|
||||
|
||||
|
||||
+1
-1
@@ -90,7 +90,7 @@ EOD;
|
||||
/**
|
||||
* Test for anchor tags not containing susplicious link text
|
||||
*/
|
||||
public function test_check() {
|
||||
public function test_check(): void {
|
||||
$results = $this->get_checker_results($this->htmlpass);
|
||||
$this->assertEmpty($results);
|
||||
|
||||
|
||||
+1
-1
@@ -103,7 +103,7 @@ EOD;
|
||||
/**
|
||||
* Test Area tags opening new window without warning
|
||||
*/
|
||||
public function test_check() {
|
||||
public function test_check(): void {
|
||||
$results = $this->get_checker_results($this->htmlfail);
|
||||
$this->assertTrue($results[0]->element->tagName == 'area');
|
||||
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ EOD;
|
||||
/**
|
||||
* Test for area tags containing an alt value
|
||||
*/
|
||||
public function test_check() {
|
||||
public function test_check(): void {
|
||||
$results = $this->get_checker_results($this->htmlfail);
|
||||
$this->assertTrue($results[0]->element->tagName == 'area');
|
||||
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ EOD;
|
||||
/**
|
||||
* Test for basefont tags being used
|
||||
*/
|
||||
public function test_check() {
|
||||
public function test_check(): void {
|
||||
$results = $this->get_checker_results($this->htmlfail);
|
||||
$this->assertTrue($results[0]->element->tagName == 'basefont');
|
||||
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ EOD;
|
||||
/**
|
||||
* Test for blink tags being used
|
||||
*/
|
||||
public function test_check() {
|
||||
public function test_check(): void {
|
||||
$results = $this->get_checker_results($this->htmlfail);
|
||||
$this->assertTrue($results[0]->element->tagName == 'blink');
|
||||
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ EOD;
|
||||
/**
|
||||
* Test for b tags being used
|
||||
*/
|
||||
public function test_check() {
|
||||
public function test_check(): void {
|
||||
$results = $this->get_checker_results($this->htmlfail);
|
||||
$this->assertTrue($results[0]->element->tagName == 'b');
|
||||
$this->assertTrue($results[1]->element->tagName == 'b');
|
||||
|
||||
+1
-1
@@ -124,7 +124,7 @@ EOD;
|
||||
/**
|
||||
* Test for checking the length of the content
|
||||
*/
|
||||
public function test_check() {
|
||||
public function test_check(): void {
|
||||
$results = $this->get_checker_results($this->htmlfail);
|
||||
$this->assertTrue($results[0]->message == '<p id=\'wc\'>Word Count: 578</p>');
|
||||
|
||||
|
||||
+13
-13
@@ -229,7 +229,7 @@ EOD;
|
||||
/**
|
||||
* Test for the area assign intro
|
||||
*/
|
||||
public function test_check() {
|
||||
public function test_check(): void {
|
||||
$results = $this->get_checker_results($this->htmlfail1);
|
||||
$this->assertTrue($results[0]->element->tagName == 'p');
|
||||
|
||||
@@ -255,7 +255,7 @@ EOD;
|
||||
/**
|
||||
* Test with valid colour names.
|
||||
*/
|
||||
public function test_check_for_namedcolours() {
|
||||
public function test_check_for_namedcolours(): void {
|
||||
$results = $this->get_checker_results($this->namecolours);
|
||||
$this->assertTrue($results[0]->element->tagName == 'p');
|
||||
}
|
||||
@@ -263,7 +263,7 @@ EOD;
|
||||
/**
|
||||
* Test with invalid colour names.
|
||||
*/
|
||||
public function test_check_for_invalidcolours() {
|
||||
public function test_check_for_invalidcolours(): void {
|
||||
$results = $this->get_checker_results($this->invalidcolours);
|
||||
$this->assertTrue($results[0]->element->tagName == 'p');
|
||||
}
|
||||
@@ -271,7 +271,7 @@ EOD;
|
||||
/**
|
||||
* Test with invalid colour numeric values.
|
||||
*/
|
||||
public function test_check_for_invalidvalues() {
|
||||
public function test_check_for_invalidvalues(): void {
|
||||
$results = $this->get_checker_results($this->invalidvalue);
|
||||
$this->assertTrue($results[0]->element->tagName == 'p');
|
||||
}
|
||||
@@ -279,7 +279,7 @@ EOD;
|
||||
/**
|
||||
* Test with empty colour values.
|
||||
*/
|
||||
public function test_check_for_emptyvalues() {
|
||||
public function test_check_for_emptyvalues(): void {
|
||||
$results = $this->get_checker_results($this->emptyvalue);
|
||||
$this->assertEmpty($results);
|
||||
}
|
||||
@@ -287,7 +287,7 @@ EOD;
|
||||
/**
|
||||
* Test for text px18 with insufficient contrast of 4.49.
|
||||
*/
|
||||
public function test_check_for_px18_fail() {
|
||||
public function test_check_for_px18_fail(): void {
|
||||
$results = $this->get_checker_results($this->px18);
|
||||
$this->assertTrue($results[0]->element->tagName == 'p');
|
||||
}
|
||||
@@ -295,7 +295,7 @@ EOD;
|
||||
/**
|
||||
* Test for text px19 bold with sufficient contrast of 4.49.
|
||||
*/
|
||||
public function test_check_for_px19bold_pass() {
|
||||
public function test_check_for_px19bold_pass(): void {
|
||||
$results = $this->get_checker_results($this->px19bold);
|
||||
$this->assertEmpty($results);
|
||||
}
|
||||
@@ -303,7 +303,7 @@ EOD;
|
||||
/**
|
||||
* Test for text px18 with sufficient contrast of 4.81.
|
||||
*/
|
||||
public function test_check_for_px18_pass() {
|
||||
public function test_check_for_px18_pass(): void {
|
||||
$results = $this->get_checker_results($this->px18pass);
|
||||
$this->assertEmpty($results);
|
||||
}
|
||||
@@ -311,7 +311,7 @@ EOD;
|
||||
/**
|
||||
* Test for medium (12pt) text with insufficient contrast of 4.49.
|
||||
*/
|
||||
public function test_check_for_medium_fail() {
|
||||
public function test_check_for_medium_fail(): void {
|
||||
$results = $this->get_checker_results($this->mediumfail);
|
||||
$this->assertTrue($results[0]->element->tagName == 'p');
|
||||
}
|
||||
@@ -319,7 +319,7 @@ EOD;
|
||||
/**
|
||||
* Test for medium (12pt) text with sufficient contrast of 4.81.
|
||||
*/
|
||||
public function test_check_for_medium_pass() {
|
||||
public function test_check_for_medium_pass(): void {
|
||||
$results = $this->get_checker_results($this->mediumpass);
|
||||
$this->assertEmpty($results);
|
||||
}
|
||||
@@ -327,7 +327,7 @@ EOD;
|
||||
/**
|
||||
* Test for larger (14pt) text with insufficient contrast of 2.94.
|
||||
*/
|
||||
public function test_check_for_larger_fail() {
|
||||
public function test_check_for_larger_fail(): void {
|
||||
$results = $this->get_checker_results($this->largerfail);
|
||||
$this->assertTrue($results[0]->element->tagName == 'p');
|
||||
}
|
||||
@@ -335,7 +335,7 @@ EOD;
|
||||
/**
|
||||
* Test for larger (14pt) text with insufficient contrast of 3.02.
|
||||
*/
|
||||
public function test_check_for_larger_pass() {
|
||||
public function test_check_for_larger_pass(): void {
|
||||
$results = $this->get_checker_results($this->largerpass);
|
||||
$this->assertTrue($results[0]->element->tagName == 'p');
|
||||
}
|
||||
@@ -343,7 +343,7 @@ EOD;
|
||||
/**
|
||||
* Test for larger (14pt) bold text with sufficient contrast of 3.02.
|
||||
*/
|
||||
public function test_check_for_largerbold_pass() {
|
||||
public function test_check_for_largerbold_pass(): void {
|
||||
$results = $this->get_checker_results($this->largerboldpass);
|
||||
$this->assertEmpty($results);
|
||||
}
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@ EOD;
|
||||
/**
|
||||
* Test for noembed child tags
|
||||
*/
|
||||
public function test_check() {
|
||||
public function test_check(): void {
|
||||
$results = $this->get_checker_results($this->htmlfail);
|
||||
$this->assertTrue($results[0]->element->tagName == 'embed');
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ EOD;
|
||||
/**
|
||||
* Test the header following an h3 must be h1, h2, h3 or h4.
|
||||
*/
|
||||
public function test_check() {
|
||||
public function test_check(): void {
|
||||
$results = $this->get_checker_results($this->htmlfail1);
|
||||
$this->assertTrue($results[0]->element->tagName == 'h5');
|
||||
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ EOD;
|
||||
/**
|
||||
* Test for headers not containing text
|
||||
*/
|
||||
public function test_check() {
|
||||
public function test_check(): void {
|
||||
$results = $this->get_checker_results($this->htmlfail);
|
||||
$this->assertTrue($results[0]->element->tagName == 'h2');
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ EOD;
|
||||
/**
|
||||
* Test for i tags being used
|
||||
*/
|
||||
public function test_check() {
|
||||
public function test_check(): void {
|
||||
$results = $this->get_checker_results($this->htmlfail);
|
||||
$this->assertTrue($results[0]->element->tagName == 'i');
|
||||
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ EOD;
|
||||
/**
|
||||
* Test for img alt attributes matching the src attribute
|
||||
*/
|
||||
public function test_check() {
|
||||
public function test_check(): void {
|
||||
$results = $this->get_checker_results($this->htmlfail);
|
||||
$this->assertTrue($results[0]->element->tagName == 'img');
|
||||
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ EOD;
|
||||
/**
|
||||
* Test for image alt attributes being too long
|
||||
*/
|
||||
public function test_check() {
|
||||
public function test_check(): void {
|
||||
$results = $this->get_checker_results($this->htmlfail);
|
||||
$this->assertTrue($results[0]->element->tagName == 'img');
|
||||
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ EOD;
|
||||
/**
|
||||
* Test for >Anchor tags containing a nested img tag, must not have an empty alt attribute
|
||||
*/
|
||||
public function test_check() {
|
||||
public function test_check(): void {
|
||||
$results = $this->get_checker_results($this->htmlfail);
|
||||
$this->assertTrue($results[0]->element->tagName == 'img');
|
||||
|
||||
|
||||
+2
-2
@@ -133,7 +133,7 @@ EOD;
|
||||
/**
|
||||
* Test for the each en string specified in $strings - line 43 in imgAltNotPlaceHolder.
|
||||
*/
|
||||
public function test_failcheck() {
|
||||
public function test_failcheck(): void {
|
||||
$results = $this->get_checker_results($this->htmlfail1);
|
||||
$this->assertTrue($results[0]->element->tagName == 'img');
|
||||
|
||||
@@ -156,7 +156,7 @@ EOD;
|
||||
/**
|
||||
* Test with alt that was not specified in the $strings array.
|
||||
*/
|
||||
public function test_passcheck1() {
|
||||
public function test_passcheck1(): void {
|
||||
$results = $this->get_checker_results($this->htmlpass1);
|
||||
$this->assertEmpty($results);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ EOD;
|
||||
/**
|
||||
* Test for missing image alt text.
|
||||
*/
|
||||
public function test_check_fail() {
|
||||
public function test_check_fail(): void {
|
||||
$results = $this->get_checker_results($this->htmlfail1);
|
||||
$this->assertTrue($results[0]->element->tagName == 'img');
|
||||
|
||||
@@ -87,7 +87,7 @@ EOD;
|
||||
/**
|
||||
* Test for present image alt text.
|
||||
*/
|
||||
public function test_check_pass() {
|
||||
public function test_check_pass(): void {
|
||||
$results = $this->get_checker_results($this->htmlpass);
|
||||
$this->assertTrue(count($results) == 0);
|
||||
}
|
||||
|
||||
+2
-2
@@ -66,7 +66,7 @@ EOD;
|
||||
/**
|
||||
* Test for usemap attribute.
|
||||
*/
|
||||
public function test_check_fail() {
|
||||
public function test_check_fail(): void {
|
||||
$results = $this->get_checker_results($this->htmlfail);
|
||||
$this->assertTrue($results[0]->element->tagName == 'img');
|
||||
}
|
||||
@@ -74,7 +74,7 @@ EOD;
|
||||
/**
|
||||
* Test for ismap attribute.
|
||||
*/
|
||||
public function test_check_pass() {
|
||||
public function test_check_pass(): void {
|
||||
$results = $this->get_checker_results($this->htmlpass);
|
||||
$this->assertEmpty($results);
|
||||
}
|
||||
|
||||
+2
-2
@@ -76,7 +76,7 @@ EOD;
|
||||
/**
|
||||
* Test for if legend is empty or only has white spaces.
|
||||
*/
|
||||
public function test_check_fail() {
|
||||
public function test_check_fail(): void {
|
||||
$results = $this->get_checker_results($this->htmlfail1);
|
||||
$this->assertTrue($results[0]->element->tagName == 'legend');
|
||||
|
||||
@@ -87,7 +87,7 @@ EOD;
|
||||
/**
|
||||
* Test for if legend has text.
|
||||
*/
|
||||
public function test_check_pass() {
|
||||
public function test_check_pass(): void {
|
||||
$results = $this->get_checker_results($this->htmlpass);
|
||||
$this->assertEmpty($results);
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ EOD;
|
||||
/**
|
||||
* Test for if heading exists where doc length is above 1800
|
||||
*/
|
||||
public function test_check_fail() {
|
||||
public function test_check_fail(): void {
|
||||
$results = $this->get_checker_results($this->htmlfail);
|
||||
$this->assertNotEmpty($results);
|
||||
|
||||
@@ -263,7 +263,7 @@ EOD;
|
||||
/**
|
||||
* Test for if marquee does not exist.
|
||||
*/
|
||||
public function test_check_pass() {
|
||||
public function test_check_pass(): void {
|
||||
$results = $this->get_checker_results($this->htmlpass1);
|
||||
$this->assertEmpty($results);
|
||||
|
||||
|
||||
+2
-2
@@ -66,7 +66,7 @@ EOD;
|
||||
/**
|
||||
* Test for missing embed element within object element.
|
||||
*/
|
||||
public function test_check_fail() {
|
||||
public function test_check_fail(): void {
|
||||
$results = $this->get_checker_results($this->htmlfail);
|
||||
$this->assertTrue($results[0]->element->tagName == 'object');
|
||||
}
|
||||
@@ -74,7 +74,7 @@ EOD;
|
||||
/**
|
||||
* Test for present embed element within object element.
|
||||
*/
|
||||
public function test_check_pass() {
|
||||
public function test_check_pass(): void {
|
||||
$results = $this->get_checker_results($this->htmlpass);
|
||||
$this->assertEmpty($results);
|
||||
}
|
||||
|
||||
+2
-2
@@ -63,7 +63,7 @@ EOD;
|
||||
/**
|
||||
* Test for missing title attribute within object element.
|
||||
*/
|
||||
public function test_check_fail() {
|
||||
public function test_check_fail(): void {
|
||||
$results = $this->get_checker_results($this->htmlfail);
|
||||
$this->assertTrue($results[0]->element->tagName == 'object');
|
||||
}
|
||||
@@ -71,7 +71,7 @@ EOD;
|
||||
/**
|
||||
* Test for present title attribute within object element.
|
||||
*/
|
||||
public function test_check_pass() {
|
||||
public function test_check_pass(): void {
|
||||
$results = $this->get_checker_results($this->htmlpass);
|
||||
$this->assertEmpty($results);
|
||||
}
|
||||
|
||||
+2
-2
@@ -129,7 +129,7 @@ EOD;
|
||||
/**
|
||||
* Test that embed element within object element.
|
||||
*/
|
||||
public function test_check_fail() {
|
||||
public function test_check_fail(): void {
|
||||
$results = $this->get_checker_results($this->htmlfail);
|
||||
$this->assertTrue($results[0]->element->tagName == 'object');
|
||||
}
|
||||
@@ -137,7 +137,7 @@ EOD;
|
||||
/**
|
||||
* Test for embed element within object element.
|
||||
*/
|
||||
public function test_check_pass() {
|
||||
public function test_check_pass(): void {
|
||||
$results = $this->get_checker_results($this->htmlpass1);
|
||||
$this->assertEmpty($results);
|
||||
|
||||
|
||||
+1
-1
@@ -77,7 +77,7 @@ EOD;
|
||||
/**
|
||||
* Test for b tags being used
|
||||
*/
|
||||
public function test_check() {
|
||||
public function test_check(): void {
|
||||
$results = $this->get_checker_results($this->htmlfail);
|
||||
$this->assertTrue($results[0]->element->tagName == 'strike');
|
||||
|
||||
|
||||
+2
-2
@@ -117,7 +117,7 @@ EOD;
|
||||
/**
|
||||
* Test that th does not exist
|
||||
*/
|
||||
public function test_check_fail() {
|
||||
public function test_check_fail(): void {
|
||||
$results = $this->get_checker_results($this->htmlfail1);
|
||||
$this->assertTrue($results[0]->element->tagName == 'table');
|
||||
|
||||
@@ -128,7 +128,7 @@ EOD;
|
||||
/**
|
||||
* Test that th does exist
|
||||
*/
|
||||
public function test_check_pass() {
|
||||
public function test_check_pass(): void {
|
||||
$results = $this->get_checker_results($this->htmlpass1);
|
||||
$this->assertEmpty($results);
|
||||
|
||||
|
||||
+2
-2
@@ -67,7 +67,7 @@ EOD;
|
||||
/**
|
||||
* Test that caption and summary are equal
|
||||
*/
|
||||
public function test_check_fail() {
|
||||
public function test_check_fail(): void {
|
||||
$results = $this->get_checker_results($this->htmlfail);
|
||||
$this->assertTrue($results[0]->element->tagName == 'table');
|
||||
}
|
||||
@@ -75,7 +75,7 @@ EOD;
|
||||
/**
|
||||
* Test that caption and summary are not equal
|
||||
*/
|
||||
public function test_check_pass() {
|
||||
public function test_check_pass(): void {
|
||||
$results = $this->get_checker_results($this->htmlpass);
|
||||
$this->assertEmpty($results);
|
||||
}
|
||||
|
||||
+2
-2
@@ -125,7 +125,7 @@ EOD;
|
||||
/**
|
||||
* Test for rowspan and colspan
|
||||
*/
|
||||
public function test_check_fail() {
|
||||
public function test_check_fail(): void {
|
||||
$results = $this->get_checker_results($this->htmlfail1);
|
||||
$this->assertNotEmpty($results);
|
||||
|
||||
@@ -136,7 +136,7 @@ EOD;
|
||||
/**
|
||||
* Test for rowspan and colspan
|
||||
*/
|
||||
public function test_check_pass() {
|
||||
public function test_check_pass(): void {
|
||||
$results = $this->get_checker_results($this->htmlpass);
|
||||
$this->assertEmpty($results);
|
||||
}
|
||||
|
||||
+2
-2
@@ -163,7 +163,7 @@ EOD;
|
||||
/**
|
||||
* Test that th has scope that is equal to col or row
|
||||
*/
|
||||
public function test_check_fail() {
|
||||
public function test_check_fail(): void {
|
||||
$results = $this->get_checker_results($this->htmlfail1);
|
||||
$this->assertEquals(2, count($results));
|
||||
$this->assertTrue($results[0]->element->tagName == 'th');
|
||||
@@ -177,7 +177,7 @@ EOD;
|
||||
/**
|
||||
* Test that th has scope but != col || row. Test that th has no scope
|
||||
*/
|
||||
public function test_check_pass() {
|
||||
public function test_check_pass(): void {
|
||||
$results = $this->get_checker_results($this->htmlpass1);
|
||||
$this->assertEmpty($results);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace tool_brickfield\local\tool;
|
||||
*/
|
||||
class activityresults_test extends \advanced_testcase {
|
||||
|
||||
public function test_toolname() {
|
||||
public function test_toolname(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$object = new activityresults();
|
||||
@@ -34,7 +34,7 @@ class activityresults_test extends \advanced_testcase {
|
||||
$this->assertEquals($output, 'Activity breakdown summary');
|
||||
}
|
||||
|
||||
public function test_toolshortname() {
|
||||
public function test_toolshortname(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$object = new activityresults();
|
||||
@@ -42,7 +42,7 @@ class activityresults_test extends \advanced_testcase {
|
||||
$this->assertEquals($output, 'Activity breakdown');
|
||||
}
|
||||
|
||||
public function test_pluginname() {
|
||||
public function test_pluginname(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$object = new activityresults();
|
||||
@@ -50,7 +50,7 @@ class activityresults_test extends \advanced_testcase {
|
||||
$this->assertEquals($output, 'activityresults');
|
||||
}
|
||||
|
||||
public function test_get_output() {
|
||||
public function test_get_output(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$category = $this->getDataGenerator()->create_category();
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace tool_brickfield\local\tool;
|
||||
*/
|
||||
class checktyperesults_test extends \advanced_testcase {
|
||||
|
||||
public function test_toolname() {
|
||||
public function test_toolname(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$object = new checktyperesults();
|
||||
@@ -34,7 +34,7 @@ class checktyperesults_test extends \advanced_testcase {
|
||||
$this->assertEquals($output, 'Content types summary');
|
||||
}
|
||||
|
||||
public function test_toolshortname() {
|
||||
public function test_toolshortname(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$object = new checktyperesults();
|
||||
@@ -42,7 +42,7 @@ class checktyperesults_test extends \advanced_testcase {
|
||||
$this->assertEquals($output, 'Content types');
|
||||
}
|
||||
|
||||
public function test_pluginname() {
|
||||
public function test_pluginname(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$object = new checktyperesults();
|
||||
@@ -50,7 +50,7 @@ class checktyperesults_test extends \advanced_testcase {
|
||||
$this->assertEquals($output, 'checktyperesults');
|
||||
}
|
||||
|
||||
public function test_get_output() {
|
||||
public function test_get_output(): void {
|
||||
$this->resetAfterTest();
|
||||
$category = $this->getDataGenerator()->create_category();
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace tool_brickfield\local\tool;
|
||||
*/
|
||||
class errors_test extends \advanced_testcase {
|
||||
|
||||
public function test_toolname() {
|
||||
public function test_toolname(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$object = new errors();
|
||||
@@ -34,7 +34,7 @@ class errors_test extends \advanced_testcase {
|
||||
$this->assertEquals($output, 'Error list summary');
|
||||
}
|
||||
|
||||
public function test_toolshortname() {
|
||||
public function test_toolshortname(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$object = new errors();
|
||||
@@ -42,7 +42,7 @@ class errors_test extends \advanced_testcase {
|
||||
$this->assertEquals($output, 'Error list');
|
||||
}
|
||||
|
||||
public function test_pluginname() {
|
||||
public function test_pluginname(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$object = new errors();
|
||||
@@ -50,7 +50,7 @@ class errors_test extends \advanced_testcase {
|
||||
$this->assertEquals($output, 'errors');
|
||||
}
|
||||
|
||||
public function test_get_output() {
|
||||
public function test_get_output(): void {
|
||||
$this->resetAfterTest();
|
||||
$category = $this->getDataGenerator()->create_category();
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ class printable_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test tool name.
|
||||
*/
|
||||
public function test_toolname() {
|
||||
public function test_toolname(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$object = new printable();
|
||||
@@ -40,7 +40,7 @@ class printable_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test tool short name.
|
||||
*/
|
||||
public function test_toolshortname() {
|
||||
public function test_toolshortname(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$object = new printable();
|
||||
@@ -51,7 +51,7 @@ class printable_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test plugin name.
|
||||
*/
|
||||
public function test_pluginname() {
|
||||
public function test_pluginname(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$object = new printable();
|
||||
@@ -77,7 +77,7 @@ class printable_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test get output.
|
||||
*/
|
||||
public function test_get_output() {
|
||||
public function test_get_output(): void {
|
||||
$this->resetAfterTest();
|
||||
$category = $this->getDataGenerator()->create_category();
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ class manager_test extends \advanced_testcase {
|
||||
/**
|
||||
* Tests for the function manager::get_all_areas()
|
||||
*/
|
||||
public function test_get_areas() {
|
||||
public function test_get_areas(): void {
|
||||
$this->resetAfterTest();
|
||||
$areas = manager::get_all_areas();
|
||||
$areaclassnames = array_map('get_class', $areas);
|
||||
|
||||
@@ -40,7 +40,7 @@ class registration_test extends \advanced_testcase {
|
||||
* Tests the state of the registration system when first installed.
|
||||
* @throws \dml_exception
|
||||
*/
|
||||
public function test_initial_state() {
|
||||
public function test_initial_state(): void {
|
||||
$this->resetAfterTest();
|
||||
$regobj = new mock_registration();
|
||||
|
||||
@@ -56,7 +56,7 @@ class registration_test extends \advanced_testcase {
|
||||
* Test the various states for setting registration keys.
|
||||
* @throws \dml_exception
|
||||
*/
|
||||
public function test_set_keys_for_registration() {
|
||||
public function test_set_keys_for_registration(): void {
|
||||
$this->resetAfterTest();
|
||||
$regobj = new mock_registration();
|
||||
|
||||
@@ -79,7 +79,7 @@ class registration_test extends \advanced_testcase {
|
||||
* Test the validation system through its several states.
|
||||
* @throws \dml_exception
|
||||
*/
|
||||
public function test_validation() {
|
||||
public function test_validation(): void {
|
||||
$this->resetAfterTest();
|
||||
$regobj = new mock_registration();
|
||||
|
||||
@@ -112,7 +112,7 @@ class registration_test extends \advanced_testcase {
|
||||
* Tests the system after validation grace periods expire.
|
||||
* @throws \dml_exception
|
||||
*/
|
||||
public function test_validation_time_expiry() {
|
||||
public function test_validation_time_expiry(): void {
|
||||
$this->resetAfterTest();
|
||||
$regobj = new mock_registration();
|
||||
|
||||
@@ -149,7 +149,7 @@ class registration_test extends \advanced_testcase {
|
||||
* Tests the system after summary data time periods expire.
|
||||
* @throws \dml_exception
|
||||
*/
|
||||
public function test_summary_time_expiry() {
|
||||
public function test_summary_time_expiry(): void {
|
||||
$this->resetAfterTest();
|
||||
$regobj = new mock_registration();
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace tool_brickfield;
|
||||
*/
|
||||
class scheduler_test extends \advanced_testcase {
|
||||
|
||||
public function test_request_analysis() {
|
||||
public function test_request_analysis(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// I believe there is a bug where the code won't work with the default constructor values.
|
||||
@@ -48,7 +48,7 @@ class scheduler_test extends \advanced_testcase {
|
||||
|
||||
}
|
||||
|
||||
public function test_mark_analyzed() {
|
||||
public function test_mark_analyzed(): void {
|
||||
$this->resetAfterTest();
|
||||
$object = new scheduler();
|
||||
$output = $object->mark_analyzed();
|
||||
@@ -59,7 +59,7 @@ class scheduler_test extends \advanced_testcase {
|
||||
$this->assertTrue($output);
|
||||
}
|
||||
|
||||
public function test_create_schedule() {
|
||||
public function test_create_schedule(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -76,7 +76,7 @@ class scheduler_test extends \advanced_testcase {
|
||||
$this->assertEquals($record->instanceid, 1);
|
||||
}
|
||||
|
||||
public function test_delete_schedule() {
|
||||
public function test_delete_schedule(): void {
|
||||
global $DB;
|
||||
|
||||
// Call create_record() to insert a record into the table.
|
||||
@@ -95,7 +95,7 @@ class scheduler_test extends \advanced_testcase {
|
||||
$this->assertFalse($record);
|
||||
}
|
||||
|
||||
public function test_is_in_schedule() {
|
||||
public function test_is_in_schedule(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// This should assert to false as no record has been inserted.
|
||||
@@ -109,7 +109,7 @@ class scheduler_test extends \advanced_testcase {
|
||||
$this->assertTrue($output);
|
||||
}
|
||||
|
||||
public function test_is_scheduled() {
|
||||
public function test_is_scheduled(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// This should assert to false as no record has been inserted.
|
||||
@@ -129,7 +129,7 @@ class scheduler_test extends \advanced_testcase {
|
||||
$this->assertTrue($output);
|
||||
}
|
||||
|
||||
public function test_is_submitted() {
|
||||
public function test_is_submitted(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// This should assert to false as no record has been inserted.
|
||||
@@ -149,7 +149,7 @@ class scheduler_test extends \advanced_testcase {
|
||||
$this->assertTrue($output);
|
||||
}
|
||||
|
||||
public function test_is_analyzed() {
|
||||
public function test_is_analyzed(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// This should assert to false as no record has been inserted.
|
||||
@@ -170,14 +170,14 @@ class scheduler_test extends \advanced_testcase {
|
||||
}
|
||||
|
||||
// Can't test because it's a protected function.
|
||||
public function test_standard_search_params() {
|
||||
public function test_standard_search_params(): void {
|
||||
}
|
||||
|
||||
// Can't test because it's a protected function.
|
||||
public function test_get_contextid() {
|
||||
public function test_get_contextid(): void {
|
||||
}
|
||||
|
||||
public function test_get_datarecord() {
|
||||
public function test_get_datarecord(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$object = new scheduler();
|
||||
@@ -200,11 +200,11 @@ class scheduler_test extends \advanced_testcase {
|
||||
}
|
||||
|
||||
// No return statement.
|
||||
public function test_process_scheduled_requests() {
|
||||
public function test_process_scheduled_requests(): void {
|
||||
|
||||
}
|
||||
|
||||
public function test_initialize_schedule() {
|
||||
public function test_initialize_schedule(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
|
||||
@@ -219,14 +219,14 @@ class scheduler_test extends \advanced_testcase {
|
||||
$this->assertEquals($record->contextlevel, 20);
|
||||
}
|
||||
|
||||
public function test_request_course_analysis() {
|
||||
public function test_request_course_analysis(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$output = scheduler::request_course_analysis(1);
|
||||
$this->assertTrue($output);
|
||||
}
|
||||
|
||||
public function test_create_course_schedule() {
|
||||
public function test_create_course_schedule(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
|
||||
@@ -237,7 +237,7 @@ class scheduler_test extends \advanced_testcase {
|
||||
|
||||
}
|
||||
|
||||
public function test_delete_course_schedule() {
|
||||
public function test_delete_course_schedule(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
|
||||
@@ -251,7 +251,7 @@ class scheduler_test extends \advanced_testcase {
|
||||
$this->assertFalse($record);
|
||||
}
|
||||
|
||||
public function test_is_course_in_schedule() {
|
||||
public function test_is_course_in_schedule(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// This should assert to false as no record has been inserted.
|
||||
@@ -264,7 +264,7 @@ class scheduler_test extends \advanced_testcase {
|
||||
$this->assertTrue($output);
|
||||
}
|
||||
|
||||
public function test_is_course_scheduled() {
|
||||
public function test_is_course_scheduled(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// This should assert to false as no record has been inserted.
|
||||
@@ -283,7 +283,7 @@ class scheduler_test extends \advanced_testcase {
|
||||
$this->assertTrue($output);
|
||||
}
|
||||
|
||||
public function test_is_course_analyzed() {
|
||||
public function test_is_course_analyzed(): void {
|
||||
$this->resetAfterTest();
|
||||
$object = new scheduler(10, 1);
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ w==" alt="This is a bus." />';
|
||||
EOF;
|
||||
|
||||
|
||||
public function test_build_all_accessibilitytools() {
|
||||
public function test_build_all_accessibilitytools(): void {
|
||||
$tools = tool::build_all_accessibilitytools();
|
||||
|
||||
$this->assertEquals($tools['errors']::toolshortname(), 'Error list');
|
||||
@@ -68,14 +68,14 @@ EOF;
|
||||
$this->assertEquals($tools['advanced']::toolshortname(), 'Advanced');
|
||||
}
|
||||
|
||||
public function test_data_is_valid() {
|
||||
public function test_data_is_valid(): void {
|
||||
$object = $this->getMockForAbstractClass(tool::class);
|
||||
$object->set_filter(new filter());
|
||||
$output = $object->data_is_valid();
|
||||
$this->assertFalse($output);
|
||||
}
|
||||
|
||||
public function test_can_access() {
|
||||
public function test_can_access(): void {
|
||||
$this->resetAfterTest();
|
||||
$category = $this->getDataGenerator()->create_category();
|
||||
$filter = new filter(1, $category->id, 'tab', 3, 4);
|
||||
@@ -86,14 +86,14 @@ EOF;
|
||||
$this->assertFalse($output);
|
||||
}
|
||||
|
||||
public function test_get_error_message() {
|
||||
public function test_get_error_message(): void {
|
||||
$tool = $this->getMockForAbstractClass(tool::class);
|
||||
|
||||
$output = $tool->get_error_message();
|
||||
$this->assertEquals($output, '');
|
||||
}
|
||||
|
||||
public function test_get_module_label() {
|
||||
public function test_get_module_label(): void {
|
||||
$output = tool::get_module_label('core_course');
|
||||
$this->assertEquals($output, 'Course');
|
||||
|
||||
@@ -101,7 +101,7 @@ EOF;
|
||||
$this->assertEquals($output, 'Book');
|
||||
}
|
||||
|
||||
public function test_toplevel_arguments() {
|
||||
public function test_toplevel_arguments(): void {
|
||||
$this->resetAfterTest();
|
||||
$category = $this->getDataGenerator()->create_category();
|
||||
$filter = new filter(1, $category->id, 'tab', 3, 4);
|
||||
@@ -154,14 +154,14 @@ EOF;
|
||||
* @param string $content
|
||||
* @param bool $expectation
|
||||
*/
|
||||
public function test_base64_img_detected(string $content, bool $expectation) {
|
||||
public function test_base64_img_detected(string $content, bool $expectation): void {
|
||||
$this->assertEquals(
|
||||
$expectation,
|
||||
tool::base64_img_detected($content)
|
||||
);
|
||||
}
|
||||
|
||||
public function test_truncate_base64() {
|
||||
public function test_truncate_base64(): void {
|
||||
$truncated = tool::truncate_base64($this->base64img);
|
||||
$this->assertStringContainsString('<img src="data:image/gif;base64..."', $truncated);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ class events_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the report viewed event.
|
||||
*/
|
||||
public function test_report_viewed() {
|
||||
public function test_report_viewed(): void {
|
||||
$event = \tool_capability\event\report_viewed::create();
|
||||
|
||||
// Trigger and capture the event.
|
||||
|
||||
@@ -36,7 +36,7 @@ class locallib_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the function that gets the data - simple case.
|
||||
*/
|
||||
public function test_tool_capability_calculate_role_data() {
|
||||
public function test_tool_capability_calculate_role_data(): void {
|
||||
global $DB;
|
||||
|
||||
$data = tool_capability_calculate_role_data('mod/quiz:attempt', get_all_roles());
|
||||
@@ -58,7 +58,7 @@ class locallib_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the function that gets the data - simple case.
|
||||
*/
|
||||
public function test_tool_capability_calculate_role_data_orphan_contexts() {
|
||||
public function test_tool_capability_calculate_role_data_orphan_contexts(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
|
||||
|
||||
@@ -48,5 +48,8 @@ function xmldb_tool_cohortroles_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ class api_test extends \advanced_testcase {
|
||||
cohort_add_member($this->cohort->id, $this->userassignover->id);
|
||||
}
|
||||
|
||||
public function test_create_cohort_role_assignment_without_permission() {
|
||||
public function test_create_cohort_role_assignment_without_permission(): void {
|
||||
$this->setUser($this->userassignto);
|
||||
$params = (object) array(
|
||||
'userid' => $this->userassignto->id,
|
||||
@@ -64,7 +64,7 @@ class api_test extends \advanced_testcase {
|
||||
api::create_cohort_role_assignment($params);
|
||||
}
|
||||
|
||||
public function test_create_cohort_role_assignment_with_invalid_data() {
|
||||
public function test_create_cohort_role_assignment_with_invalid_data(): void {
|
||||
$this->setAdminUser();
|
||||
$params = (object) array(
|
||||
'userid' => $this->userassignto->id,
|
||||
@@ -75,7 +75,7 @@ class api_test extends \advanced_testcase {
|
||||
api::create_cohort_role_assignment($params);
|
||||
}
|
||||
|
||||
public function test_create_cohort_role_assignment() {
|
||||
public function test_create_cohort_role_assignment(): void {
|
||||
$this->setAdminUser();
|
||||
$params = (object) array(
|
||||
'userid' => $this->userassignto->id,
|
||||
@@ -89,7 +89,7 @@ class api_test extends \advanced_testcase {
|
||||
$this->assertEquals($result->get('cohortid'), $this->cohort->id);
|
||||
}
|
||||
|
||||
public function test_delete_cohort_role_assignment_without_permission() {
|
||||
public function test_delete_cohort_role_assignment_without_permission(): void {
|
||||
$this->setAdminUser();
|
||||
$params = (object) array(
|
||||
'userid' => $this->userassignto->id,
|
||||
@@ -102,7 +102,7 @@ class api_test extends \advanced_testcase {
|
||||
api::delete_cohort_role_assignment($result->get('id'));
|
||||
}
|
||||
|
||||
public function test_delete_cohort_role_assignment_with_invalid_data() {
|
||||
public function test_delete_cohort_role_assignment_with_invalid_data(): void {
|
||||
$this->setAdminUser();
|
||||
$params = (object) array(
|
||||
'userid' => $this->userassignto->id,
|
||||
@@ -114,7 +114,7 @@ class api_test extends \advanced_testcase {
|
||||
api::delete_cohort_role_assignment($result->get('id') + 1);
|
||||
}
|
||||
|
||||
public function test_delete_cohort_role_assignment() {
|
||||
public function test_delete_cohort_role_assignment(): void {
|
||||
$this->setAdminUser();
|
||||
// Create a cohort role assigment.
|
||||
$params = (object) [
|
||||
@@ -151,7 +151,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test case verifying that syncing won't remove role assignments if they are valid for another cohort role assignment.
|
||||
*/
|
||||
public function test_delete_cohort_role_assignment_cohorts_having_same_members() {
|
||||
public function test_delete_cohort_role_assignment_cohorts_having_same_members(): void {
|
||||
$this->setAdminUser();
|
||||
|
||||
// Create 2 cohorts, with a 1 user (user1) present in both,
|
||||
@@ -203,7 +203,7 @@ class api_test extends \advanced_testcase {
|
||||
$this->assertContains($user2->id, $removedusers);
|
||||
}
|
||||
|
||||
public function test_list_cohort_role_assignments() {
|
||||
public function test_list_cohort_role_assignments(): void {
|
||||
$this->setAdminUser();
|
||||
$params = (object) array(
|
||||
'userid' => $this->userassignto->id,
|
||||
@@ -217,7 +217,7 @@ class api_test extends \advanced_testcase {
|
||||
$this->assertEquals($list[0], $result);
|
||||
}
|
||||
|
||||
public function test_count_cohort_role_assignments() {
|
||||
public function test_count_cohort_role_assignments(): void {
|
||||
$this->setAdminUser();
|
||||
$params = (object) array(
|
||||
'userid' => $this->userassignto->id,
|
||||
@@ -230,7 +230,7 @@ class api_test extends \advanced_testcase {
|
||||
$this->assertEquals($count, 1);
|
||||
}
|
||||
|
||||
public function test_sync_all_cohort_roles() {
|
||||
public function test_sync_all_cohort_roles(): void {
|
||||
$this->setAdminUser();
|
||||
$params = (object) array(
|
||||
'userid' => $this->userassignto->id,
|
||||
|
||||
@@ -51,7 +51,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
|
||||
/**
|
||||
* Test for provider::get_contexts_for_userid().
|
||||
*/
|
||||
public function test_get_contexts_for_userid() {
|
||||
public function test_get_contexts_for_userid(): void {
|
||||
global $DB;
|
||||
|
||||
// Test setup.
|
||||
@@ -94,7 +94,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
|
||||
/**
|
||||
* Test for provider::export_user_data().
|
||||
*/
|
||||
public function test_export_user_data() {
|
||||
public function test_export_user_data(): void {
|
||||
// Test setup.
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
$this->setUser($user);
|
||||
@@ -144,7 +144,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
|
||||
/**
|
||||
* Test for provider::delete_data_for_all_users_in_context().
|
||||
*/
|
||||
public function test_delete_data_for_all_users_in_context() {
|
||||
public function test_delete_data_for_all_users_in_context(): void {
|
||||
global $DB;
|
||||
|
||||
// Test setup.
|
||||
@@ -203,7 +203,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
|
||||
/**
|
||||
* Test for provider::delete_data_for_user().
|
||||
*/
|
||||
public function test_delete_data_for_user() {
|
||||
public function test_delete_data_for_user(): void {
|
||||
global $DB;
|
||||
|
||||
// Test setup.
|
||||
@@ -251,7 +251,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
|
||||
/**
|
||||
* Test that only users within a course context are fetched.
|
||||
*/
|
||||
public function test_get_users_in_context() {
|
||||
public function test_get_users_in_context(): void {
|
||||
$component = 'tool_cohortroles';
|
||||
|
||||
// Create a user.
|
||||
@@ -293,7 +293,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
|
||||
/**
|
||||
* Test that data for users in approved userlist is deleted.
|
||||
*/
|
||||
public function test_delete_data_for_users() {
|
||||
public function test_delete_data_for_users(): void {
|
||||
$component = 'tool_cohortroles';
|
||||
|
||||
// Create user1.
|
||||
|
||||
@@ -33,5 +33,8 @@ function xmldb_tool_customlang_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -156,9 +156,9 @@ class data_request extends persistent {
|
||||
case api::DATAREQUEST_STATUS_EXPIRED:
|
||||
$result = true;
|
||||
break;
|
||||
// Complete requests are expired if the expiry time has elapsed.
|
||||
// Complete requests are expired if the expiry time is a positive value, and has elapsed.
|
||||
case api::DATAREQUEST_STATUS_DOWNLOAD_READY:
|
||||
$expiryseconds = get_config('tool_dataprivacy', 'privacyrequestexpiry');
|
||||
$expiryseconds = (int) get_config('tool_dataprivacy', 'privacyrequestexpiry');
|
||||
if ($expiryseconds > 0 && time() >= ($request->get('timemodified') + $expiryseconds)) {
|
||||
$result = true;
|
||||
}
|
||||
@@ -179,7 +179,12 @@ class data_request extends persistent {
|
||||
public static function get_expired_requests($userid = 0) {
|
||||
global $DB;
|
||||
|
||||
$expiryseconds = get_config('tool_dataprivacy', 'privacyrequestexpiry');
|
||||
// Complete requests are expired if the expiry time is a positive value, and has elapsed.
|
||||
$expiryseconds = (int) get_config('tool_dataprivacy', 'privacyrequestexpiry');
|
||||
if ($expiryseconds <= 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$expirytime = strtotime("-{$expiryseconds} second");
|
||||
$table = self::TABLE;
|
||||
$sqlwhere = 'type = :export_type AND status = :completestatus AND timemodified <= :expirytime';
|
||||
|
||||
@@ -45,6 +45,7 @@ class hook_callbacks {
|
||||
$hook->add_html(
|
||||
html_writer::div(
|
||||
html_writer::link($url, get_string('dataretentionsummary', 'tool_dataprivacy')),
|
||||
'tool_dataprivacy',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -103,5 +103,8 @@ function xmldb_tool_dataprivacy_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class api_test extends \advanced_testcase {
|
||||
* Ensure that the check_can_manage_data_registry function fails cap testing when a user without capabilities is
|
||||
* tested with the default context.
|
||||
*/
|
||||
public function test_check_can_manage_data_registry_admin() {
|
||||
public function test_check_can_manage_data_registry_admin(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setAdminUser();
|
||||
@@ -49,7 +49,7 @@ class api_test extends \advanced_testcase {
|
||||
* Ensure that the check_can_manage_data_registry function fails cap testing when a user without capabilities is
|
||||
* tested with the default context.
|
||||
*/
|
||||
public function test_check_can_manage_data_registry_without_cap_default() {
|
||||
public function test_check_can_manage_data_registry_without_cap_default(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
@@ -63,7 +63,7 @@ class api_test extends \advanced_testcase {
|
||||
* Ensure that the check_can_manage_data_registry function fails cap testing when a user without capabilities is
|
||||
* tested with the default context.
|
||||
*/
|
||||
public function test_check_can_manage_data_registry_without_cap_system() {
|
||||
public function test_check_can_manage_data_registry_without_cap_system(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
@@ -77,7 +77,7 @@ class api_test extends \advanced_testcase {
|
||||
* Ensure that the check_can_manage_data_registry function fails cap testing when a user without capabilities is
|
||||
* tested with the default context.
|
||||
*/
|
||||
public function test_check_can_manage_data_registry_without_cap_own_user() {
|
||||
public function test_check_can_manage_data_registry_without_cap_own_user(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
@@ -90,7 +90,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test for api::update_request_status().
|
||||
*/
|
||||
public function test_update_request_status() {
|
||||
public function test_update_request_status(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
@@ -138,7 +138,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test for api::get_site_dpos() when there are no users with the DPO role.
|
||||
*/
|
||||
public function test_get_site_dpos_no_dpos() {
|
||||
public function test_get_site_dpos_no_dpos(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$admin = get_admin();
|
||||
@@ -152,7 +152,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test for api::get_site_dpos() when there are no users with the DPO role.
|
||||
*/
|
||||
public function test_get_site_dpos() {
|
||||
public function test_get_site_dpos(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -189,7 +189,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test for \tool_dataprivacy\api::get_assigned_privacy_officer_roles().
|
||||
*/
|
||||
public function test_get_assigned_privacy_officer_roles() {
|
||||
public function test_get_assigned_privacy_officer_roles(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -232,7 +232,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test for api::approve_data_request().
|
||||
*/
|
||||
public function test_approve_data_request() {
|
||||
public function test_approve_data_request(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -276,7 +276,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test for api::approve_data_request() when allow filtering of exports by course.
|
||||
*/
|
||||
public function test_approve_data_request_with_allow_filtering() {
|
||||
public function test_approve_data_request_with_allow_filtering(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
set_config('allowfiltering', 1, 'tool_dataprivacy');
|
||||
@@ -325,7 +325,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test for api::approve_data_request() when called by a user who doesn't have the DPO role.
|
||||
*/
|
||||
public function test_approve_data_request_non_dpo_user() {
|
||||
public function test_approve_data_request_non_dpo_user(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
@@ -347,7 +347,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test for api::add_request_contexts_with_status().
|
||||
*/
|
||||
public function test_add_request_contexts_with_status() {
|
||||
public function test_add_request_contexts_with_status(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
set_config('allowfiltering', 1, 'tool_dataprivacy');
|
||||
@@ -385,7 +385,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test that deletion requests for the primary admin are rejected
|
||||
*/
|
||||
public function test_reject_data_deletion_request_primary_admin() {
|
||||
public function test_reject_data_deletion_request_primary_admin(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
@@ -408,7 +408,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test for api::can_contact_dpo()
|
||||
*/
|
||||
public function test_can_contact_dpo() {
|
||||
public function test_can_contact_dpo(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Default ('contactdataprotectionofficer' is disabled by default).
|
||||
@@ -426,7 +426,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test for api::can_manage_data_requests()
|
||||
*/
|
||||
public function test_can_manage_data_requests() {
|
||||
public function test_can_manage_data_requests(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -471,7 +471,7 @@ class api_test extends \advanced_testcase {
|
||||
* Test that a user who has no capability to make any data requests for children cannot create data requests for any
|
||||
* other user.
|
||||
*/
|
||||
public function test_can_create_data_request_for_user_no() {
|
||||
public function test_can_create_data_request_for_user_no(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$parent = $this->getDataGenerator()->create_user();
|
||||
@@ -485,7 +485,7 @@ class api_test extends \advanced_testcase {
|
||||
* Test that a user who has the capability to make any data requests for one other user cannot create data requests
|
||||
* for any other user.
|
||||
*/
|
||||
public function test_can_create_data_request_for_user_some() {
|
||||
public function test_can_create_data_request_for_user_some(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$parent = $this->getDataGenerator()->create_user();
|
||||
@@ -505,7 +505,7 @@ class api_test extends \advanced_testcase {
|
||||
* Test that a user who has the capability to make any data requests for one other user cannot create data requests
|
||||
* for any other user.
|
||||
*/
|
||||
public function test_can_create_data_request_for_user_own_child() {
|
||||
public function test_can_create_data_request_for_user_own_child(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$parent = $this->getDataGenerator()->create_user();
|
||||
@@ -524,7 +524,7 @@ class api_test extends \advanced_testcase {
|
||||
* Test that a user who has no capability to make any data requests for children cannot create data requests for any
|
||||
* other user.
|
||||
*/
|
||||
public function test_require_can_create_data_request_for_user_no() {
|
||||
public function test_require_can_create_data_request_for_user_no(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$parent = $this->getDataGenerator()->create_user();
|
||||
@@ -539,7 +539,7 @@ class api_test extends \advanced_testcase {
|
||||
* Test that a user who has the capability to make any data requests for one other user cannot create data requests
|
||||
* for any other user.
|
||||
*/
|
||||
public function test_require_can_create_data_request_for_user_some() {
|
||||
public function test_require_can_create_data_request_for_user_some(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$parent = $this->getDataGenerator()->create_user();
|
||||
@@ -560,7 +560,7 @@ class api_test extends \advanced_testcase {
|
||||
* Test that a user who has the capability to make any data requests for one other user cannot create data requests
|
||||
* for any other user.
|
||||
*/
|
||||
public function test_require_can_create_data_request_for_user_own_child() {
|
||||
public function test_require_can_create_data_request_for_user_own_child(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$parent = $this->getDataGenerator()->create_user();
|
||||
@@ -578,7 +578,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test for api::can_download_data_request_for_user()
|
||||
*/
|
||||
public function test_can_download_data_request_for_user() {
|
||||
public function test_can_download_data_request_for_user(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
@@ -700,7 +700,7 @@ class api_test extends \advanced_testcase {
|
||||
$expectedstatus,
|
||||
$expectedtaskcount,
|
||||
$allowfiltering,
|
||||
) {
|
||||
): void {
|
||||
global $USER;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -751,7 +751,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test for api::create_data_request() made by a parent.
|
||||
*/
|
||||
public function test_create_data_request_by_parent() {
|
||||
public function test_create_data_request_by_parent(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -786,7 +786,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test for api::deny_data_request()
|
||||
*/
|
||||
public function test_deny_data_request() {
|
||||
public function test_deny_data_request(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
@@ -841,7 +841,7 @@ class api_test extends \advanced_testcase {
|
||||
* @param boolean $fetchall Whether to fetch all records.
|
||||
* @param int[] $statuses Status filters.
|
||||
*/
|
||||
public function test_get_data_requests($usertype, $fetchall, $statuses) {
|
||||
public function test_get_data_requests($usertype, $fetchall, $statuses): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
@@ -952,7 +952,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test for api::get_approved_contextlist_collection_for_request.
|
||||
*/
|
||||
public function test_get_approved_contextlist_collection_for_request() {
|
||||
public function test_get_approved_contextlist_collection_for_request(): void {
|
||||
$this->resetAfterTest();
|
||||
set_config('allowfiltering', 1, 'tool_dataprivacy');
|
||||
$this->setAdminUser();
|
||||
@@ -1021,7 +1021,7 @@ class api_test extends \advanced_testcase {
|
||||
* @param int $status The request status.
|
||||
* @param bool $expected The expected result.
|
||||
*/
|
||||
public function test_has_ongoing_request($status, $expected) {
|
||||
public function test_has_ongoing_request($status, $expected): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
@@ -1045,7 +1045,7 @@ class api_test extends \advanced_testcase {
|
||||
* @param int $status The request status
|
||||
* @param bool $expected The expected result
|
||||
*/
|
||||
public function test_is_active($status, $expected) {
|
||||
public function test_is_active($status, $expected): void {
|
||||
// Check if this request is ongoing.
|
||||
$result = api::is_active($status);
|
||||
$this->assertEquals($expected, $result);
|
||||
@@ -1054,7 +1054,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test for api::is_site_dpo()
|
||||
*/
|
||||
public function test_is_site_dpo() {
|
||||
public function test_is_site_dpo(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -1108,7 +1108,7 @@ class api_test extends \advanced_testcase {
|
||||
* @param string $typestringid The request lang string identifier
|
||||
* @param string $comments The requestor's message to the DPO.
|
||||
*/
|
||||
public function test_notify_dpo($byadmin, $type, $typestringid, $comments) {
|
||||
public function test_notify_dpo($byadmin, $type, $typestringid, $comments): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
@@ -1150,7 +1150,7 @@ class api_test extends \advanced_testcase {
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function test_purpose_crud() {
|
||||
public function test_purpose_crud(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setAdminUser();
|
||||
@@ -1192,7 +1192,7 @@ class api_test extends \advanced_testcase {
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function test_category_crud() {
|
||||
public function test_category_crud(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setAdminUser();
|
||||
@@ -1230,7 +1230,7 @@ class api_test extends \advanced_testcase {
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function test_context_instances() {
|
||||
public function test_context_instances(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -1266,7 +1266,7 @@ class api_test extends \advanced_testcase {
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function test_contextlevel() {
|
||||
public function test_contextlevel(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -1302,7 +1302,7 @@ class api_test extends \advanced_testcase {
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function test_effective_contextlevel_defaults() {
|
||||
public function test_effective_contextlevel_defaults(): void {
|
||||
$this->setAdminUser();
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -1340,7 +1340,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that when nothing is configured, all values return false.
|
||||
*/
|
||||
public function test_get_effective_contextlevel_unset() {
|
||||
public function test_get_effective_contextlevel_unset(): void {
|
||||
// Before setup, get_effective_contextlevel_purpose will return false.
|
||||
$this->assertFalse(api::get_effective_contextlevel_category(CONTEXT_SYSTEM));
|
||||
$this->assertFalse(api::get_effective_contextlevel_purpose(CONTEXT_SYSTEM));
|
||||
@@ -1352,7 +1352,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that when nothing is configured, all values return false.
|
||||
*/
|
||||
public function test_get_effective_context_unset() {
|
||||
public function test_get_effective_context_unset(): void {
|
||||
// Before setup, get_effective_contextlevel_purpose will return false.
|
||||
$this->assertFalse(api::get_effective_context_category(\context_system::instance()));
|
||||
$this->assertFalse(api::get_effective_context_purpose(\context_system::instance()));
|
||||
@@ -1364,7 +1364,7 @@ class api_test extends \advanced_testcase {
|
||||
* @dataProvider invalid_effective_contextlevel_provider
|
||||
* @param int $contextlevel
|
||||
*/
|
||||
public function test_set_contextlevel_invalid_contextlevels($contextlevel) {
|
||||
public function test_set_contextlevel_invalid_contextlevels($contextlevel): void {
|
||||
|
||||
$this->expectException(\coding_exception::class);
|
||||
api::set_contextlevel((object) [
|
||||
@@ -1376,7 +1376,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test effective contextlevel return.
|
||||
*/
|
||||
public function test_effective_contextlevel() {
|
||||
public function test_effective_contextlevel(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Set the initial purpose and category.
|
||||
@@ -1424,7 +1424,7 @@ class api_test extends \advanced_testcase {
|
||||
* @dataProvider invalid_effective_contextlevel_provider
|
||||
* @param int $contextlevel
|
||||
*/
|
||||
public function test_effective_contextlevel_invalid_contextlevels($contextlevel) {
|
||||
public function test_effective_contextlevel_invalid_contextlevels($contextlevel): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$purpose1 = api::create_purpose((object)['name' => 'p1', 'retentionperiod' => 'PT1H', 'lawfulbases' => 'gdpr_art_6_1_a']);
|
||||
@@ -1454,7 +1454,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that context inheritance works up the context tree.
|
||||
*/
|
||||
public function test_effective_context_inheritance() {
|
||||
public function test_effective_context_inheritance(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$systemdata = $this->create_and_set_purpose_for_contextlevel('PT1S', CONTEXT_SYSTEM);
|
||||
@@ -1734,7 +1734,7 @@ class api_test extends \advanced_testcase {
|
||||
* Although it should not be possible to set hard INHERIT values at this level, there may be legacy data which still
|
||||
* contains this.
|
||||
*/
|
||||
public function test_effective_context_inheritance_explicitly_set() {
|
||||
public function test_effective_context_inheritance_explicitly_set(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$systemdata = $this->create_and_set_purpose_for_contextlevel('PT1S', CONTEXT_SYSTEM);
|
||||
@@ -1861,7 +1861,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test that delete requests do not filter out protected purpose contexts if the the site is properly configured.
|
||||
*/
|
||||
public function test_get_approved_contextlist_collection_for_collection_delete_course_no_site_config() {
|
||||
public function test_get_approved_contextlist_collection_for_collection_delete_course_no_site_config(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
@@ -1903,7 +1903,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test that delete requests do not filter out protected purpose contexts if they are already expired.
|
||||
*/
|
||||
public function test_get_approved_contextlist_collection_for_collection_delete_course_expired_protected() {
|
||||
public function test_get_approved_contextlist_collection_for_collection_delete_course_expired_protected(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$purposes = $this->setup_basics('PT1H', 'PT1H', 'PT1H');
|
||||
@@ -1936,7 +1936,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test that delete requests does filter out protected purpose contexts which are not expired.
|
||||
*/
|
||||
public function test_get_approved_contextlist_collection_for_collection_delete_course_unexpired_protected() {
|
||||
public function test_get_approved_contextlist_collection_for_collection_delete_course_unexpired_protected(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$purposes = $this->setup_basics('PT1H', 'PT1H', 'P1Y');
|
||||
@@ -1969,7 +1969,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test that delete requests do not filter out unexpired contexts if they are not protected.
|
||||
*/
|
||||
public function test_get_approved_contextlist_collection_for_collection_delete_course_unexpired_unprotected() {
|
||||
public function test_get_approved_contextlist_collection_for_collection_delete_course_unexpired_unprotected(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$purposes = $this->setup_basics('PT1H', 'PT1H', 'P1Y');
|
||||
@@ -2040,7 +2040,7 @@ class api_test extends \advanced_testcase {
|
||||
* @param bool $foractivity Whether to set defaults for an activity.
|
||||
* @param bool $override Whether to override instances.
|
||||
*/
|
||||
public function test_set_context_defaults($contextlevel, $inheritcategory, $inheritpurpose, $foractivity, $override) {
|
||||
public function test_set_context_defaults($contextlevel, $inheritcategory, $inheritpurpose, $foractivity, $override): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
@@ -2224,7 +2224,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that the find_ongoing_request_types_for_users only returns requests which are active.
|
||||
*/
|
||||
public function test_find_ongoing_request_types_for_users() {
|
||||
public function test_find_ongoing_request_types_for_users(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Create users and their requests:.
|
||||
@@ -2360,7 +2360,7 @@ class api_test extends \advanced_testcase {
|
||||
*
|
||||
* @throws coding_exception
|
||||
*/
|
||||
public function test_can_create_data_deletion_request_for_self_no() {
|
||||
public function test_can_create_data_deletion_request_for_self_no(): void {
|
||||
$this->resetAfterTest();
|
||||
$userid = $this->getDataGenerator()->create_user()->id;
|
||||
$roleid = $this->getDataGenerator()->create_role();
|
||||
@@ -2373,7 +2373,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test primary admin cannot create data deletion request for themselves
|
||||
*/
|
||||
public function test_can_create_data_deletion_request_for_self_primary_admin() {
|
||||
public function test_can_create_data_deletion_request_for_self_primary_admin(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
$this->assertFalse(api::can_create_data_deletion_request_for_self());
|
||||
@@ -2382,7 +2382,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test secondary admin can create data deletion request for themselves
|
||||
*/
|
||||
public function test_can_create_data_deletion_request_for_self_secondary_admin() {
|
||||
public function test_can_create_data_deletion_request_for_self_secondary_admin(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$admin1 = $this->getDataGenerator()->create_user();
|
||||
@@ -2403,7 +2403,7 @@ class api_test extends \advanced_testcase {
|
||||
*
|
||||
* @throws coding_exception
|
||||
*/
|
||||
public function test_can_create_data_deletion_request_for_self_yes() {
|
||||
public function test_can_create_data_deletion_request_for_self_yes(): void {
|
||||
$this->resetAfterTest();
|
||||
$userid = $this->getDataGenerator()->create_user()->id;
|
||||
$this->setUser($userid);
|
||||
@@ -2417,7 +2417,7 @@ class api_test extends \advanced_testcase {
|
||||
* @throws coding_exception
|
||||
* @throws dml_exception
|
||||
*/
|
||||
public function test_can_create_data_deletion_request_for_other_no() {
|
||||
public function test_can_create_data_deletion_request_for_other_no(): void {
|
||||
$this->resetAfterTest();
|
||||
$userid = $this->getDataGenerator()->create_user()->id;
|
||||
$this->setUser($userid);
|
||||
@@ -2430,7 +2430,7 @@ class api_test extends \advanced_testcase {
|
||||
*
|
||||
* @throws coding_exception
|
||||
*/
|
||||
public function test_can_create_data_deletion_request_for_other_yes() {
|
||||
public function test_can_create_data_deletion_request_for_other_yes(): void {
|
||||
$this->resetAfterTest();
|
||||
$userid = $this->getDataGenerator()->create_user()->id;
|
||||
$roleid = $this->getDataGenerator()->create_role();
|
||||
@@ -2448,7 +2448,7 @@ class api_test extends \advanced_testcase {
|
||||
* @throws coding_exception
|
||||
* @throws dml_exception
|
||||
*/
|
||||
public function test_can_create_data_deletion_request_for_children() {
|
||||
public function test_can_create_data_deletion_request_for_children(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$parent = $this->getDataGenerator()->create_user();
|
||||
@@ -2490,7 +2490,7 @@ class api_test extends \advanced_testcase {
|
||||
* @dataProvider queue_data_request_task_provider
|
||||
* @param bool $withuserid
|
||||
*/
|
||||
public function test_queue_data_request_task(bool $withuserid) {
|
||||
public function test_queue_data_request_task(bool $withuserid): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setAdminUser();
|
||||
@@ -2546,7 +2546,7 @@ class api_test extends \advanced_testcase {
|
||||
* @param bool $value The setting's value.
|
||||
* @param bool $expected The expected result.
|
||||
*/
|
||||
public function test_is_automatic_request_approval_on($setting, $type, $value, $expected) {
|
||||
public function test_is_automatic_request_approval_on($setting, $type, $value, $expected): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
if ($value !== null) {
|
||||
@@ -2713,7 +2713,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test api validate_create_data_request.
|
||||
*/
|
||||
public function test_validate_create_data_request() {
|
||||
public function test_validate_create_data_request(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$systemcontext = \context_system::instance();
|
||||
|
||||
@@ -185,7 +185,7 @@ Feature: Data export from the privacy API
|
||||
And I reload the page
|
||||
And I should see "Download ready" in the "Victim User 1" "table_row"
|
||||
And I open the action menu in "Victim User 1" "table_row"
|
||||
And following "Download" should download between "1" and "170000" bytes
|
||||
And following "Download" should download between "1" and "172000" bytes
|
||||
And the following config values are set as admin:
|
||||
| privacyrequestexpiry | 1 | tool_dataprivacy |
|
||||
And I wait "1" seconds
|
||||
|
||||
@@ -30,7 +30,7 @@ class data_registry_test 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() {
|
||||
public function test_get_effective_context_value_invalid_element(): void {
|
||||
$this->expectException(\coding_exception::class);
|
||||
data_registry::get_effective_context_value(\context_system::instance(), 'invalid');
|
||||
}
|
||||
@@ -40,7 +40,7 @@ class data_registry_test 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() {
|
||||
public function test_get_effective_contextlevel_value_invalid_element(): void {
|
||||
$this->expectException(\coding_exception::class);
|
||||
data_registry::get_effective_contextlevel_value(\context_system::instance(), 'invalid');
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ class data_request_test extends data_privacy_testcase {
|
||||
* @param bool $resettable
|
||||
* @param bool $active
|
||||
*/
|
||||
public function test_pseudo_states_export(int $status, bool $resettable, bool $active) {
|
||||
public function test_pseudo_states_export(int $status, bool $resettable, bool $active): void {
|
||||
$uut = new \tool_dataprivacy\data_request();
|
||||
$uut->set('status', $status);
|
||||
$uut->set('type', api::DATAREQUEST_TYPE_EXPORT);
|
||||
@@ -110,7 +110,7 @@ class data_request_test extends data_privacy_testcase {
|
||||
* @param bool $resettable
|
||||
* @param bool $active
|
||||
*/
|
||||
public function test_pseudo_states_delete(int $status, bool $resettable, bool $active) {
|
||||
public function test_pseudo_states_delete(int $status, bool $resettable, bool $active): void {
|
||||
$uut = new \tool_dataprivacy\data_request();
|
||||
$uut->set('status', $status);
|
||||
$uut->set('type', api::DATAREQUEST_TYPE_DELETE);
|
||||
@@ -125,7 +125,7 @@ class data_request_test extends data_privacy_testcase {
|
||||
* @dataProvider status_state_provider
|
||||
* @param int $status
|
||||
*/
|
||||
public function test_can_reset_others($status) {
|
||||
public function test_can_reset_others($status): void {
|
||||
$uut = new \tool_dataprivacy\data_request();
|
||||
$uut->set('status', $status);
|
||||
$uut->set('type', api::DATAREQUEST_TYPE_OTHERS);
|
||||
@@ -155,7 +155,7 @@ class data_request_test extends data_privacy_testcase {
|
||||
* @dataProvider non_resettable_provider
|
||||
* @param int $status
|
||||
*/
|
||||
public function test_non_resubmit_request($status) {
|
||||
public function test_non_resubmit_request($status): void {
|
||||
$uut = new \tool_dataprivacy\data_request();
|
||||
$uut->set('status', $status);
|
||||
|
||||
@@ -168,7 +168,7 @@ class data_request_test extends data_privacy_testcase {
|
||||
/**
|
||||
* Ensure that a rejected request can be reset.
|
||||
*/
|
||||
public function test_resubmit_request() {
|
||||
public function test_resubmit_request(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$uut = new \tool_dataprivacy\data_request();
|
||||
@@ -192,7 +192,7 @@ class data_request_test extends data_privacy_testcase {
|
||||
/**
|
||||
* Ensure that an active request can be reset.
|
||||
*/
|
||||
public function test_resubmit_active_request() {
|
||||
public function test_resubmit_active_request(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$uut = new \tool_dataprivacy\data_request();
|
||||
|
||||
@@ -90,7 +90,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a user with no lastaccess is not flagged for deletion.
|
||||
*/
|
||||
public function test_flag_not_setup() {
|
||||
public function test_flag_not_setup(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
@@ -111,7 +111,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a user with no lastaccess is not flagged for deletion.
|
||||
*/
|
||||
public function test_flag_user_no_lastaccess() {
|
||||
public function test_flag_user_no_lastaccess(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setup_basics('PT1H', 'PT1H', 'PT1H');
|
||||
@@ -134,7 +134,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a user with a recent lastaccess is not flagged for deletion.
|
||||
*/
|
||||
public function test_flag_user_recent_lastaccess() {
|
||||
public function test_flag_user_recent_lastaccess(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setup_basics('PT1H', 'PT1H', 'PT1H');
|
||||
@@ -157,7 +157,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a user with a lastaccess in the past is flagged for deletion.
|
||||
*/
|
||||
public function test_flag_user_past_lastaccess() {
|
||||
public function test_flag_user_past_lastaccess(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setup_basics('PT1H', 'PT1H', 'PT1H');
|
||||
@@ -181,7 +181,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a user with a lastaccess in the past but active enrolments is not flagged for deletion.
|
||||
*/
|
||||
public function test_flag_user_past_lastaccess_still_enrolled() {
|
||||
public function test_flag_user_past_lastaccess_still_enrolled(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setup_basics('PT1H', 'PT1H', 'PT1H');
|
||||
@@ -209,7 +209,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a user with a lastaccess in the past and no active enrolments is flagged for deletion.
|
||||
*/
|
||||
public function test_flag_user_update_existing() {
|
||||
public function test_flag_user_update_existing(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setup_basics('PT1H', 'PT1H', 'P5Y');
|
||||
@@ -241,7 +241,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a user with a lastaccess in the past and expired enrolments.
|
||||
*/
|
||||
public function test_flag_user_past_lastaccess_unexpired_past_enrolment() {
|
||||
public function test_flag_user_past_lastaccess_unexpired_past_enrolment(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setup_basics('PT1H', 'PT1H', 'P1Y');
|
||||
@@ -269,7 +269,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a user with a lastaccess in the past and expired enrolments.
|
||||
*/
|
||||
public function test_flag_user_past_override_role() {
|
||||
public function test_flag_user_past_override_role(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
|
||||
@@ -303,7 +303,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a user with a lastaccess in the past and expired enrolments.
|
||||
*/
|
||||
public function test_flag_user_past_lastaccess_expired_enrolled() {
|
||||
public function test_flag_user_past_lastaccess_expired_enrolled(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setup_basics('PT1H', 'PT1H', 'PT1H');
|
||||
@@ -332,7 +332,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
* Ensure that a user with a lastaccess in the past and enrolments without a course end date are respected
|
||||
* correctly.
|
||||
*/
|
||||
public function test_flag_user_past_lastaccess_missing_enddate_required() {
|
||||
public function test_flag_user_past_lastaccess_missing_enddate_required(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setup_basics('PT1H', 'PT1H', 'PT1H');
|
||||
@@ -364,7 +364,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
* Ensure that a user with a lastaccess in the past and enrolments without a course end date are respected
|
||||
* correctly when the end date is not required.
|
||||
*/
|
||||
public function test_flag_user_past_lastaccess_missing_enddate_not_required() {
|
||||
public function test_flag_user_past_lastaccess_missing_enddate_not_required(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setup_basics('PT1H', 'PT1H', 'PT1H');
|
||||
@@ -395,7 +395,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a user with a recent lastaccess is not flagged for deletion.
|
||||
*/
|
||||
public function test_flag_user_recent_lastaccess_existing_record() {
|
||||
public function test_flag_user_recent_lastaccess_existing_record(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setup_basics('PT1H', 'PT1H', 'PT1H');
|
||||
@@ -429,7 +429,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a user with a recent lastaccess is not flagged for deletion.
|
||||
*/
|
||||
public function test_flag_user_retention_changed() {
|
||||
public function test_flag_user_retention_changed(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$purposes = $this->setup_basics('PT1H', 'PT1H', 'PT1H');
|
||||
@@ -469,7 +469,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a user with a historically expired expired block record child is cleaned up.
|
||||
*/
|
||||
public function test_flag_user_historic_block_unapproved() {
|
||||
public function test_flag_user_historic_block_unapproved(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setup_basics('PT1H', 'PT1H', 'PT1H');
|
||||
@@ -506,7 +506,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a user with a block which has a default retention period which has not expired, is still expired.
|
||||
*/
|
||||
public function test_flag_user_historic_unexpired_child() {
|
||||
public function test_flag_user_historic_unexpired_child(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setup_basics('PT1H', 'PT1H', 'PT1H');
|
||||
@@ -534,7 +534,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a course with no end date is not flagged.
|
||||
*/
|
||||
public function test_flag_course_no_enddate() {
|
||||
public function test_flag_course_no_enddate(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setup_basics('PT1H', 'PT1H', 'PT1H', 'PT1H');
|
||||
@@ -553,7 +553,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a course with an end date in the distant past, but a child which is unexpired is not flagged.
|
||||
*/
|
||||
public function test_flag_course_past_enddate_future_child() {
|
||||
public function test_flag_course_past_enddate_future_child(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setup_basics('PT1H', 'PT1H', 'PT1H', 'P5Y');
|
||||
@@ -575,7 +575,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a course with an end date in the distant past is flagged.
|
||||
*/
|
||||
public function test_flag_course_past_enddate() {
|
||||
public function test_flag_course_past_enddate(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setup_basics('PT1H', 'PT1H', 'PT1H', 'PT1H');
|
||||
@@ -597,7 +597,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a course with an end date in the distant past is flagged.
|
||||
*/
|
||||
public function test_flag_course_past_enddate_multiple() {
|
||||
public function test_flag_course_past_enddate_multiple(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setup_basics('PT1H', 'PT1H', 'PT1H', 'PT1H');
|
||||
@@ -625,7 +625,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a course with an end date in the future is not flagged.
|
||||
*/
|
||||
public function test_flag_course_future_enddate() {
|
||||
public function test_flag_course_future_enddate(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setup_basics('PT1H', 'PT1H', 'PT1H', 'PT1H');
|
||||
@@ -644,7 +644,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a course with an end date in the future is not flagged.
|
||||
*/
|
||||
public function test_flag_course_recent_unexpired_enddate() {
|
||||
public function test_flag_course_recent_unexpired_enddate(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setup_basics('PT1H', 'PT1H', 'PT1H', 'PT1H');
|
||||
@@ -662,7 +662,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a course with an end date in the distant past is flagged, taking into account any purpose override
|
||||
*/
|
||||
public function test_flag_course_past_enddate_with_override_unexpired_role() {
|
||||
public function test_flag_course_past_enddate_with_override_unexpired_role(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
|
||||
@@ -701,7 +701,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a course with an end date in the distant past is flagged, and any expired role is ignored.
|
||||
*/
|
||||
public function test_flag_course_past_enddate_with_override_expired_role() {
|
||||
public function test_flag_course_past_enddate_with_override_expired_role(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
|
||||
@@ -740,7 +740,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
* Ensure that where a course has explicitly expired one role, but that role is explicitly not expired in a child
|
||||
* context, does not have the parent context role expired.
|
||||
*/
|
||||
public function test_flag_course_override_expiredwith_override_unexpired_on_child() {
|
||||
public function test_flag_course_override_expiredwith_override_unexpired_on_child(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
|
||||
@@ -809,7 +809,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a user context previously flagged as approved is not removed if the user has any unexpired roles.
|
||||
*/
|
||||
public function test_process_user_context_with_override_unexpired_role() {
|
||||
public function test_process_user_context_with_override_unexpired_role(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
|
||||
@@ -867,7 +867,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a module context previously flagged as approved is removed with appropriate unexpiredroles kept.
|
||||
*/
|
||||
public function test_process_course_context_with_override_unexpired_role() {
|
||||
public function test_process_course_context_with_override_unexpired_role(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
|
||||
@@ -955,7 +955,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a module context previously flagged as approved is removed with appropriate expiredroles kept.
|
||||
*/
|
||||
public function test_process_course_context_with_override_expired_role() {
|
||||
public function test_process_course_context_with_override_expired_role(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
|
||||
@@ -1043,7 +1043,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a module context previously flagged as approved is removed with appropriate expiredroles kept.
|
||||
*/
|
||||
public function test_process_course_context_with_user_in_both_lists() {
|
||||
public function test_process_course_context_with_user_in_both_lists(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
|
||||
@@ -1132,7 +1132,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a module context previously flagged as approved is removed with appropriate expiredroles kept.
|
||||
*/
|
||||
public function test_process_course_context_with_user_in_both_lists_expired() {
|
||||
public function test_process_course_context_with_user_in_both_lists_expired(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
|
||||
@@ -1228,7 +1228,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a site not setup will not process anything.
|
||||
*/
|
||||
public function test_process_not_setup() {
|
||||
public function test_process_not_setup(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$user = $this->getDataGenerator()->create_user(['lastaccess' => time() - YEARSECS]);
|
||||
@@ -1265,7 +1265,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a user with no lastaccess is not flagged for deletion.
|
||||
*/
|
||||
public function test_process_none_approved() {
|
||||
public function test_process_none_approved(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setup_basics('PT1H', 'PT1H', 'PT1H', 'PT1H');
|
||||
@@ -1304,7 +1304,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a user with no lastaccess is not flagged for deletion.
|
||||
*/
|
||||
public function test_process_no_context() {
|
||||
public function test_process_no_context(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setup_basics('PT1H', 'PT1H', 'PT1H', 'PT1H');
|
||||
@@ -1343,7 +1343,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a user context previously flagged as approved is removed.
|
||||
*/
|
||||
public function test_process_user_context() {
|
||||
public function test_process_user_context(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setup_basics('PT1H', 'PT1H', 'PT1H');
|
||||
@@ -1405,7 +1405,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a course context previously flagged as approved is removed.
|
||||
*/
|
||||
public function test_process_course_context() {
|
||||
public function test_process_course_context(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setup_basics('PT1H', 'PT1H', 'PT1H', 'PT1H');
|
||||
@@ -1450,7 +1450,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a user context previously flagged as approved is not removed if the user then logs in.
|
||||
*/
|
||||
public function test_process_user_context_logged_in_after_approval() {
|
||||
public function test_process_user_context_logged_in_after_approval(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setup_basics('PT1H', 'PT1H', 'PT1H');
|
||||
@@ -1502,7 +1502,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a user context previously flagged as approved is not removed if the purpose has changed.
|
||||
*/
|
||||
public function test_process_user_context_changed_after_approved() {
|
||||
public function test_process_user_context_changed_after_approved(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setup_basics('PT1H', 'PT1H', 'PT1H');
|
||||
@@ -1554,7 +1554,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a user with a historically expired expired block record child is cleaned up.
|
||||
*/
|
||||
public function test_process_user_historic_block_unapproved() {
|
||||
public function test_process_user_historic_block_unapproved(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setup_basics('PT1H', 'PT1H', 'PT1H');
|
||||
@@ -1613,7 +1613,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a user with a block which has a default retention period which has not expired, is still expired.
|
||||
*/
|
||||
public function test_process_user_historic_unexpired_child() {
|
||||
public function test_process_user_historic_unexpired_child(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setup_basics('PT1H', 'PT1H', 'PT1H');
|
||||
@@ -1667,7 +1667,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
* Ensure that a course context previously flagged as approved for deletion which now has an unflagged child, is
|
||||
* updated.
|
||||
*/
|
||||
public function test_process_course_context_updated() {
|
||||
public function test_process_course_context_updated(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$purposes = $this->setup_basics('PT1H', 'PT1H', 'PT1H', 'PT1H');
|
||||
@@ -1718,7 +1718,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
* Ensure that a course context previously flagged as approved for deletion which now has an unflagged child, is
|
||||
* updated.
|
||||
*/
|
||||
public function test_process_course_context_outstanding_children() {
|
||||
public function test_process_course_context_outstanding_children(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setup_basics('PT1H', 'PT1H', 'PT1H', 'PT1H');
|
||||
@@ -1767,7 +1767,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
* Ensure that a course context previously flagged as approved for deletion which now has an unflagged child, is
|
||||
* updated.
|
||||
*/
|
||||
public function test_process_course_context_pending_children() {
|
||||
public function test_process_course_context_pending_children(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setup_basics('PT1H', 'PT1H', 'PT1H', 'PT1H');
|
||||
@@ -1825,7 +1825,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
* Ensure that a course context previously flagged as approved for deletion which now has an unflagged child, is
|
||||
* updated.
|
||||
*/
|
||||
public function test_process_course_context_approved_children() {
|
||||
public function test_process_course_context_approved_children(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setup_basics('PT1H', 'PT1H', 'PT1H', 'PT1H');
|
||||
@@ -1903,7 +1903,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
* @param int $status
|
||||
* @param bool $expected
|
||||
*/
|
||||
public function test_can_process_deletion($status, $expected) {
|
||||
public function test_can_process_deletion($status, $expected): void {
|
||||
$purpose = new expired_context(0, (object) [
|
||||
'status' => $status,
|
||||
|
||||
@@ -1942,7 +1942,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
* @param int $status
|
||||
* @param bool $expected
|
||||
*/
|
||||
public function test_is_complete($status, $expected) {
|
||||
public function test_is_complete($status, $expected): void {
|
||||
$purpose = new expired_context(0, (object) [
|
||||
'status' => $status,
|
||||
'contextid' => \context_system::instance()->id,
|
||||
@@ -1980,7 +1980,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
* @param array $record
|
||||
* @param bool $expected
|
||||
*/
|
||||
public function test_is_fully_expired($record, $expected) {
|
||||
public function test_is_fully_expired($record, $expected): void {
|
||||
$purpose = new expired_context(0, (object) $record);
|
||||
|
||||
$this->assertEquals($expected, $purpose->is_fully_expired());
|
||||
@@ -2022,7 +2022,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that any orphaned records are removed once the context has been removed.
|
||||
*/
|
||||
public function test_orphaned_records_are_cleared() {
|
||||
public function test_orphaned_records_are_cleared(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setup_basics('PT1H', 'PT1H', 'PT1H', 'PT1H');
|
||||
@@ -2073,7 +2073,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that the progres tracer works as expected out of the box.
|
||||
*/
|
||||
public function test_progress_tracer_default() {
|
||||
public function test_progress_tracer_default(): void {
|
||||
$manager = new \tool_dataprivacy\expired_contexts_manager();
|
||||
|
||||
$rc = new \ReflectionClass(\tool_dataprivacy\expired_contexts_manager::class);
|
||||
@@ -2085,7 +2085,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that the progres tracer works as expected when given a specific traer.
|
||||
*/
|
||||
public function test_progress_tracer_set() {
|
||||
public function test_progress_tracer_set(): void {
|
||||
$manager = new \tool_dataprivacy\expired_contexts_manager();
|
||||
$mytrace = new \null_progress_trace();
|
||||
$manager->set_progress($mytrace);
|
||||
@@ -2164,7 +2164,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the is_context_expired functions when supplied with the system context.
|
||||
*/
|
||||
public function test_is_context_expired_system() {
|
||||
public function test_is_context_expired_system(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setup_basics('PT1H', 'PT1H', 'P1D');
|
||||
$user = $this->getDataGenerator()->create_user(['lastaccess' => time() - YEARSECS]);
|
||||
@@ -2180,7 +2180,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
* Children of a user context always follow the user expiry rather than any context level defaults (e.g. at the
|
||||
* block level.
|
||||
*/
|
||||
public function test_is_context_expired_user_block() {
|
||||
public function test_is_context_expired_user_block(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$purposes = $this->setup_basics('PT1H', 'PT1H', 'P1D');
|
||||
@@ -2205,7 +2205,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the is_context_expired functions when supplied with the front page course.
|
||||
*/
|
||||
public function test_is_context_expired_frontpage() {
|
||||
public function test_is_context_expired_frontpage(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$purposes = $this->setup_basics('PT1H', 'PT1H', 'P1D');
|
||||
@@ -2239,7 +2239,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the is_context_expired functions when supplied with an expired course.
|
||||
*/
|
||||
public function test_is_context_expired_course_expired() {
|
||||
public function test_is_context_expired_course_expired(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$purposes = $this->setup_basics('PT1H', 'PT1H', 'P1D');
|
||||
@@ -2262,7 +2262,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the is_context_expired functions when supplied with an unexpired course.
|
||||
*/
|
||||
public function test_is_context_expired_course_unexpired() {
|
||||
public function test_is_context_expired_course_unexpired(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$purposes = $this->setup_basics('PT1H', 'PT1H', 'P1D');
|
||||
@@ -2291,7 +2291,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
* If the course is still within the expiry period for the child context, then that child's protected flag should be
|
||||
* respected, even when the course may have expired.
|
||||
*/
|
||||
public function test_is_child_context_expired_course_unexpired_with_child() {
|
||||
public function test_is_child_context_expired_course_unexpired_with_child(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$purposes = $this->setup_basics('PT1H', 'PT1H', 'P1D', 'P1D');
|
||||
@@ -2321,7 +2321,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the is_context_expired functions when supplied with an expired course which has role overrides.
|
||||
*/
|
||||
public function test_is_context_expired_course_expired_override() {
|
||||
public function test_is_context_expired_course_expired_override(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -2356,7 +2356,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the is_context_expired functions when supplied with an expired course which has role overrides.
|
||||
*/
|
||||
public function test_is_context_expired_course_expired_override_parent() {
|
||||
public function test_is_context_expired_course_expired_override_parent(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -2405,7 +2405,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
* Test the is_context_expired functions when supplied with an expired course which has role overrides but the user
|
||||
* does not hold the role.
|
||||
*/
|
||||
public function test_is_context_expired_course_expired_override_parent_no_role() {
|
||||
public function test_is_context_expired_course_expired_override_parent_no_role(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -2434,7 +2434,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the is_context_expired functions when supplied with an unexpired course which has role overrides.
|
||||
*/
|
||||
public function test_is_context_expired_course_expired_override_inverse() {
|
||||
public function test_is_context_expired_course_expired_override_inverse(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -2463,7 +2463,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the is_context_expired functions when supplied with an unexpired course which has role overrides.
|
||||
*/
|
||||
public function test_is_context_expired_course_expired_override_inverse_parent() {
|
||||
public function test_is_context_expired_course_expired_override_inverse_parent(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -2496,7 +2496,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the is_context_expired functions when supplied with an unexpired course which has role overrides.
|
||||
*/
|
||||
public function test_is_context_expired_course_expired_override_inverse_parent_not_assigned() {
|
||||
public function test_is_context_expired_course_expired_override_inverse_parent_not_assigned(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -2528,7 +2528,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that context expired checks for a specific user taken into account roles.
|
||||
*/
|
||||
public function test_is_context_expired_or_unprotected_for_user_role_mixtures_protected() {
|
||||
public function test_is_context_expired_or_unprotected_for_user_role_mixtures_protected(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -2583,7 +2583,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that context expired checks for a specific user taken into account roles when retention is inversed.
|
||||
*/
|
||||
public function test_is_context_expired_or_unprotected_for_user_role_mixtures_protected_inverse() {
|
||||
public function test_is_context_expired_or_unprotected_for_user_role_mixtures_protected_inverse(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
|
||||
@@ -26,10 +26,11 @@ require_once('data_privacy_testcase.php');
|
||||
* Expired data requests tests.
|
||||
*
|
||||
* @package tool_dataprivacy
|
||||
* @covers \tool_dataprivacy\data_request
|
||||
* @copyright 2018 Michael Hawkins
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class expired_data_requests_test extends data_privacy_testcase {
|
||||
final class expired_data_requests_test extends data_privacy_testcase {
|
||||
|
||||
/**
|
||||
* Test tearDown.
|
||||
@@ -41,7 +42,7 @@ class expired_data_requests_test extends data_privacy_testcase {
|
||||
/**
|
||||
* Test finding and deleting expired data requests
|
||||
*/
|
||||
public function test_data_request_expiry() {
|
||||
public function test_data_request_expiry(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
\core_privacy\local\request\writer::setup_real_writer_instance();
|
||||
@@ -107,12 +108,58 @@ class expired_data_requests_test extends data_privacy_testcase {
|
||||
$this->assertEquals(0, $DB->count_records('files', $fileconditions));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that data requests are not expired when expiration is disabled (set to zero)
|
||||
*/
|
||||
public function test_data_request_expiry_never(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
|
||||
\core_privacy\local\request\writer::setup_real_writer_instance();
|
||||
|
||||
// Disable request expiry.
|
||||
set_config('privacyrequestexpiry', 0, 'tool_dataprivacy');
|
||||
|
||||
// Create and approve data request.
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
$usercontext = \context_user::instance($user->id);
|
||||
|
||||
$this->setUser($user->id);
|
||||
$datarequest = api::create_data_request($user->id, api::DATAREQUEST_TYPE_EXPORT);
|
||||
$requestid = $datarequest->get('id');
|
||||
|
||||
$this->setAdminUser();
|
||||
api::approve_data_request($requestid);
|
||||
|
||||
ob_start();
|
||||
$this->runAdhocTasks('\tool_dataprivacy\task\process_data_request_task');
|
||||
ob_end_clean();
|
||||
|
||||
// Run expiry deletion - should not affect test export.
|
||||
$expiredrequests = data_request::get_expired_requests();
|
||||
$this->assertEmpty($expiredrequests);
|
||||
data_request::expire($expiredrequests);
|
||||
|
||||
// Confirm approved and exported.
|
||||
$request = new data_request($requestid);
|
||||
$this->assertEquals(api::DATAREQUEST_STATUS_DOWNLOAD_READY, $request->get('status'));
|
||||
$fileconditions = [
|
||||
'userid' => $user->id,
|
||||
'component' => 'tool_dataprivacy',
|
||||
'filearea' => 'export',
|
||||
'itemid' => $requestid,
|
||||
'contextid' => $usercontext->id,
|
||||
];
|
||||
$this->assertEquals(2, $DB->count_records('files', $fileconditions));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for \tool_dataprivacy\data_request::is_expired()
|
||||
* Tests for the expected request status to protect from false positive/negative,
|
||||
* then tests is_expired() is returning the expected response.
|
||||
*/
|
||||
public function test_is_expired() {
|
||||
public function test_is_expired(): void {
|
||||
$this->resetAfterTest();
|
||||
\core_privacy\local\request\writer::setup_real_writer_instance();
|
||||
|
||||
|
||||
+47
-47
@@ -48,7 +48,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::approve_data_request() with the user not logged in.
|
||||
*/
|
||||
public function test_approve_data_request_not_logged_in() {
|
||||
public function test_approve_data_request_not_logged_in(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new \testing_data_generator();
|
||||
@@ -69,7 +69,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::approve_data_request() with the user not having a DPO role.
|
||||
*/
|
||||
public function test_approve_data_request_not_dpo() {
|
||||
public function test_approve_data_request_not_dpo(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new \testing_data_generator();
|
||||
@@ -89,7 +89,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::approve_data_request() for request that's not ready for approval
|
||||
*/
|
||||
public function test_approve_data_request_not_waiting_for_approval() {
|
||||
public function test_approve_data_request_not_waiting_for_approval(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new \testing_data_generator();
|
||||
@@ -110,7 +110,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::approve_data_request()
|
||||
*/
|
||||
public function test_approve_data_request() {
|
||||
public function test_approve_data_request(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new \testing_data_generator();
|
||||
@@ -133,7 +133,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::approve_data_request() for a non-existent request ID.
|
||||
*/
|
||||
public function test_approve_data_request_non_existent() {
|
||||
public function test_approve_data_request_non_existent(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Admin as DPO. (The default when no one's assigned as a DPO in the site).
|
||||
@@ -151,7 +151,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::cancel_data_request() of another user.
|
||||
*/
|
||||
public function test_cancel_data_request_other_user() {
|
||||
public function test_cancel_data_request_other_user(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new \testing_data_generator();
|
||||
@@ -177,7 +177,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test cancellation of a request where you are the requester of another user's data.
|
||||
*/
|
||||
public function test_cancel_data_request_other_user_as_requester() {
|
||||
public function test_cancel_data_request_other_user_as_requester(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new \testing_data_generator();
|
||||
@@ -204,7 +204,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test cancellation of a request where you are the requester of another user's data.
|
||||
*/
|
||||
public function test_cancel_data_request_requester_lost_permissions() {
|
||||
public function test_cancel_data_request_requester_lost_permissions(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new \testing_data_generator();
|
||||
@@ -233,7 +233,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test cancellation of a request where you are the requester of another user's data.
|
||||
*/
|
||||
public function test_cancel_data_request_other_user_as_child() {
|
||||
public function test_cancel_data_request_other_user_as_child(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new \testing_data_generator();
|
||||
@@ -260,7 +260,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::cancel_data_request()
|
||||
*/
|
||||
public function test_cancel_data_request() {
|
||||
public function test_cancel_data_request(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new \testing_data_generator();
|
||||
@@ -283,7 +283,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test contact DPO.
|
||||
*/
|
||||
public function test_contact_dpo() {
|
||||
public function test_contact_dpo(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new \testing_data_generator();
|
||||
@@ -300,7 +300,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test contact DPO with message containing invalid input.
|
||||
*/
|
||||
public function test_contact_dpo_with_nasty_input() {
|
||||
public function test_contact_dpo_with_nasty_input(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new \testing_data_generator();
|
||||
@@ -314,7 +314,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::deny_data_request() with the user not logged in.
|
||||
*/
|
||||
public function test_deny_data_request_not_logged_in() {
|
||||
public function test_deny_data_request_not_logged_in(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new \testing_data_generator();
|
||||
@@ -334,7 +334,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::deny_data_request() with the user not having a DPO role.
|
||||
*/
|
||||
public function test_deny_data_request_not_dpo() {
|
||||
public function test_deny_data_request_not_dpo(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new \testing_data_generator();
|
||||
@@ -353,7 +353,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::deny_data_request() for request that's not ready for approval
|
||||
*/
|
||||
public function test_deny_data_request_not_waiting_for_approval() {
|
||||
public function test_deny_data_request_not_waiting_for_approval(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new \testing_data_generator();
|
||||
@@ -373,7 +373,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::deny_data_request()
|
||||
*/
|
||||
public function test_deny_data_request() {
|
||||
public function test_deny_data_request(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new \testing_data_generator();
|
||||
@@ -395,7 +395,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::deny_data_request() for a non-existent request ID.
|
||||
*/
|
||||
public function test_deny_data_request_non_existent() {
|
||||
public function test_deny_data_request_non_existent(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Admin as DPO. (The default when no one's assigned as a DPO in the site).
|
||||
@@ -412,7 +412,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::get_data_request() with the user not logged in.
|
||||
*/
|
||||
public function test_get_data_request_not_logged_in() {
|
||||
public function test_get_data_request_not_logged_in(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new \testing_data_generator();
|
||||
@@ -430,7 +430,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::get_data_request() with the user not having a DPO role.
|
||||
*/
|
||||
public function test_get_data_request_not_dpo() {
|
||||
public function test_get_data_request_not_dpo(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new \testing_data_generator();
|
||||
@@ -450,7 +450,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::get_data_request()
|
||||
*/
|
||||
public function test_get_data_request() {
|
||||
public function test_get_data_request(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new \testing_data_generator();
|
||||
@@ -475,7 +475,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::get_data_request() for a non-existent request ID.
|
||||
*/
|
||||
public function test_get_data_request_non_existent() {
|
||||
public function test_get_data_request_non_existent(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Admin as DPO. (The default when no one's assigned as a DPO in the site).
|
||||
@@ -488,7 +488,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
* Test for \tool_dataprivacy\external::set_context_defaults()
|
||||
* when called by a user that doesn't have the manage registry capability.
|
||||
*/
|
||||
public function test_set_context_defaults_no_capability() {
|
||||
public function test_set_context_defaults_no_capability(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
@@ -508,7 +508,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
* @param bool $modulelevel Whether defaults are to be applied on the module context level or for an activity only.
|
||||
* @param bool $override Whether to override instances.
|
||||
*/
|
||||
public function test_set_context_defaults($modulelevel, $override) {
|
||||
public function test_set_context_defaults($modulelevel, $override): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setAdminUser();
|
||||
@@ -567,7 +567,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
* Test for \tool_dataprivacy\external::get_category_options()
|
||||
* when called by a user that doesn't have the manage registry capability.
|
||||
*/
|
||||
public function test_get_category_options_no_capability() {
|
||||
public function test_get_category_options_no_capability(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
@@ -596,7 +596,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
* @param bool $includeinherit Whether "Inherit" would be included to the options.
|
||||
* @param bool $includenotset Whether "Not set" would be included to the options.
|
||||
*/
|
||||
public function test_get_category_options($includeinherit, $includenotset) {
|
||||
public function test_get_category_options($includeinherit, $includenotset): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
@@ -642,7 +642,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
* Test for \tool_dataprivacy\external::get_purpose_options()
|
||||
* when called by a user that doesn't have the manage registry capability.
|
||||
*/
|
||||
public function test_get_purpose_options_no_capability() {
|
||||
public function test_get_purpose_options_no_capability(): void {
|
||||
$this->resetAfterTest();
|
||||
$generator = $this->getDataGenerator();
|
||||
$user = $generator->create_user();
|
||||
@@ -658,7 +658,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
* @param bool $includeinherit Whether "Inherit" would be included to the options.
|
||||
* @param bool $includenotset Whether "Not set" would be included to the options.
|
||||
*/
|
||||
public function test_get_purpose_options($includeinherit, $includenotset) {
|
||||
public function test_get_purpose_options($includeinherit, $includenotset): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
@@ -726,7 +726,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
* @param bool $inheritpurpose Whether the purpose would be set to "Inherit".
|
||||
* @param bool $nodefaults Whether to fetch only activities that don't have defaults.
|
||||
*/
|
||||
public function test_get_activity_options($inheritcategory, $inheritpurpose, $nodefaults) {
|
||||
public function test_get_activity_options($inheritcategory, $inheritpurpose, $nodefaults): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
@@ -774,7 +774,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::bulk_approve_data_requests().
|
||||
*/
|
||||
public function test_bulk_approve_data_requests() {
|
||||
public function test_bulk_approve_data_requests(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Create delete data requests.
|
||||
@@ -802,7 +802,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::bulk_approve_data_requests() for a non-existent request ID.
|
||||
*/
|
||||
public function test_bulk_approve_data_requests_non_existent() {
|
||||
public function test_bulk_approve_data_requests_non_existent(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setAdminUser();
|
||||
@@ -820,7 +820,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::bulk_deny_data_requests() for a user without permission to deny requests.
|
||||
*/
|
||||
public function test_bulk_approve_data_requests_no_permission() {
|
||||
public function test_bulk_approve_data_requests_no_permission(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Create delete data requests.
|
||||
@@ -849,7 +849,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::bulk_deny_data_requests() for a user without permission to deny requests.
|
||||
*/
|
||||
public function test_bulk_approve_data_requests_own_request() {
|
||||
public function test_bulk_approve_data_requests_own_request(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Create delete data requests.
|
||||
@@ -877,7 +877,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::bulk_deny_data_requests().
|
||||
*/
|
||||
public function test_bulk_deny_data_requests() {
|
||||
public function test_bulk_deny_data_requests(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Create delete data requests.
|
||||
@@ -905,7 +905,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::bulk_deny_data_requests() for a non-existent request ID.
|
||||
*/
|
||||
public function test_bulk_deny_data_requests_non_existent() {
|
||||
public function test_bulk_deny_data_requests_non_existent(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setAdminUser();
|
||||
@@ -922,7 +922,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::bulk_deny_data_requests() for a user without permission to deny requests.
|
||||
*/
|
||||
public function test_bulk_deny_data_requests_no_permission() {
|
||||
public function test_bulk_deny_data_requests_no_permission(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Create delete data requests.
|
||||
@@ -951,7 +951,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::bulk_deny_data_requests() for a user cannot approve their own request.
|
||||
*/
|
||||
public function test_bulk_deny_data_requests_own_request() {
|
||||
public function test_bulk_deny_data_requests_own_request(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Create delete data requests.
|
||||
@@ -986,7 +986,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
* @throws required_capability_exception
|
||||
* @throws restricted_context_exception
|
||||
*/
|
||||
public function test_get_users_using_using_non_identity() {
|
||||
public function test_get_users_using_using_non_identity(): void {
|
||||
$this->resetAfterTest();
|
||||
$context = \context_system::instance();
|
||||
$requester = $this->getDataGenerator()->create_user();
|
||||
@@ -1021,7 +1021,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
* @throws required_capability_exception
|
||||
* @throws restricted_context_exception
|
||||
*/
|
||||
public function test_get_users_using_identity_without_permission() {
|
||||
public function test_get_users_using_identity_without_permission(): void {
|
||||
global $CFG;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -1053,7 +1053,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
* @throws required_capability_exception
|
||||
* @throws restricted_context_exception
|
||||
*/
|
||||
public function test_get_users_using_field_not_in_identity() {
|
||||
public function test_get_users_using_field_not_in_identity(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$context = \context_system::instance();
|
||||
@@ -1082,7 +1082,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
* @throws required_capability_exception
|
||||
* @throws restricted_context_exception
|
||||
*/
|
||||
public function test_get_users() {
|
||||
public function test_get_users(): void {
|
||||
global $CFG;
|
||||
$this->resetAfterTest();
|
||||
$CFG->showuseridentity = 'institution';
|
||||
@@ -1118,7 +1118,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::get_access_information().
|
||||
*/
|
||||
public function test_get_access_information() {
|
||||
public function test_get_access_information(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->setAdminUser();
|
||||
@@ -1145,7 +1145,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::create_data_request()
|
||||
*/
|
||||
public function test_create_data_request() {
|
||||
public function test_create_data_request(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$systemcontext = \context_system::instance();
|
||||
@@ -1200,7 +1200,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::create_data_request() when no dpo available.
|
||||
*/
|
||||
public function test_create_data_request_no_dpo() {
|
||||
public function test_create_data_request_no_dpo(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
@@ -1214,7 +1214,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::create_data_request() with missing permission.
|
||||
*/
|
||||
public function test_create_data_request_no_permission() {
|
||||
public function test_create_data_request_no_permission(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Enable contact DPO.
|
||||
@@ -1231,7 +1231,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::create_data_request() with invalid request type.
|
||||
*/
|
||||
public function test_create_data_request_invalid_type() {
|
||||
public function test_create_data_request_invalid_type(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Enable contact DPO.
|
||||
@@ -1248,7 +1248,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::get_data_requests().
|
||||
*/
|
||||
public function test_get_data_requests() {
|
||||
public function test_get_data_requests(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -1355,7 +1355,7 @@ class external_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for external::get_data_requests() invalid user id.
|
||||
*/
|
||||
public function test_get_data_requests_invalid_userid() {
|
||||
public function test_get_data_requests_invalid_userid(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ class submit_selected_courses_form_test extends \externallib_advanced_testcase {
|
||||
/**
|
||||
* Test for submit_selected_courses_form().
|
||||
*/
|
||||
public function test_submit_selected_courses_form() {
|
||||
public function test_submit_selected_courses_form(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ class filtered_userlist_test extends \advanced_testcase {
|
||||
* @param array $unexpired The set of userids considered as unexpired.
|
||||
* @param array $expected The expected values.
|
||||
*/
|
||||
public function test_apply_expired_contexts_filters(array $initial, array $expired, array $unexpired, array $expected) {
|
||||
public function test_apply_expired_contexts_filters(array $initial, array $expired, array $unexpired, array $expected): void {
|
||||
$userlist = $this->getMockBuilder(\tool_dataprivacy\filtered_userlist::class)
|
||||
->disableOriginalConstructor()
|
||||
->onlyMethods([])
|
||||
|
||||
@@ -32,7 +32,7 @@ class manager_observer_test extends data_privacy_testcase {
|
||||
/**
|
||||
* Ensure that when users are configured as DPO, they are sent an message upon failure.
|
||||
*/
|
||||
public function test_handle_component_failure() {
|
||||
public function test_handle_component_failure(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Create another user who is not a DPO.
|
||||
@@ -65,7 +65,7 @@ class manager_observer_test extends data_privacy_testcase {
|
||||
/**
|
||||
* Ensure that when no user is configured as DPO, the message is sent to admin instead.
|
||||
*/
|
||||
public function test_handle_component_failure_no_dpo() {
|
||||
public function test_handle_component_failure_no_dpo(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Create another user who is not a DPO or admin.
|
||||
|
||||
@@ -47,7 +47,7 @@ class metadata_registry_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test that we can fetch metadata about users for the whole system and that it matches the system count.
|
||||
*/
|
||||
public function test_get_registry_metadata_count() {
|
||||
public function test_get_registry_metadata_count(): void {
|
||||
$data = $this->get_meta_data();
|
||||
|
||||
$plugintypes = \core_component::get_plugin_types();
|
||||
@@ -71,7 +71,7 @@ class metadata_registry_test extends \advanced_testcase {
|
||||
/**
|
||||
* Check that the expected null provider information is returned.
|
||||
*/
|
||||
public function test_get_registry_metadata_null_provider_details() {
|
||||
public function test_get_registry_metadata_null_provider_details(): void {
|
||||
$data = $this->get_meta_data();
|
||||
|
||||
// Check details of core privacy (a null privder) are correct.
|
||||
@@ -83,7 +83,7 @@ class metadata_registry_test extends \advanced_testcase {
|
||||
/**
|
||||
* Check that the expected privacy provider information is returned.
|
||||
*/
|
||||
public function test_get_registry_metadata_provider_details() {
|
||||
public function test_get_registry_metadata_provider_details(): void {
|
||||
$data = $this->get_meta_data();
|
||||
|
||||
// Check details of core rating (a normal provider) are correct.
|
||||
|
||||
@@ -46,7 +46,7 @@ class provider_test extends provider_testcase {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_get_contexts_for_userid() {
|
||||
public function test_get_contexts_for_userid(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
@@ -65,7 +65,7 @@ class provider_test extends provider_testcase {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_get_users_in_context() {
|
||||
public function test_get_users_in_context(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
@@ -82,7 +82,7 @@ class provider_test extends provider_testcase {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_get_users_in_context_non_user_context() {
|
||||
public function test_get_users_in_context_non_user_context(): void {
|
||||
$context = \context_system::instance();
|
||||
|
||||
$userlist = new userlist($context, 'tool_dataprivacy');
|
||||
@@ -96,7 +96,7 @@ class provider_test extends provider_testcase {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_export_user_data() {
|
||||
public function test_export_user_data(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
@@ -152,7 +152,7 @@ class provider_test extends provider_testcase {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_export_user_preferences() {
|
||||
public function test_export_user_preferences(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
|
||||
@@ -45,7 +45,7 @@ class task_test extends \data_privacy_testcase {
|
||||
* is created when there are not any existing data requests
|
||||
* for that particular user.
|
||||
*/
|
||||
public function test_delete_existing_deleted_users_task_no_previous_requests() {
|
||||
public function test_delete_existing_deleted_users_task_no_previous_requests(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -74,7 +74,7 @@ class task_test extends \data_privacy_testcase {
|
||||
* Ensure that a delete data request for pre-existing deleted users
|
||||
* is not being created when automatic creation of delete data requests is disabled.
|
||||
*/
|
||||
public function test_delete_existing_deleted_users_task_automatic_creation_disabled() {
|
||||
public function test_delete_existing_deleted_users_task_automatic_creation_disabled(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -104,7 +104,7 @@ class task_test extends \data_privacy_testcase {
|
||||
* is created when there are existing non-delete data requests
|
||||
* for that particular user.
|
||||
*/
|
||||
public function test_delete_existing_deleted_users_task_existing_export_data_requests() {
|
||||
public function test_delete_existing_deleted_users_task_existing_export_data_requests(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -139,7 +139,7 @@ class task_test extends \data_privacy_testcase {
|
||||
* is not created when there are existing ongoing delete data requests
|
||||
* for that particular user.
|
||||
*/
|
||||
public function test_delete_existing_deleted_users_task_existing_ongoing_delete_data_requests() {
|
||||
public function test_delete_existing_deleted_users_task_existing_ongoing_delete_data_requests(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -179,7 +179,7 @@ class task_test extends \data_privacy_testcase {
|
||||
* is not created when there are existing finished delete data requests
|
||||
* for that particular user.
|
||||
*/
|
||||
public function test_delete_existing_deleted_users_task_existing_finished_delete_data_requests() {
|
||||
public function test_delete_existing_deleted_users_task_existing_finished_delete_data_requests(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
|
||||
@@ -30,7 +30,7 @@ class user_deleted_observer_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a delete data request is created upon user deletion.
|
||||
*/
|
||||
public function test_create_delete_data_request() {
|
||||
public function test_create_delete_data_request(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Enable automatic creation of delete data requests.
|
||||
@@ -50,7 +50,7 @@ class user_deleted_observer_test extends \advanced_testcase {
|
||||
* Ensure that a delete data request is not created upon user deletion if automatic creation of
|
||||
* delete data requests is disabled.
|
||||
*/
|
||||
public function test_create_delete_data_request_automatic_creation_disabled() {
|
||||
public function test_create_delete_data_request_automatic_creation_disabled(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Disable automatic creation of delete data requests.
|
||||
@@ -70,7 +70,7 @@ class user_deleted_observer_test extends \advanced_testcase {
|
||||
* Ensure that a delete data request is being created upon user deletion
|
||||
* if an ongoing export data request (or any other except delete data request) for that user already exists.
|
||||
*/
|
||||
public function test_create_delete_data_request_export_data_request_preexists() {
|
||||
public function test_create_delete_data_request_export_data_request_preexists(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
@@ -96,7 +96,7 @@ class user_deleted_observer_test extends \advanced_testcase {
|
||||
* Ensure that a delete data request is not being created upon user deletion
|
||||
* if an ongoing delete data request for that user already exists.
|
||||
*/
|
||||
public function test_create_delete_data_request_ongoing_delete_data_request_preexists() {
|
||||
public function test_create_delete_data_request_ongoing_delete_data_request_preexists(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
@@ -121,7 +121,7 @@ class user_deleted_observer_test extends \advanced_testcase {
|
||||
* Ensure that a delete data request is being created upon user deletion
|
||||
* if a finished delete data request (excluding complete) for that user already exists.
|
||||
*/
|
||||
public function test_create_delete_data_request_canceled_delete_data_request_preexists() {
|
||||
public function test_create_delete_data_request_canceled_delete_data_request_preexists(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
@@ -151,7 +151,7 @@ class user_deleted_observer_test extends \advanced_testcase {
|
||||
* Ensure that a delete data request is being created upon user deletion
|
||||
* if a completed delete data request for that user already exists.
|
||||
*/
|
||||
public function test_create_delete_data_request_completed_delete_data_request_preexists() {
|
||||
public function test_create_delete_data_request_completed_delete_data_request_preexists(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class tool_filetypes_test extends advanced_testcase {
|
||||
*
|
||||
* @covers ::is_extension_invalid
|
||||
*/
|
||||
public function test_is_extension_invalid() {
|
||||
public function test_is_extension_invalid(): void {
|
||||
// The pdf file extension already exists in default moodle minetypes.
|
||||
$this->assertTrue(utils::is_extension_invalid('pdf'));
|
||||
|
||||
@@ -52,7 +52,7 @@ class tool_filetypes_test extends advanced_testcase {
|
||||
*
|
||||
* @covers ::is_defaulticon_allowed
|
||||
*/
|
||||
public function test_is_defaulticon_allowed() {
|
||||
public function test_is_defaulticon_allowed(): void {
|
||||
// You ARE allowed to set a default icon for a MIME type that hasn't
|
||||
// been used yet.
|
||||
$this->assertTrue(utils::is_defaulticon_allowed('application/x-frog'));
|
||||
@@ -71,7 +71,7 @@ class tool_filetypes_test extends advanced_testcase {
|
||||
*
|
||||
* @covers ::get_icons_from_path
|
||||
*/
|
||||
public function test_get_icons_from_path() {
|
||||
public function test_get_icons_from_path(): void {
|
||||
// Get icons from the fixtures folder.
|
||||
$icons = utils::get_icons_from_path(__DIR__ . '/fixtures');
|
||||
|
||||
@@ -86,7 +86,7 @@ class tool_filetypes_test extends advanced_testcase {
|
||||
*
|
||||
* @covers ::get_file_icons
|
||||
*/
|
||||
public function test_get_file_icons() {
|
||||
public function test_get_file_icons(): void {
|
||||
$icons = utils::get_file_icons();
|
||||
$filetypes = core_filetypes::get_types();
|
||||
|
||||
|
||||
@@ -374,8 +374,9 @@ class tool_generator_course_backend extends tool_generator_backend {
|
||||
private function create_user_accounts($first, $last) {
|
||||
global $CFG;
|
||||
|
||||
$this->log('createaccounts', (object)array('from' => $first, 'to' => $last), true);
|
||||
$count = $last - $first + 1;
|
||||
$this->log('createusers', $count, true);
|
||||
|
||||
$done = 0;
|
||||
for ($number = $first; $number <= $last; $number++, $done++) {
|
||||
// Work out username with 6-digit number.
|
||||
|
||||
@@ -118,6 +118,9 @@ if (!file_exists($featurefile)) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// Switch to admin user account.
|
||||
\core\session\manager::set_user(get_admin());
|
||||
|
||||
$runner = new tool_generator\local\testscenario\runner();
|
||||
|
||||
try {
|
||||
|
||||
@@ -78,6 +78,7 @@ $string['progress_createcourse'] = 'Creating course {$a}';
|
||||
$string['progress_createforum'] = 'Creating forum ({$a} posts)';
|
||||
$string['progress_createpages'] = 'Creating pages ({$a})';
|
||||
$string['progress_createsmallfiles'] = 'Creating small files ({$a})';
|
||||
$string['progress_createusers'] = 'Creating user accounts ({$a})';
|
||||
$string['progress_enrol'] = 'Enrolling users into course ({$a})';
|
||||
$string['progress_sitecompleted'] = 'Site completed ({$a}s)';
|
||||
$string['shortsize_0'] = 'XS';
|
||||
|
||||
@@ -30,7 +30,7 @@ class maketestcourse_test extends \advanced_testcase {
|
||||
/**
|
||||
* Creates a small test course and checks all the components have been put in place.
|
||||
*/
|
||||
public function test_make_xs_course() {
|
||||
public function test_make_xs_course(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -137,7 +137,7 @@ class maketestcourse_test extends \advanced_testcase {
|
||||
/**
|
||||
* Creates an small test course with fixed data set and checks the used sections and users.
|
||||
*/
|
||||
public function test_fixed_data_set() {
|
||||
public function test_fixed_data_set(): void {
|
||||
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
@@ -178,7 +178,7 @@ class maketestcourse_test extends \advanced_testcase {
|
||||
/**
|
||||
* Creates a small test course specifying a maximum size and checks the generated files size is limited.
|
||||
*/
|
||||
public function test_filesize_limit() {
|
||||
public function test_filesize_limit(): void {
|
||||
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
@@ -40,7 +40,7 @@ class maketestsite_test extends \advanced_testcase {
|
||||
/**
|
||||
* Checks that site courses shortnames are properly generated.
|
||||
*/
|
||||
public function test_shortnames_generation() {
|
||||
public function test_shortnames_generation(): void {
|
||||
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
@@ -138,7 +138,7 @@ class httpsreplace_test extends \advanced_testcase {
|
||||
* @param string $expectedcontent What content we are expecting afterwards.
|
||||
* @dataProvider upgrade_http_links_provider
|
||||
*/
|
||||
public function test_upgrade_http_links($content, $ouputregex, $expectedcontent) {
|
||||
public function test_upgrade_http_links($content, $ouputregex, $expectedcontent): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -212,7 +212,7 @@ class httpsreplace_test extends \advanced_testcase {
|
||||
* @param string $expectedcount Number of urls from that domain that we expect to be replaced.
|
||||
* @dataProvider http_link_stats_provider
|
||||
*/
|
||||
public function test_http_link_stats($content, $domain, $expectedcount) {
|
||||
public function test_http_link_stats($content, $domain, $expectedcount): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$finder = new tool_httpreplace_url_finder_mock();
|
||||
@@ -230,7 +230,7 @@ class httpsreplace_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test links and text are not changed
|
||||
*/
|
||||
public function test_links_and_text() {
|
||||
public function test_links_and_text(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -261,7 +261,7 @@ class httpsreplace_test extends \advanced_testcase {
|
||||
/**
|
||||
* If we have an http wwwroot then we shouldn't report it.
|
||||
*/
|
||||
public function test_httpwwwroot() {
|
||||
public function test_httpwwwroot(): void {
|
||||
global $DB, $CFG;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -286,7 +286,7 @@ class httpsreplace_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test that links in excluded tables are not replaced
|
||||
*/
|
||||
public function test_upgrade_http_links_excluded_tables() {
|
||||
public function test_upgrade_http_links_excluded_tables(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
set_config('test_upgrade_http_links', '<img src="http://somesite/someimage.png" />');
|
||||
@@ -306,7 +306,7 @@ class httpsreplace_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test renamed domains
|
||||
*/
|
||||
public function test_renames() {
|
||||
public function test_renames(): void {
|
||||
global $DB, $CFG;
|
||||
$this->resetAfterTest();
|
||||
$this->expectOutputRegex('/UPDATE/');
|
||||
@@ -339,7 +339,7 @@ class httpsreplace_test extends \advanced_testcase {
|
||||
/**
|
||||
* When there are many different pieces of contents from the same site, we should only run replace once
|
||||
*/
|
||||
public function test_multiple() {
|
||||
public function test_multiple(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
$original1 = '';
|
||||
@@ -376,7 +376,7 @@ class httpsreplace_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the tool when the column name is a reserved word in SQL (in this case 'where')
|
||||
*/
|
||||
public function test_reserved_words() {
|
||||
public function test_reserved_words(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
|
||||
@@ -35,7 +35,7 @@ require_once(__DIR__.'/fixtures/testable_installer.php');
|
||||
*/
|
||||
class installer_test extends \advanced_testcase {
|
||||
|
||||
public function test_get_addons_repository_url() {
|
||||
public function test_get_addons_repository_url(): void {
|
||||
$installer = testable_tool_installaddon_installer::instance();
|
||||
$url = $installer->get_addons_repository_url();
|
||||
$query = parse_url($url, PHP_URL_QUERY);
|
||||
@@ -49,7 +49,7 @@ class installer_test extends \advanced_testcase {
|
||||
$this->assertSame("2.5'; DROP TABLE mdl_user; --", $site['majorversion']);
|
||||
}
|
||||
|
||||
public function test_decode_remote_request() {
|
||||
public function test_decode_remote_request(): void {
|
||||
$installer = testable_tool_installaddon_installer::instance();
|
||||
|
||||
$request = base64_encode(json_encode(array(
|
||||
@@ -107,7 +107,7 @@ class installer_test extends \advanced_testcase {
|
||||
$this->assertSame(false, $installer->testable_decode_remote_request($request));
|
||||
}
|
||||
|
||||
public function test_detect_plugin_component() {
|
||||
public function test_detect_plugin_component(): void {
|
||||
global $CFG;
|
||||
|
||||
$installer = tool_installaddon_installer::instance();
|
||||
@@ -119,7 +119,7 @@ class installer_test extends \advanced_testcase {
|
||||
$this->assertFalse($installer->detect_plugin_component($zipfile));
|
||||
}
|
||||
|
||||
public function test_detect_plugin_component_from_versionphp() {
|
||||
public function test_detect_plugin_component_from_versionphp(): void {
|
||||
global $CFG;
|
||||
|
||||
$installer = testable_tool_installaddon_installer::instance();
|
||||
@@ -136,7 +136,7 @@ $plugin->version = 2014121300;
|
||||
$this->assertFalse($installer->testable_detect_plugin_component_from_versionphp($versionphp));
|
||||
}
|
||||
|
||||
public function test_make_installfromzip_storage() {
|
||||
public function test_make_installfromzip_storage(): void {
|
||||
$installer = testable_tool_installaddon_installer::instance();
|
||||
|
||||
// Check we get writable directory.
|
||||
|
||||
@@ -57,7 +57,7 @@ class locale {
|
||||
}
|
||||
|
||||
// Store current locale.
|
||||
$currentlocale = $this->set_locale(LC_ALL, 0);
|
||||
$currentlocale = $this->get_locale();
|
||||
|
||||
$locale = get_string_manager()->get_string($stringtofetch, 'langconfig', $a = null, $langpackcode);
|
||||
|
||||
@@ -79,19 +79,16 @@ class locale {
|
||||
* @return string|false Returns the new current locale, or FALSE on error.
|
||||
*/
|
||||
protected function set_locale(int $category = LC_ALL, string $locale = '0') {
|
||||
if (strlen($locale) <= 255 || PHP_OS_FAMILY === 'BSD' || PHP_OS_FAMILY === 'Darwin') {
|
||||
// We can set the whole locale all together.
|
||||
return setlocale($category, $locale);
|
||||
}
|
||||
return \core\locale::set_locale($category, $locale);
|
||||
}
|
||||
|
||||
// Too long locale with linux or windows, let's split it into known and supported categories.
|
||||
$split = explode(';', $locale);
|
||||
foreach ($split as $element) {
|
||||
[$category, $value] = explode('=', $element);
|
||||
if (defined($category)) { // Only if the category exists, there are OS differences.
|
||||
setlocale(constant($category), $value);
|
||||
}
|
||||
}
|
||||
return setlocale(LC_ALL, 0); // Finally, return the complete configured locale.
|
||||
/**
|
||||
* Get the current locale.
|
||||
*
|
||||
* @param int $category
|
||||
* @return string|false
|
||||
*/
|
||||
protected function get_locale(int $category = LC_ALL): string|false {
|
||||
return \core\locale::get_locale($category);
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user