Compare commits
472 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c1d466b911 | |||
| 13561f5881 | |||
| a31041ef7b | |||
| 098013a01d | |||
| ec63b8f289 | |||
| b3cea552a2 | |||
| 9777b29452 | |||
| 081dc58c6f | |||
| a650045e23 | |||
| 1396072aa3 | |||
| 8864cfdcb8 | |||
| 727cedf0be | |||
| d45bc875af | |||
| d09d4730d9 | |||
| 57fcc42a49 | |||
| be680afe3e | |||
| e1d69f2347 | |||
| c0a69e036e | |||
| aca6d79b91 | |||
| a2c405ba5f | |||
| f200548361 | |||
| 1ff829a4f0 | |||
| 607cf7fff1 | |||
| f714dbee87 | |||
| 72ba0759fc | |||
| 0ada05c99f | |||
| a5c0090669 | |||
| 31d7689f7f | |||
| 86a5027502 | |||
| 36002cf5e7 | |||
| 778a1c3546 | |||
| 19666984de | |||
| 268b9dadfd | |||
| e3b1909b2b | |||
| da1346752d | |||
| 50bbd580ac | |||
| 6367ed9300 | |||
| 8684982cfe | |||
| 59a80f598b | |||
| 181f00f36e | |||
| 38aaac7af6 | |||
| fb7ef63350 | |||
| 2d51edb610 | |||
| 24e196b63d | |||
| 944e9d5fdc | |||
| b28424638c | |||
| d580889967 | |||
| d559cde424 | |||
| fafeeda7e1 | |||
| ef70a58aed | |||
| d82ea0f211 | |||
| 96cf22c819 | |||
| 833b48fc75 | |||
| a1b390bd4f | |||
| cc9b202deb | |||
| f2e657fc42 | |||
| d94e170007 | |||
| d430695693 | |||
| 36030e92d7 | |||
| 0d0cdaeecf | |||
| dc9b44f531 | |||
| 2243d1b395 | |||
| c0a2c4bfd8 | |||
| 49a95e4cef | |||
| d1d01d2cdb | |||
| cef371bcac | |||
| 60dafdf7c1 | |||
| 9e351777b1 | |||
| 0620ca406c | |||
| cc2edf3b8c | |||
| 7376b6deca | |||
| 7052d36f7c | |||
| 04479a6a3c | |||
| 3521b24e51 | |||
| bdfa441f00 | |||
| 6728d1ccc0 | |||
| 40d1da51bb | |||
| c52869afbe | |||
| 18d4531ad4 | |||
| 62aab40860 | |||
| b4525ba984 | |||
| 7b16b52ffe | |||
| ff93557b40 | |||
| 48e8e6f434 | |||
| ecc5f367ef | |||
| 850b4a5f56 | |||
| 91eae783fc | |||
| 912817f097 | |||
| 36412a5fea | |||
| a7f19c9072 | |||
| 4bc773ad03 | |||
| cb05767ce1 | |||
| 4973da2768 | |||
| aa145e2669 | |||
| bdc4367460 | |||
| fc467246b4 | |||
| ee502bf6b5 | |||
| ee6e605770 | |||
| 2d953eb291 | |||
| 6e7faf5854 | |||
| 50569e6f4a | |||
| 23a61db0f0 | |||
| d3d580671a | |||
| 8304649791 | |||
| c8c3b17cd2 | |||
| 3e5569a61a | |||
| 80782f8907 | |||
| 51af50ade5 | |||
| b683a38423 | |||
| 54dc1112cb | |||
| 421c0608e8 | |||
| 7678c3f41c | |||
| a3573087d1 | |||
| f809e209e3 | |||
| 59a377abbe | |||
| ac7cecfb37 | |||
| 83a24b0e9f | |||
| 7ffbd04d35 | |||
| 19284518d1 | |||
| cb8578e93f | |||
| 217f5d8f8d | |||
| dec2143d73 | |||
| abd4203547 | |||
| 28922ba889 | |||
| b67fb190b9 | |||
| 1e0f46a125 | |||
| 1abeac9ba4 | |||
| 84c134f7c0 | |||
| aa8f7a6a39 | |||
| 2937e90bc7 | |||
| 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 | |||
| 1bff691a64 | |||
| 1913cdb088 | |||
| 2ed6a57f36 | |||
| 2692097272 | |||
| 11ca67f853 | |||
| 4d5289e599 | |||
| 89d9032e4d | |||
| a49c099ae5 | |||
| 20d6ffb9ee | |||
| fbd18d8ead | |||
| dfde819c8b | |||
| ad9d4bb4af | |||
| 569d9dfe39 |
@@ -4,7 +4,6 @@ on:
|
||||
push:
|
||||
branches-ignore:
|
||||
- main
|
||||
- master
|
||||
- MOODLE_[0-9]+_STABLE
|
||||
tags-ignore:
|
||||
- v[0-9]+.[0-9]+.[0-9]+*
|
||||
|
||||
@@ -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 }}
|
||||
+3
-1
@@ -26,7 +26,9 @@
|
||||
/.patches/
|
||||
/.idea/
|
||||
.phpstorm.*
|
||||
!.phpstorm.meta.php
|
||||
!/.phpstorm.meta.php/
|
||||
/.phpstorm.meta.php/*
|
||||
!/.phpstorm.meta.php/di.php
|
||||
/nbproject/
|
||||
CVS
|
||||
.DS_Store
|
||||
|
||||
@@ -500,4 +500,15 @@ abstract class plugin_management_table extends flexible_table implements dynamic
|
||||
protected function supports_ordering(): bool {
|
||||
return $this->plugininfoclass::plugintype_supports_ordering();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the user has the capability to access this table.
|
||||
*
|
||||
* Default implementation for plugin management tables is to require 'moodle/site:config' capability
|
||||
*
|
||||
* @return bool Return true if capability check passed.
|
||||
*/
|
||||
public function has_capability(): bool {
|
||||
return has_capability('moodle/site:config', $this->get_context());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,6 +177,7 @@ $CFG->admin = array_pop($parts);
|
||||
ini_set('include_path', $CFG->libdir.'/pear' . PATH_SEPARATOR . ini_get('include_path'));
|
||||
|
||||
require_once($CFG->libdir.'/classes/component.php');
|
||||
|
||||
require_once($CFG->libdir.'/classes/text.php');
|
||||
require_once($CFG->libdir.'/classes/string_manager.php');
|
||||
require_once($CFG->libdir.'/classes/string_manager_install.php');
|
||||
@@ -192,13 +193,8 @@ require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/componentlib.class.php');
|
||||
require_once($CFG->dirroot.'/cache/lib.php');
|
||||
|
||||
// Register our classloader, in theory somebody might want to replace it to load other hacked core classes.
|
||||
// Required because the database checks below lead to session interaction which is going to lead us to requiring autoloaded classes.
|
||||
if (defined('COMPONENT_CLASSLOADER')) {
|
||||
spl_autoload_register(COMPONENT_CLASSLOADER);
|
||||
} else {
|
||||
spl_autoload_register('core_component::classloader');
|
||||
}
|
||||
// Register our classloader.
|
||||
\core_component::register_autoloader();
|
||||
|
||||
require($CFG->dirroot.'/version.php');
|
||||
$CFG->target_release = $release;
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -38,6 +38,6 @@
|
||||
}
|
||||
}}
|
||||
<div class="form-checkbox defaultsnext">
|
||||
<input type="hidden" name="{{name}}" value="{{no}}">
|
||||
{{^readonly}}<input type="hidden" name="{{name}}" value="{{no}}">{{/readonly}}
|
||||
<input {{#readonly}}disabled{{/readonly}} type="checkbox" name="{{name}}" value="{{value}}" id="{{id}}" {{#checked}}checked{{/checked}}>
|
||||
</div>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
}
|
||||
}}
|
||||
<div class="form-multicheckbox">
|
||||
<input type="hidden" name="{{name}}[xxxxx]" value="1">
|
||||
{{^readonly}}<input type="hidden" name="{{name}}[xxxxx]" value="1">{{/readonly}}
|
||||
{{#hasoptions}}
|
||||
<ul>
|
||||
{{#options}}
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
Setting configmultiselect.
|
||||
}}
|
||||
<div class="form-select">
|
||||
<input type="hidden" name="{{name}}[xxxxx]" value="1">
|
||||
{{^readonly}}<input type="hidden" name="{{name}}[xxxxx]" value="1">{{/readonly}}
|
||||
<select {{#readonly}}disabled{{/readonly}} id="{{id}}" name="{{name}}[]" size="{{size}}" class="form-control" multiple>
|
||||
{{#options}}
|
||||
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
Setting configmultiselect with optgroup support.
|
||||
}}
|
||||
<div class="form-select">
|
||||
<input type="hidden" name="{{name}}[xxxxx]" value="1">
|
||||
{{^readonly}}<input type="hidden" name="{{name}}[xxxxx]" value="1">{{/readonly}}
|
||||
<select {{#readonly}}disabled{{/readonly}} id="{{id}}" name="{{name}}[]" size="{{size}}" class="form-control" multiple>
|
||||
{{#options}}
|
||||
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
|
||||
|
||||
@@ -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 |
|
||||
|
||||
@@ -48,25 +48,3 @@ Feature: View task logs report and use its filters
|
||||
| operator | shouldornotsee |
|
||||
| Less than | should not see |
|
||||
| Greater than | should see |
|
||||
|
||||
@javascript
|
||||
Scenario: Reset task log filters
|
||||
Given I log in as "admin"
|
||||
And I change window size to "large"
|
||||
And I navigate to "Server > Tasks > Task logs" in site administration
|
||||
When I click on "Filters" "button"
|
||||
And I set the following fields in the "Result" "core_reportbuilder > Filter" to these values:
|
||||
| Result operator | Is equal to |
|
||||
| Result value | Fail |
|
||||
And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
|
||||
Then I should see "Filters applied"
|
||||
And I should see "Filters (1)" in the "#dropdownFiltersButton" "css_element"
|
||||
And I should see "Nothing to display"
|
||||
And I click on "Reset all" "button" in the "[data-region='report-filters']" "css_element"
|
||||
And I should see "Filters reset"
|
||||
And I should not see "Filters (1)" in the "#dropdownFiltersButton" "css_element"
|
||||
And I should see "Filters" in the "#dropdownFiltersButton" "css_element"
|
||||
And "[data-region='report-filters']" "css_element" should be visible
|
||||
And the following fields in the "Result" "core_reportbuilder > Filter" match these values:
|
||||
| Result operator | Is any value |
|
||||
And I should not see "Nothing to display"
|
||||
|
||||
@@ -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.
|
||||
|
||||
+29
-11
@@ -245,7 +245,6 @@ class brickfield_accessibility_color_test extends brickfield_accessibility_test
|
||||
return $luminosity;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the decimal equivalents for a HEX color. Returns null if it cannot be determined.
|
||||
* @param string $color The hex color value
|
||||
@@ -268,13 +267,21 @@ class brickfield_accessibility_color_test extends brickfield_accessibility_test
|
||||
*/
|
||||
public function convert_color(string $color): string {
|
||||
$color = trim($color);
|
||||
if (strpos($color, ' ') !== false) {
|
||||
$colors = explode(' ', $color);
|
||||
foreach ($colors as $backgroundpart) {
|
||||
if (substr(trim($backgroundpart), 0, 1) == '#' ||
|
||||
in_array(trim($backgroundpart), array_keys($this->colornames)) ||
|
||||
strtolower(substr(trim($backgroundpart), 0, 3)) == 'rgb') {
|
||||
$color = $backgroundpart;
|
||||
// Search for color in rgb format first, as this can potentially contain a space.
|
||||
if (strpos($color, 'rgb') !== false) {
|
||||
$colors = explode('rgb', $color, 2); // Getting 2 only in array.
|
||||
// Getting end point of rgb value, i.e. the end bracket.
|
||||
$endpos = strpos($colors[1], ')');
|
||||
$color = 'rgb' . substr($colors[1], 0, ($endpos + 1)); // Recompiling rgb value.
|
||||
} else {
|
||||
// Splitting multi-value css background value.
|
||||
if (strpos($color, ' ') !== false) {
|
||||
$colors = explode(' ', $color);
|
||||
foreach ($colors as $backgroundpart) {
|
||||
if (substr(trim($backgroundpart), 0, 1) == '#' ||
|
||||
in_array(trim($backgroundpart), array_keys($this->colornames))) {
|
||||
$color = $backgroundpart;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -296,9 +303,20 @@ class brickfield_accessibility_color_test extends brickfield_accessibility_test
|
||||
}
|
||||
// RGB values.
|
||||
if (strtolower(substr($color, 0, 3)) == 'rgb') {
|
||||
$colors = explode(',', trim(str_replace('rgb(', '', $color), '()'));
|
||||
if (count($colors) != 3) {
|
||||
return false;
|
||||
if (strpos($color, 'rgba') !== false) {
|
||||
$tmpbg = $this->get_rgb($this->defaultbackground);
|
||||
$colors = explode(',', trim(str_replace('rgba(', '', $color), '()'));
|
||||
if (count($colors) != 4) {
|
||||
return false;
|
||||
}
|
||||
$colors[0] = round(((1 - $colors[3]) * $tmpbg['r']) + ($colors[3] * $colors[0]));
|
||||
$colors[1] = round((1 - $colors[3]) * $tmpbg['g']) + ($colors[3] * $colors[1]);
|
||||
$colors[2] = round((1 - $colors[3]) * $tmpbg['b']) + ($colors[3] * $colors[2]);
|
||||
} else {
|
||||
$colors = explode(',', trim(str_replace('rgb(', '', $color), '()'));
|
||||
if (count($colors) != 3) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$r = intval($colors[0]);
|
||||
$g = intval($colors[1]);
|
||||
|
||||
+12
-7
@@ -62,9 +62,18 @@ class css_text_has_contrast extends brickfield_accessibility_color_test {
|
||||
foreach ($entries as $element) {
|
||||
$style = $this->css->get_style($element);
|
||||
|
||||
if (isset($style['background-color']) || isset($style['color'])) {
|
||||
if (isset($style['background-color']) || isset($style['color']) || isset($style['background'])) {
|
||||
if (!isset($style['background-color'])) {
|
||||
$style['background-color'] = $this->defaultbackground;
|
||||
if (isset($style['background'])) {
|
||||
// Parsing background-color from CSS background shortcut string.
|
||||
$style['background-color'] = '#' . $this->convert_color($style['background']);
|
||||
// If value is empty after hash, then use defaultbackground.
|
||||
if ($style['background-color'] == '#') {
|
||||
$style['background-color'] = $this->defaultbackground;
|
||||
}
|
||||
} else {
|
||||
$style['background-color'] = $this->defaultbackground;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($style['color'])) {
|
||||
@@ -82,11 +91,7 @@ class css_text_has_contrast extends brickfield_accessibility_color_test {
|
||||
$style['color'] = '#' . $this->convert_color($style['color']);
|
||||
$style['background-color'] = '#' . $this->convert_color($background);
|
||||
|
||||
if (substr($background, 0, 3) == "rgb") {
|
||||
$background = '#' . $this->convert_color($background);
|
||||
}
|
||||
|
||||
$luminosity = $this->get_luminosity($style['color'], $background);
|
||||
$luminosity = $this->get_luminosity($style['color'], $style['background-color']);
|
||||
$fontsize = 0;
|
||||
$bold = false;
|
||||
$italic = false;
|
||||
|
||||
@@ -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>');
|
||||
|
||||
|
||||
+124
-13
@@ -30,6 +30,7 @@ require_once('all_checks.php');
|
||||
|
||||
/**
|
||||
* Class test_css_text_has_contrast_test
|
||||
* @covers \tool_brickfield\local\htmlchecker\brickfield_accessibility
|
||||
*/
|
||||
class css_text_has_contrast_test extends all_checks {
|
||||
/** @var string The check type. */
|
||||
@@ -229,7 +230,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 +256,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 +264,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 +272,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 +280,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 +288,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 +296,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 +304,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 +312,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 +320,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 +328,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 +336,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,8 +344,118 @@ 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for rgb colors with insufficient contrast.
|
||||
*/
|
||||
public function test_bad_rgbcolor(): void {
|
||||
$html = '<body><p style="color:rgb(255, 255, 255); background-color:rgb(204, 204, 204);">
|
||||
This is not contrasty enough.</p></body>';
|
||||
$results = $this->get_checker_results($html);
|
||||
$this->assertTrue($results[0]->element->tagName == 'p');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for rgb colors with sufficient contrast.
|
||||
*/
|
||||
public function test_good_rgbcolor(): void {
|
||||
$html = '<body><p style="color:rgb(255, 255, 255); background-color:rgb(0, 0, 0);">
|
||||
This is contrasty enough.</p></body>';
|
||||
$results = $this->get_checker_results($html);
|
||||
$this->assertEmpty($results);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for named colors with insufficient contrast.
|
||||
*/
|
||||
public function test_bad_namedcolor2(): void {
|
||||
$html = '<body><p style="color:lightcyan; background-color:lavender;">
|
||||
This is not contrasty enough.</p></body>';
|
||||
$results = $this->get_checker_results($html);
|
||||
$this->assertTrue($results[0]->element->tagName == 'p');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for named colors with sufficient contrast.
|
||||
*/
|
||||
public function test_good_namedcolor2(): void {
|
||||
$html = '<body><p style="color:linen; background-color:darkslategray;">
|
||||
This is contrasty enough.</p></body>';
|
||||
$results = $this->get_checker_results($html);
|
||||
$this->assertEmpty($results);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for background value with insufficient contrast.
|
||||
*/
|
||||
public function test_bad_backgroundcss(): void {
|
||||
$html = '<body><p style="color:lightcyan; background:fixed lavender center;">
|
||||
This is not contrasty enough.</p></body>';
|
||||
$results = $this->get_checker_results($html);
|
||||
$this->assertTrue($results[0]->element->tagName == 'p');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for background value with sufficient contrast.
|
||||
*/
|
||||
public function test_good_backgroundcss(): void {
|
||||
$html = '<body><p style="color:linen; background:fixed darkslategray center;">
|
||||
This is contrasty enough.</p></body>';
|
||||
$results = $this->get_checker_results($html);
|
||||
$this->assertEmpty($results);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for background value with rgb with insufficient contrast.
|
||||
*/
|
||||
public function test_bad_backgroundcssrgb(): void {
|
||||
$html = '<body><p style="color:rgb(255, 255, 255); background:fixed rgb(204, 204, 204) center;">
|
||||
This is not contrasty enough.</p></body>';
|
||||
$results = $this->get_checker_results($html);
|
||||
$this->assertTrue($results[0]->element->tagName == 'p');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for background value with rgb with sufficient contrast.
|
||||
*/
|
||||
public function test_good_backgroundcssrgb(): void {
|
||||
$html = '<body><p style="color:rgb(255, 255, 255); background:fixed rgb(0, 0, 0) center;">
|
||||
This is contrasty enough.</p></body>';
|
||||
$results = $this->get_checker_results($html);
|
||||
$this->assertEmpty($results);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for text with insufficient contrast of 4.3.
|
||||
*/
|
||||
public function test_bad_contrastrounding(): void {
|
||||
$html = '<body><p style="color:#F50000; background-color:white; font-size: 12px">
|
||||
This is not contrasty enough.</p></body>';
|
||||
$results = $this->get_checker_results($html);
|
||||
$this->assertTrue($results[0]->element->tagName == 'p');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for background value with rgba with insufficient contrast.
|
||||
*/
|
||||
public function test_bad_backgroundcssrgba(): void {
|
||||
$html = '<body><p style="color:rgba(255, 255, 255, 0.5); background:fixed rgba(0, 204, 204, 0.5) center;">
|
||||
This is not contrasty enough.</p></body>';
|
||||
$results = $this->get_checker_results($html);
|
||||
$this->assertTrue($results[0]->element->tagName == 'p');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for background value with rgba with sufficient contrast.
|
||||
*/
|
||||
public function test_good_backgroundcssrgba(): void {
|
||||
$html = '<body><p style="color:rgba(255, 255, 255, 0.75); background:fixed rgba(0, 0, 0, 0.75) center;">
|
||||
This is contrasty enough.</p></body>';
|
||||
$results = $this->get_checker_results($html);
|
||||
$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();
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -54,6 +54,7 @@ Feature: Data delete from the privacy API
|
||||
And I should see "Awaiting approval" in the "Victim User 1" "table_row"
|
||||
And I open the action menu in "Victim User 1" "table_row"
|
||||
And I follow "Approve request"
|
||||
And I wait until "Approve request" "button" exists
|
||||
And I press "Approve request"
|
||||
And I should see "Approved" in the "Victim User 1" "table_row"
|
||||
And I run all adhoc tasks
|
||||
@@ -80,6 +81,7 @@ Feature: Data delete from the privacy API
|
||||
And I navigate to "Users > Privacy and policies > Data requests" in site administration
|
||||
And I open the action menu in "Victim User 1" "table_row"
|
||||
And I follow "Approve request"
|
||||
And I wait until "Approve request" "button" exists
|
||||
And I press "Approve request"
|
||||
|
||||
And I log out
|
||||
@@ -115,6 +117,7 @@ Feature: Data delete from the privacy API
|
||||
And I navigate to "Users > Privacy and policies > Data requests" in site administration
|
||||
And I open the action menu in "Victim User 1" "table_row"
|
||||
And I follow "Approve request"
|
||||
And I wait until "Approve request" "button" exists
|
||||
And I press "Approve request"
|
||||
|
||||
And I log out
|
||||
|
||||
@@ -48,6 +48,7 @@ Feature: Data export from the privacy API
|
||||
And I should see "Awaiting approval" in the "Victim User 1" "table_row"
|
||||
And I open the action menu in "Victim User 1" "table_row"
|
||||
And I follow "Approve request"
|
||||
And I wait until "Approve request" "button" exists
|
||||
And I press "Approve request"
|
||||
And I should see "Approved" in the "Victim User 1" "table_row"
|
||||
And I run all adhoc tasks
|
||||
@@ -115,6 +116,7 @@ Feature: Data export from the privacy API
|
||||
And I navigate to "Users > Privacy and policies > Data requests" in site administration
|
||||
And I open the action menu in "Victim User 1" "table_row"
|
||||
And I follow "Approve request"
|
||||
And I wait until "Approve request" "button" exists
|
||||
And I press "Approve request"
|
||||
|
||||
And I log out
|
||||
@@ -185,7 +187,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.
|
||||
|
||||
@@ -67,6 +67,12 @@ class runner {
|
||||
if (!class_exists('Behat\Gherkin\Lexer')) {
|
||||
throw new \moodle_exception('Missing behat classes.');
|
||||
}
|
||||
|
||||
// Behat constant.
|
||||
if (!defined('BEHAT_TEST')) {
|
||||
define('BEHAT_TEST', 1);
|
||||
}
|
||||
|
||||
// Behat utilities.
|
||||
require_once($CFG->libdir . '/behat/classes/util.php');
|
||||
require_once($CFG->libdir . '/behat/classes/behat_command.php');
|
||||
|
||||
@@ -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();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user