Commit 5f755ac2 authored by Eloy Lafuente's avatar Eloy Lafuente
Browse files

MDL-71036 phpunit: Deprecated expectException for notice/warning/error

In PHP 9.1, the use of expectException(PHPUnit\Framework\Error\*) has
been deprecated, that is, when a Notice/Warning/Error/Deprecated
problem is reported. Instead, these new assertions must be used:

- expectDeprecation() for E_DEPRECATED and E_USER_DEPRECATED
- expectNotice() for E_NOTICE, E_USER_NOTICE, and E_STRICT
- expectWarning() for E_WARNING and E_USER_WARNING
- expectError() for everything else

More info:

Regexp to find all them:

ag 'expectException.*(Notice|Warning|Error|Deprecated)
parent ba5b6089
......@@ -857,7 +857,7 @@ class core_event_testcase extends advanced_testcase {
// all that was done is to move the annotation (deprecated) to
// explicit expectation. Still try commenting it out and you'll see
// the notice.
$event = \core_tests\event\context_used_in_event::create(array('other' => array('sample' => 1, 'xx' => 10)));
......@@ -2297,7 +2297,7 @@ EOF;
public function test_get_string_limitation() {
// This is one of the limitations to the lang_string class. It can't be
// used as a key.
$array = array(get_string('yes', null, null, true) => 'yes');
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment