| Línea 99... |
Línea 99... |
| 99 |
case E_USER_WARNING:
|
99 |
case E_USER_WARNING:
|
| 100 |
$errnostr = 'Warning';
|
100 |
$errnostr = 'Warning';
|
| 101 |
break;
|
101 |
break;
|
| 102 |
case E_NOTICE:
|
102 |
case E_NOTICE:
|
| 103 |
case E_USER_NOTICE:
|
103 |
case E_USER_NOTICE:
|
| 104 |
case E_STRICT:
|
- |
|
| 105 |
$errnostr = 'Notice';
|
104 |
$errnostr = 'Notice';
|
| 106 |
break;
|
105 |
break;
|
| 107 |
case E_RECOVERABLE_ERROR:
|
106 |
case E_RECOVERABLE_ERROR:
|
| 108 |
$errnostr = 'Catchable';
|
107 |
$errnostr = 'Catchable';
|
| 109 |
break;
|
108 |
break;
|
| Línea 131... |
Línea 130... |
| 131 |
// If is preceded by an @ we don't show it.
|
130 |
// If is preceded by an @ we don't show it.
|
| 132 |
if (!error_reporting()) {
|
131 |
if (!error_reporting()) {
|
| 133 |
return true;
|
132 |
return true;
|
| 134 |
}
|
133 |
}
|
| Línea 135... |
Línea 134... |
| 135 |
|
134 |
|
| 136 |
// This error handler receives E_ALL | E_STRICT, running the behat test site the debug level is
|
135 |
// This error handler receives E_ALL, running the behat test site the debug level is
|
| 137 |
// set to DEVELOPER and will always include E_NOTICE,E_USER_NOTICE... as part of E_ALL, if the current
|
136 |
// set to DEVELOPER and will always include E_NOTICE,E_USER_NOTICE... as part of E_ALL, if the current
|
| 138 |
// error_reporting() value does not include one of those levels is because it has been forced through
|
137 |
// error_reporting() value does not include one of those levels is because it has been forced through
|
| 139 |
// the moodle code (see fix_utf8() for example) in that cases we respect the forced error level value.
|
138 |
// the moodle code (see fix_utf8() for example) in that cases we respect the forced error level value.
|
| 140 |
$respect = array(E_NOTICE, E_USER_NOTICE, E_STRICT, E_WARNING, E_USER_WARNING, E_DEPRECATED, E_USER_DEPRECATED);
|
139 |
$respect = [E_NOTICE, E_USER_NOTICE, E_WARNING, E_USER_WARNING, E_DEPRECATED, E_USER_DEPRECATED];
|
| Línea 141... |
Línea 140... |
| 141 |
foreach ($respect as $respectable) {
|
140 |
foreach ($respect as $respectable) {
|
| 142 |
|
141 |
|
| 143 |
// If the current value does not include this kind of errors and the reported error is
|
142 |
// If the current value does not include this kind of errors and the reported error is
|
| Línea 217... |
Línea 216... |
| 217 |
$allowed = array_flip(array(
|
216 |
$allowed = array_flip(array(
|
| 218 |
'wwwroot', 'dataroot', 'dirroot', 'admin', 'directorypermissions', 'filepermissions',
|
217 |
'wwwroot', 'dataroot', 'dirroot', 'admin', 'directorypermissions', 'filepermissions',
|
| 219 |
'umaskpermissions', 'dbtype', 'dblibrary', 'dbhost', 'dbname', 'dbuser', 'dbpass', 'prefix',
|
218 |
'umaskpermissions', 'dbtype', 'dblibrary', 'dbhost', 'dbname', 'dbuser', 'dbpass', 'prefix',
|
| 220 |
'dboptions', 'proxyhost', 'proxyport', 'proxytype', 'proxyuser', 'proxypassword',
|
219 |
'dboptions', 'proxyhost', 'proxyport', 'proxytype', 'proxyuser', 'proxypassword',
|
| 221 |
'proxybypass', 'pathtogs', 'pathtophp', 'pathtodu', 'aspellpath', 'pathtodot', 'skiplangupgrade',
|
220 |
'proxybypass', 'pathtogs', 'pathtophp', 'pathtodu', 'aspellpath', 'pathtodot', 'skiplangupgrade',
|
| 222 |
'altcacheconfigpath', 'pathtounoconv', 'alternative_file_system_class', 'pathtopython'
|
221 |
'altcacheconfigpath', 'pathtounoconv', 'alternative_file_system_class', 'pathtopython',
|
| - |
|
222 |
'routerconfigured',
|
| 223 |
));
|
223 |
));
|
| Línea 224... |
Línea 224... |
| 224 |
|
224 |
|
| 225 |
// Add extra allowed settings.
|
225 |
// Add extra allowed settings.
|
| 226 |
if (!empty($CFG->behat_extraallowedsettings)) {
|
226 |
if (!empty($CFG->behat_extraallowedsettings)) {
|
| Línea 231... |
Línea 231... |
| 231 |
foreach ($CFG as $key => $value) {
|
231 |
foreach ($CFG as $key => $value) {
|
| 232 |
if (!isset($allowed[$key]) && strpos($key, 'behat_') !== 0) {
|
232 |
if (!isset($allowed[$key]) && strpos($key, 'behat_') !== 0) {
|
| 233 |
unset($CFG->{$key});
|
233 |
unset($CFG->{$key});
|
| 234 |
}
|
234 |
}
|
| 235 |
}
|
235 |
}
|
| - |
|
236 |
|
| - |
|
237 |
// Allow email catcher settings.
|
| - |
|
238 |
if (defined('TEST_EMAILCATCHER_MAIL_SERVER')) {
|
| - |
|
239 |
$CFG->noemailever = false;
|
| - |
|
240 |
$CFG->smtphosts = TEST_EMAILCATCHER_MAIL_SERVER;
|
| - |
|
241 |
}
|
| 236 |
}
|
242 |
}
|
| Línea 237... |
Línea 243... |
| 237 |
|
243 |
|
| 238 |
/**
|
244 |
/**
|
| 239 |
* Checks that the behat config vars are properly set.
|
245 |
* Checks that the behat config vars are properly set.
|
| Línea 339... |
Línea 345... |
| 339 |
return true;
|
345 |
return true;
|
| 340 |
}
|
346 |
}
|
| 341 |
if (empty($CFG->behat_wwwroot)) {
|
347 |
if (empty($CFG->behat_wwwroot)) {
|
| 342 |
return false;
|
348 |
return false;
|
| 343 |
}
|
349 |
}
|
| - |
|
350 |
if (defined('CLI_SCRIPT') && CLI_SCRIPT && getenv('BEHAT_CLI')) {
|
| - |
|
351 |
// Environment variable makes CLI script run on Behat instance.
|
| - |
|
352 |
echo "BEHAT_CLI: This command line script is running on the acceptance testing site.\n\n";
|
| - |
|
353 |
return true;
|
| - |
|
354 |
}
|
| 344 |
if (isset($_SERVER['REMOTE_ADDR']) and behat_is_requested_url($CFG->behat_wwwroot)) {
|
355 |
if (isset($_SERVER['REMOTE_ADDR']) and behat_is_requested_url($CFG->behat_wwwroot)) {
|
| 345 |
// Something is accessing the web server like a real browser.
|
356 |
// Something is accessing the web server like a real browser.
|
| 346 |
return true;
|
357 |
return true;
|
| 347 |
}
|
358 |
}
|
| Línea 351... |
Línea 362... |
| 351 |
|
362 |
|
| 352 |
/**
|
363 |
/**
|
| 353 |
* Fix variables for parallel behat testing.
|
364 |
* Fix variables for parallel behat testing.
|
| 354 |
* - behat_wwwroot = behat_wwwroot{behatrunprocess}
|
365 |
* - behat_wwwroot = behat_wwwroot{behatrunprocess}
|
| 355 |
* - behat_dataroot = behat_dataroot{behatrunprocess}
|
366 |
* - behat_dataroot = behat_dataroot{behatrunprocess}
|
| 356 |
* - behat_prefix = behat_prefix.{behatrunprocess}_ (For oracle it will be firstletter of prefix and behatrunprocess)
|
367 |
* - behat_prefix = behat_prefix.{behatrunprocess}
|
| 357 |
**/
|
368 |
**/
|
| 358 |
function behat_update_vars_for_process() {
|
369 |
function behat_update_vars_for_process() {
|
| Línea 359... |
Línea 370... |
| 359 |
global $CFG;
|
370 |
global $CFG;
|
| Línea 382... |
Línea 393... |
| 382 |
$CFG->behat_dataroot .= $behatrunprocess;
|
393 |
$CFG->behat_dataroot .= $behatrunprocess;
|
| 383 |
}
|
394 |
}
|
| 384 |
}
|
395 |
}
|
| Línea 385... |
Línea 396... |
| 385 |
|
396 |
|
| 386 |
// Set behat_prefix for db, just suffix run process number, to avoid max length exceed.
|
- |
|
| 387 |
// For oracle only 2 letter prefix is possible.
|
397 |
// Set behat_prefix for db, just suffix run process number, to avoid max length exceed.
|
| 388 |
// NOTE: This will not work for parallel process > 9.
|
- |
|
| 389 |
if ($CFG->dbtype === 'oci') {
|
- |
|
| 390 |
$CFG->behat_prefix = substr($CFG->behat_prefix, 0, 1);
|
- |
|
| 391 |
$CFG->behat_prefix .= "{$behatrunprocess}";
|
- |
|
| 392 |
} else {
|
398 |
// NOTE: This will not work for parallel process > 9.
|
| 393 |
$CFG->behat_prefix .= "{$behatrunprocess}_";
|
- |
|
| Línea 394... |
Línea 399... |
| 394 |
}
|
399 |
$CFG->behat_prefix .= "{$behatrunprocess}_";
|
| 395 |
|
400 |
|
| 396 |
if (!empty($CFG->behat_parallel_run[$behatrunprocess - 1])) {
|
401 |
if (!empty($CFG->behat_parallel_run[$behatrunprocess - 1])) {
|
| 397 |
// Override allowed config vars.
|
402 |
// Override allowed config vars.
|